Note
Go to the end to download the full example code.
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 (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, 57.58it/s]
10%|▉ | 15/151 [00:00<00:01, 73.30it/s]
16%|█▌ | 24/151 [00:00<00:01, 78.53it/s]
22%|██▏ | 33/151 [00:00<00:01, 81.13it/s]
28%|██▊ | 42/151 [00:00<00:01, 81.70it/s]
34%|███▍ | 51/151 [00:00<00:01, 81.46it/s]
40%|███▉ | 60/151 [00:00<00:01, 80.07it/s]
46%|████▌ | 69/151 [00:00<00:01, 74.90it/s]
51%|█████ | 77/151 [00:01<00:01, 71.19it/s]
56%|█████▋ | 85/151 [00:01<00:00, 68.33it/s]
61%|██████ | 92/151 [00:01<00:00, 65.88it/s]
66%|██████▌ | 100/151 [00:01<00:00, 68.82it/s]
72%|███████▏ | 108/151 [00:01<00:00, 70.76it/s]
77%|███████▋ | 116/151 [00:01<00:00, 71.73it/s]
82%|████████▏ | 124/151 [00:01<00:00, 71.35it/s]
87%|████████▋ | 132/151 [00:01<00:00, 69.07it/s]
92%|█████████▏| 139/151 [00:01<00:00, 68.58it/s]
97%|█████████▋| 147/151 [00:02<00:00, 70.11it/s]
100%|██████████| 151/151 [00:02<00:00, 72.40it/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 3.907 seconds)