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 (778, 576) to (784, 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).
5%|▌ | 8/151 [00:00<00:01, 73.32it/s]
12%|█▏ | 18/151 [00:00<00:01, 86.65it/s]
19%|█▊ | 28/151 [00:00<00:01, 90.59it/s]
25%|██▌ | 38/151 [00:00<00:01, 92.92it/s]
32%|███▏ | 48/151 [00:00<00:01, 92.14it/s]
38%|███▊ | 58/151 [00:00<00:01, 91.52it/s]
45%|████▌ | 68/151 [00:00<00:00, 86.63it/s]
51%|█████ | 77/151 [00:00<00:00, 82.10it/s]
57%|█████▋ | 86/151 [00:01<00:00, 79.60it/s]
63%|██████▎ | 95/151 [00:01<00:00, 79.53it/s]
70%|██████▉ | 105/151 [00:01<00:00, 82.71it/s]
75%|███████▌ | 114/151 [00:01<00:00, 84.46it/s]
81%|████████▏ | 123/151 [00:01<00:00, 83.92it/s]
87%|████████▋ | 132/151 [00:01<00:00, 81.69it/s]
93%|█████████▎| 141/151 [00:01<00:00, 81.35it/s]
99%|█████████▉| 150/151 [00:01<00:00, 82.25it/s]
100%|██████████| 151/151 [00:01<00:00, 84.15it/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 2.719 seconds)