Ease function#

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 (752, 597) to (752, 608) 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).

  3%|▎         | 5/151 [00:00<00:03, 45.81it/s]
  8%|▊         | 12/151 [00:00<00:02, 55.24it/s]
 13%|█▎        | 19/151 [00:00<00:02, 58.73it/s]
 17%|█▋        | 26/151 [00:00<00:02, 60.77it/s]
 22%|██▏       | 33/151 [00:00<00:01, 62.05it/s]
 26%|██▋       | 40/151 [00:00<00:01, 63.11it/s]
 31%|███       | 47/151 [00:00<00:01, 63.39it/s]
 36%|███▌      | 54/151 [00:00<00:01, 62.26it/s]
 40%|████      | 61/151 [00:00<00:01, 63.00it/s]
 45%|████▌     | 68/151 [00:01<00:01, 61.30it/s]
 50%|████▉     | 75/151 [00:01<00:01, 60.10it/s]
 54%|█████▍    | 82/151 [00:01<00:01, 58.45it/s]
 58%|█████▊    | 88/151 [00:01<00:01, 57.47it/s]
 62%|██████▏   | 94/151 [00:01<00:00, 57.62it/s]
 66%|██████▌   | 100/151 [00:01<00:00, 57.79it/s]
 70%|███████   | 106/151 [00:01<00:00, 58.30it/s]
 74%|███████▍  | 112/151 [00:01<00:00, 58.38it/s]
 78%|███████▊  | 118/151 [00:01<00:00, 57.70it/s]
 82%|████████▏ | 124/151 [00:02<00:00, 55.96it/s]
 86%|████████▌ | 130/151 [00:02<00:00, 56.01it/s]
 90%|█████████ | 136/151 [00:02<00:00, 55.19it/s]
 94%|█████████▍| 142/151 [00:02<00:00, 52.94it/s]
 98%|█████████▊| 148/151 [00:02<00:00, 54.67it/s]
100%|██████████| 151/151 [00:02<00:00, 58.10it/s]

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

cat = data.cat()
viewer = napari.Viewer()
viewer.add_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 4.022 seconds)

Gallery generated by Sphinx-Gallery