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).
4%|▍ | 6/151 [00:00<00:02, 53.31it/s]
9%|▊ | 13/151 [00:00<00:02, 62.45it/s]
14%|█▍ | 21/151 [00:00<00:01, 66.28it/s]
19%|█▉ | 29/151 [00:00<00:01, 69.07it/s]
24%|██▍ | 36/151 [00:00<00:01, 69.38it/s]
28%|██▊ | 43/151 [00:00<00:01, 69.15it/s]
34%|███▍ | 51/151 [00:00<00:01, 69.06it/s]
39%|███▉ | 59/151 [00:00<00:01, 69.41it/s]
44%|████▎ | 66/151 [00:00<00:01, 68.44it/s]
48%|████▊ | 73/151 [00:01<00:01, 67.07it/s]
53%|█████▎ | 80/151 [00:01<00:01, 65.09it/s]
58%|█████▊ | 87/151 [00:01<00:00, 64.50it/s]
62%|██████▏ | 94/151 [00:01<00:00, 63.72it/s]
67%|██████▋ | 101/151 [00:01<00:00, 64.08it/s]
72%|███████▏ | 108/151 [00:01<00:00, 64.81it/s]
76%|███████▌ | 115/151 [00:01<00:00, 65.29it/s]
81%|████████ | 122/151 [00:01<00:00, 64.28it/s]
85%|████████▌ | 129/151 [00:01<00:00, 63.16it/s]
90%|█████████ | 136/151 [00:02<00:00, 60.49it/s]
95%|█████████▍| 143/151 [00:02<00:00, 61.70it/s]
99%|█████████▉| 150/151 [00:02<00:00, 62.42it/s]
100%|██████████| 151/151 [00:02<00:00, 64.89it/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.695 seconds)