napari-animation icon indicating copy to clipboard operation
napari-animation copied to clipboard

changing easing after keyframe creation has no effect

Open maweigert opened this issue 1 year ago • 1 comments

Description

I noticed changes to the easing function of a keyframe (e.g from linear to exponential) after creation in the napari plugin has no effect when saving as a movie (i.e. the easing function at capture times is still in effect).

Steps to reproduce:

  • Add two keyframes a different position with easing "linear"
  • change both easing function to "exponential"
  • save movie (which then still uses linear)

Possible reasons

self.animation._frames._rebuild_keyframe_index() is not called when the ease combo box is changed

Possible fix

Adding it to the update function in https://github.com/napari/napari-animation/blob/ba8ab537abd181ee5a8af0e821d3b889c46529b0/napari_animation/_qt/frame_widget.py#L63 solves the issue. But this might not be the best place...

    def _update_animation_ease(self, event):
        """update state of 'ease' at current key-frame to reflect GUI state"""
        active_keyframe = self.animation.key_frames.selection.active
        active_keyframe.ease = self.get_easing_func()
        self.animation._frames._rebuild_keyframe_index()

maweigert avatar Aug 23 '24 22:08 maweigert

Thanks for the issue @maweigert I will try to take a look at this more closely tomorrow. ❤️

psobolewskiPhD avatar Aug 28 '24 02:08 psobolewskiPhD