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 (778, 577) to (784, 592) 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, 54.13it/s]
  9%|▉         | 14/151 [00:00<00:02, 68.25it/s]
 15%|█▌        | 23/151 [00:00<00:01, 74.44it/s]
 21%|██        | 32/151 [00:00<00:01, 77.10it/s]
 27%|██▋       | 41/151 [00:00<00:01, 79.00it/s]
 32%|███▏      | 49/151 [00:00<00:01, 78.04it/s]
 38%|███▊      | 58/151 [00:00<00:01, 78.46it/s]
 44%|████▎     | 66/151 [00:00<00:01, 75.97it/s]
 49%|████▉     | 74/151 [00:00<00:01, 71.92it/s]
 54%|█████▍    | 82/151 [00:01<00:01, 68.88it/s]
 59%|█████▉    | 89/151 [00:01<00:00, 66.81it/s]
 64%|██████▎   | 96/151 [00:01<00:00, 67.66it/s]
 69%|██████▉   | 104/151 [00:01<00:00, 70.34it/s]
 74%|███████▍  | 112/151 [00:01<00:00, 72.23it/s]
 79%|███████▉  | 120/151 [00:01<00:00, 73.06it/s]
 85%|████████▍ | 128/151 [00:01<00:00, 68.90it/s]
 89%|████████▉ | 135/151 [00:01<00:00, 67.80it/s]
 95%|█████████▍| 143/151 [00:02<00:00, 69.45it/s]
100%|██████████| 151/151 [00:02<00:00, 71.83it/s]
100%|██████████| 151/151 [00:02<00:00, 71.71it/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.372 seconds)

Gallery generated by Sphinx-Gallery