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).

  4%|▍         | 6/151 [00:00<00:02, 58.87it/s]
 10%|▉         | 15/151 [00:00<00:01, 73.20it/s]
 16%|█▌        | 24/151 [00:00<00:01, 77.70it/s]
 21%|██        | 32/151 [00:00<00:01, 78.09it/s]
 27%|██▋       | 41/151 [00:00<00:01, 79.75it/s]
 33%|███▎      | 50/151 [00:00<00:01, 80.14it/s]
 39%|███▉      | 59/151 [00:00<00:01, 80.01it/s]
 44%|████▍     | 67/151 [00:00<00:01, 79.36it/s]
 50%|████▉     | 75/151 [00:00<00:00, 77.95it/s]
 55%|█████▍    | 83/151 [00:01<00:00, 76.29it/s]
 60%|██████    | 91/151 [00:01<00:00, 73.32it/s]
 66%|██████▌   | 99/151 [00:01<00:00, 73.56it/s]
 71%|███████   | 107/151 [00:01<00:00, 73.68it/s]
 76%|███████▌  | 115/151 [00:01<00:00, 73.59it/s]
 81%|████████▏ | 123/151 [00:01<00:00, 70.98it/s]
 87%|████████▋ | 131/151 [00:01<00:00, 69.23it/s]
 91%|█████████▏| 138/151 [00:01<00:00, 68.78it/s]
 97%|█████████▋| 146/151 [00:01<00:00, 70.43it/s]
100%|██████████| 151/151 [00:02<00:00, 74.10it/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.154 seconds)

Gallery generated by Sphinx-Gallery