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 (702, 576) to (704, 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.16it/s]
8%|▊ | 12/151 [00:00<00:02, 57.35it/s]
13%|█▎ | 20/151 [00:00<00:02, 65.08it/s]
19%|█▊ | 28/151 [00:00<00:01, 68.35it/s]
24%|██▍ | 36/151 [00:00<00:01, 69.97it/s]
29%|██▉ | 44/151 [00:00<00:01, 70.16it/s]
34%|███▍ | 52/151 [00:00<00:01, 69.63it/s]
39%|███▉ | 59/151 [00:00<00:01, 68.87it/s]
44%|████▎ | 66/151 [00:01<00:01, 62.76it/s]
48%|████▊ | 73/151 [00:01<00:01, 57.31it/s]
52%|█████▏ | 79/151 [00:01<00:01, 52.70it/s]
56%|█████▋ | 85/151 [00:01<00:01, 51.31it/s]
60%|██████ | 91/151 [00:01<00:01, 48.64it/s]
65%|██████▍ | 98/151 [00:01<00:00, 53.36it/s]
70%|███████ | 106/151 [00:01<00:00, 58.82it/s]
75%|███████▍ | 113/151 [00:01<00:00, 61.35it/s]
79%|███████▉ | 120/151 [00:02<00:00, 59.73it/s]
84%|████████▍ | 127/151 [00:02<00:00, 57.19it/s]
89%|████████▊ | 134/151 [00:02<00:00, 57.22it/s]
93%|█████████▎| 141/151 [00:02<00:00, 58.59it/s]
97%|█████████▋| 147/151 [00:02<00:00, 58.64it/s]
100%|██████████| 151/151 [00:02<00:00, 59.55it/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 3.678 seconds)