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 (787, 576) to (800, 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, 53.65it/s]
 10%|▉         | 15/151 [00:00<00:01, 69.54it/s]
 16%|█▌        | 24/151 [00:00<00:01, 74.95it/s]
 22%|██▏       | 33/151 [00:00<00:01, 76.99it/s]
 27%|██▋       | 41/151 [00:00<00:01, 77.97it/s]
 32%|███▏      | 49/151 [00:00<00:01, 76.71it/s]
 38%|███▊      | 57/151 [00:00<00:01, 76.88it/s]
 43%|████▎     | 65/151 [00:00<00:01, 74.43it/s]
 48%|████▊     | 73/151 [00:01<00:01, 69.14it/s]
 53%|█████▎    | 80/151 [00:01<00:01, 65.96it/s]
 58%|█████▊    | 87/151 [00:01<00:01, 63.67it/s]
 62%|██████▏   | 94/151 [00:01<00:00, 64.20it/s]
 68%|██████▊   | 102/151 [00:01<00:00, 67.31it/s]
 73%|███████▎  | 110/151 [00:01<00:00, 68.94it/s]
 78%|███████▊  | 118/151 [00:01<00:00, 69.54it/s]
 83%|████████▎ | 125/151 [00:01<00:00, 68.50it/s]
 87%|████████▋ | 132/151 [00:01<00:00, 67.52it/s]
 93%|█████████▎| 140/151 [00:02<00:00, 68.53it/s]
 98%|█████████▊| 148/151 [00:02<00:00, 70.41it/s]
100%|██████████| 151/151 [00:02<00:00, 70.13it/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.999 seconds)

Gallery generated by Sphinx-Gallery