You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 27, 2021. It is now read-only.
FLIP is an approach to animations that remaps animating expensive properties, like width, height, left and top to significantly cheaper changes using transforms. It does this by taking two snapshots, one of the element's First position (F), another of its Last position (L). It then uses a transform to Invert (I) the element's changes, such that the element appears to still be in the First position. Lastly it Plays (P) the animation forward by removing the transformations applied in the Invert step.
Usage
You can use the FLIP helper on its own, like this:
letflip=newFLIP({element: target,duration: 2000});// First position & opacity.flip.first();// Apply the 'end' class and snapshot the last position & opacity.flip.last('end');// Move and fade the element back to the original position.flip.invert();// Play it forwards.flip.play();
Using GSAP.
If you've already got GSAP in place, you may wish for it to handle playback. In which case, you can declare that in the config object:
You can either specify your own function, or, if you're using GSAP, you can use its easing functions:
// Declare an easing function directly.letflip=newFLIP({element: target,easing: function(t){returnt*t;}});// ... or declare an easing function from GSAP.letflip=newFLIP({element: target,easing: Bounce.easeOut});