** Summary ** This release adds swipe-enabled FLIP, a spring utility, and reduces the size of the main library by a bit.
- Stagger delays for nested
Flipped
components are now no longer automatically handled. If you want aFlipped
animation to wait for another (staggered)Flipped
animation to begin, you need to explicitly provide a prop that references theflipId
of theFlipped
component to wait until:delayUntil="flipId"
. Getting rid of auttomatically handled nested staggers reduced the complexity of the code and made the library a bit smaller and a lot more maintainable.
spring
, a function to handle spring tweening of style attributes for you.Swipe
, a component which allows for swipe-driven FLIP.
flip-toolkit
, the base of the library without any React, is now its own package on npm
Summary: A small release with only one breaking change: streamlining animation sequencing by removing the option to provide onDelayedAppear
callbacks to Flipped
components, and adding a new optional callback to the Flipper
component, handleEnterUpdateDelete
, that allows for complete control of animation sequencing.
Animation sequencing is now more flexible with the handleEnterUpdateDelete
function.
Check out this Codesandbox for a comprehensive example.
Instead of optionally using onDelayedAppear
, all entering animations should be specified with the standard onAppear
callback.
Some code that was handling an edge case with FLIP-ped images in the Safari browser has been removed for simplicity's sake. Please be sure to QA FLIP animations that use images in Safari.
Summary: Use a Reboundjs
fork instead of Wobblejs
for better performance. Add a lot more options for staggering.
-
Better performance: Moved from the library
Wobblejs
, that creates a render loop for each spring animation, to a custom fork ofReboundjs
, that creates only a single render loop for all existing animations. Chrome perftools profiling shows significantly less JavaScript time for each frame, resulting in a slightly higher average frame rate. -
Nested Stagger: Before, you could only stagger elements a single level. Now, you can have elements that are staggered for arbitrarily deep levels, enabling animations such as this one.
-
More stagger configuration options:
speed
andreverse
. You can config the stagger in thestaggerConfig
prop on theFlipper
component. -
An improved API for deciding whether a
Flipped
component should actually flip. Now you can pass down some state from theFlipper
component in thedecisionData
prop, which will be passed into theshouldFlip
orshouldInvert
functions on the childrenFlipped
components. -
A new spring preset,
veryGentle
, that has just the tiniest bit of bounce.
- As a corollary to #3 in the Added section, removed the old way of telling a
Flipped
element whether or not to animate (componentId
andcomponentIdFilter
).
The size of the library increased by about 1kb (gzipped) to 8kb gzipped. Most of the additional code was handling improved stagger configurability although the switch to rebound added a tiny bit as well. I'll be attempting to reduce the size of the library in an upcoming pr.
Summary: Went all-in on springs and removed option to hard-code easing curves.
- There are 4 new spring presets:
noWobble
(default),gentle
,wobbly
, orstiff
, inspired by react-motion, that you can use for different effects by providing the relevant string to thespring
prop. You can also specify spring parameters (stiffness and damping) in an object as before. - There's a new
stagger
prop for theFlipped
component that provides a more natural effect than hard-coded delays. You can have multiple staggered "sets" in a singleFlipper
component by providing a key to thestagger
prop. - The
debug
prop outlines allFlipped
components with a pink outline for better understanding ofFlipped
element dimensions. Read more here. - This was technically added a bit before, but you can use
Flipper
component with portals by providing aportalKey
to theFlipper
component.
- The
delay
prop has been replaced with thestagger
prop as mentioned above. (If you have a use case fordelay
that is not covered bystagger
please let me know). - All timing functions are now using springs. That means that the
easing
andduration
props have been removed.
- Better handling of animations dealing with images that haven't loaded yet. Before, if the image hadn't loaded, react-flip-toolkit would think it had
width: 0, height: 0
, resulting in a warped animation. Now, react-flip-toolkit waits for the image to load for a brief period of time, and then retries the animation. - The new stagger prop fixes frame-rate issues caused by the previous
delay
prop's use ofsetTimeout
. - Went from ~9kb minified and gzipped to ~7kb.