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 (752, 609) to (752, 624) 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, 46.22it/s]
8%|▊ | 12/151 [00:00<00:02, 56.18it/s]
13%|█▎ | 19/151 [00:00<00:02, 59.21it/s]
17%|█▋ | 26/151 [00:00<00:02, 60.43it/s]
22%|██▏ | 33/151 [00:00<00:01, 61.70it/s]
26%|██▋ | 40/151 [00:00<00:01, 62.25it/s]
31%|███ | 47/151 [00:00<00:01, 58.96it/s]
35%|███▌ | 53/151 [00:00<00:01, 58.23it/s]
40%|███▉ | 60/151 [00:01<00:01, 58.91it/s]
44%|████▎ | 66/151 [00:01<00:01, 59.10it/s]
48%|████▊ | 72/151 [00:01<00:01, 57.94it/s]
52%|█████▏ | 78/151 [00:01<00:01, 57.53it/s]
56%|█████▌ | 84/151 [00:01<00:01, 56.31it/s]
60%|█████▉ | 90/151 [00:01<00:01, 56.61it/s]
64%|██████▍ | 97/151 [00:01<00:00, 57.82it/s]
68%|██████▊ | 103/151 [00:01<00:00, 58.25it/s]
72%|███████▏ | 109/151 [00:01<00:00, 58.36it/s]
77%|███████▋ | 116/151 [00:01<00:00, 57.90it/s]
81%|████████ | 122/151 [00:02<00:00, 58.31it/s]
85%|████████▍ | 128/151 [00:02<00:00, 56.17it/s]
89%|████████▊ | 134/151 [00:02<00:00, 53.11it/s]
93%|█████████▎| 140/151 [00:02<00:00, 52.60it/s]
97%|█████████▋| 146/151 [00:02<00:00, 53.02it/s]
100%|██████████| 151/151 [00:02<00:00, 56.96it/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.028 seconds)