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, 610) 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, 43.48it/s]
8%|▊ | 12/151 [00:00<00:02, 53.33it/s]
13%|█▎ | 19/151 [00:00<00:02, 56.79it/s]
17%|█▋ | 26/151 [00:00<00:02, 58.42it/s]
22%|██▏ | 33/151 [00:00<00:01, 59.59it/s]
26%|██▋ | 40/151 [00:00<00:01, 60.32it/s]
31%|███ | 47/151 [00:00<00:01, 59.25it/s]
35%|███▌ | 53/151 [00:00<00:01, 58.52it/s]
39%|███▉ | 59/151 [00:01<00:01, 57.83it/s]
43%|████▎ | 65/151 [00:01<00:01, 57.74it/s]
47%|████▋ | 71/151 [00:01<00:01, 56.92it/s]
51%|█████ | 77/151 [00:01<00:01, 56.17it/s]
55%|█████▍ | 83/151 [00:01<00:01, 55.33it/s]
59%|█████▉ | 89/151 [00:01<00:01, 54.03it/s]
63%|██████▎ | 95/151 [00:01<00:01, 55.02it/s]
67%|██████▋ | 101/151 [00:01<00:00, 55.65it/s]
71%|███████ | 107/151 [00:01<00:00, 56.33it/s]
75%|███████▍ | 113/151 [00:01<00:00, 56.81it/s]
79%|███████▉ | 119/151 [00:02<00:00, 55.84it/s]
83%|████████▎ | 125/151 [00:02<00:00, 55.00it/s]
87%|████████▋ | 131/151 [00:02<00:00, 54.99it/s]
91%|█████████ | 137/151 [00:02<00:00, 51.84it/s]
95%|█████████▍| 143/151 [00:02<00:00, 53.17it/s]
99%|█████████▊| 149/151 [00:02<00:00, 53.30it/s]
100%|██████████| 151/151 [00:02<00:00, 55.66it/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.966 seconds)