Skip to content
  • Vlad Zahorodnii's avatar
    effects/slide: Use mass-spring-damper model for animation · 00ae7d38
    Vlad Zahorodnii authored
    If you lift fingers but not swipe them enough to switch to another
    virtual desktop, the slide effect will play an animation to move from
    the current position in the virtual desktop grid to the current desktop.
    
    However, that animation doesn't feel right, there's something missing.
    The slide effect uses a TimeLine to animate switching between virtual
    desktops, it's great if the amount of sliding is constant.
    
    This change makes the slide effect use the mass-spring-damper model to
    simulate the motion of a spring in order to animate switching between
    virtual desktops.
    
    The mass-spring-damper equation is integrated using RK4. If the delta
    interval is not multiple of the integration step precisely, the
    SpringMotion will perform integration as many times as the integration
    step fits into the delta. The leftover will be used for LERP between the
    previous and the next integration results.
    
    With the spring animation, the slide animation feels more natural when
    you lift fingers. If you switch between virtual desktops without using a
    gesture, the slide animation should look almost the same as if it were
    implemented with the TimeLine.
    00ae7d38