Ease function#

/home/runner/work/napari-animation/napari-animation/examples/ease_function.py:11: FutureWarning: `napari.view_image` is deprecated and will be removed in napari 0.7.0.
Use `viewer = napari.Viewer(); viewer.add_image(...)` instead.
  viewer = napari.view_image(cat, rgb=True)
Rendering frames...

  0%|          | 0/151 [00:00<?, ?it/s]IMAGEIO FFMPEG_WRITER WARNING: input image is not divisible by macro_block_size=16, resizing from (767, 576) to (768, 576) to ensure video compatibility with most codecs and players. To prevent resizing, make your input image divisible by the macro_block_size or set the macro_block_size to 1 (risking incompatibility).

  4%|▍         | 6/151 [00:00<00:02, 54.49it/s]
 10%|▉         | 15/151 [00:00<00:01, 70.00it/s]
 15%|█▌        | 23/151 [00:00<00:01, 73.86it/s]
 21%|██        | 32/151 [00:00<00:01, 76.60it/s]
 27%|██▋       | 41/151 [00:00<00:01, 78.38it/s]
 32%|███▏      | 49/151 [00:00<00:01, 76.76it/s]
 38%|███▊      | 57/151 [00:00<00:01, 77.70it/s]
 43%|████▎     | 65/151 [00:00<00:01, 75.96it/s]
 48%|████▊     | 73/151 [00:00<00:01, 72.04it/s]
 54%|█████▎    | 81/151 [00:01<00:01, 69.04it/s]
 58%|█████▊    | 88/151 [00:01<00:00, 67.35it/s]
 64%|██████▎   | 96/151 [00:01<00:00, 68.20it/s]
 69%|██████▉   | 104/151 [00:01<00:00, 70.18it/s]
 74%|███████▍  | 112/151 [00:01<00:00, 72.01it/s]
 79%|███████▉  | 120/151 [00:01<00:00, 72.02it/s]
 85%|████████▍ | 128/151 [00:01<00:00, 71.12it/s]
 90%|█████████ | 136/151 [00:01<00:00, 69.05it/s]
 95%|█████████▌| 144/151 [00:02<00:00, 70.62it/s]
100%|██████████| 151/151 [00:02<00:00, 71.98it/s]

import napari
from skimage import data
from napari_animation import Animation
from napari_animation.easing import Easing

cat = data.cat()
viewer = napari.view_image(cat, rgb=True)


animation = Animation(viewer)
viewer.camera.zoom = 1
animation.capture_keyframe(steps=0)
animation.capture_keyframe(steps=60)
viewer.camera.zoom = 1.5
animation.capture_keyframe(steps=30, ease=Easing.QUADRATIC)

animation.capture_keyframe(steps=60)

animation.animate("ease_function.mp4", canvas_only=True, fps=60)

Total running time of the script: (0 minutes 3.588 seconds)

Gallery generated by Sphinx-Gallery