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 (558, 571) to (560, 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).
3%|▎ | 5/151 [00:00<00:02, 49.06it/s]
9%|▊ | 13/151 [00:00<00:02, 65.00it/s]
14%|█▍ | 21/151 [00:00<00:01, 70.21it/s]
19%|█▉ | 29/151 [00:00<00:01, 72.96it/s]
25%|██▍ | 37/151 [00:00<00:01, 75.33it/s]
30%|██▉ | 45/151 [00:00<00:01, 74.01it/s]
35%|███▌ | 53/151 [00:00<00:01, 74.39it/s]
40%|████ | 61/151 [00:00<00:01, 75.00it/s]
46%|████▌ | 69/151 [00:00<00:01, 73.56it/s]
51%|█████ | 77/151 [00:01<00:01, 73.06it/s]
56%|█████▋ | 85/151 [00:01<00:00, 71.34it/s]
62%|██████▏ | 93/151 [00:01<00:00, 71.60it/s]
67%|██████▋ | 101/151 [00:01<00:00, 72.68it/s]
72%|███████▏ | 109/151 [00:01<00:00, 72.12it/s]
77%|███████▋ | 117/151 [00:01<00:00, 72.13it/s]
83%|████████▎ | 125/151 [00:01<00:00, 70.83it/s]
88%|████████▊ | 133/151 [00:01<00:00, 68.10it/s]
93%|█████████▎| 141/151 [00:01<00:00, 69.25it/s]
99%|█████████▊| 149/151 [00:02<00:00, 70.60it/s]
100%|██████████| 151/151 [00:02<00:00, 71.44it/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.433 seconds)