You think it's a flippin' game?
Animate a list of elements using FLIP trick.
TODO publish to npm
same API as the brilliant react-motion-flip
<div>
<Flippity>
() =>
items.map( item => <MyItemComponent key={item.key} {...x} />
</Flippity>
</div>
For every change in the items
list, Flippity will make a nice transition to the new layout.
The previous code will produce this markup:
<div>
<div> <!-- the flippity container -->
<div> <MyItemComponent /> </div> <!-- one wrapper around each item -->
<div> <MyItemComponent /> </div>
<div> <MyItemComponent /> </div>
</div>
</div>
You might want to custom the style of the container or the item wrapper.
This can be achieved by passing style
, childStyle
and className
, childClassName
.
The physic spring can be customized with the props stiffness
, damping
and precision
.
-
FLIP animation technique by @paullewis, which allows to easily make transitions between two states, relying on the browser computation layout.
-
react-motion by @chenglou, from which I borrowed the spring physic based animation.
-
react-motion-flip by @bloodyowl, which use clever tricks.
-
The IT Crowd for getting stuck in my head the whole time.
- [v] publish to npm
- [v] animate width and height
- compute acceleration based on actual time ( not number of frame )
- test 🐠
- animate with webAnimation API