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:03, 46.80it/s]
8%|▊ | 12/151 [00:00<00:02, 58.89it/s]
13%|█▎ | 19/151 [00:00<00:02, 63.09it/s]
17%|█▋ | 26/151 [00:00<00:01, 65.53it/s]
23%|██▎ | 34/151 [00:00<00:01, 67.41it/s]
27%|██▋ | 41/151 [00:00<00:01, 67.82it/s]
32%|███▏ | 48/151 [00:00<00:01, 67.74it/s]
36%|███▋ | 55/151 [00:00<00:01, 67.90it/s]
41%|████ | 62/151 [00:00<00:01, 68.21it/s]
46%|████▌ | 69/151 [00:01<00:01, 66.71it/s]
50%|█████ | 76/151 [00:01<00:01, 65.71it/s]
55%|█████▍ | 83/151 [00:01<00:01, 64.46it/s]
60%|█████▉ | 90/151 [00:01<00:00, 64.06it/s]
64%|██████▍ | 97/151 [00:01<00:00, 65.09it/s]
69%|██████▉ | 104/151 [00:01<00:00, 65.65it/s]
74%|███████▎ | 111/151 [00:01<00:00, 65.16it/s]
78%|███████▊ | 118/151 [00:01<00:00, 64.69it/s]
83%|████████▎ | 125/151 [00:01<00:00, 63.57it/s]
87%|████████▋ | 132/151 [00:02<00:00, 63.07it/s]
92%|█████████▏| 139/151 [00:02<00:00, 61.57it/s]
97%|█████████▋| 146/151 [00:02<00:00, 62.69it/s]
100%|██████████| 151/151 [00:02<00:00, 64.61it/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.698 seconds)