Created
March 25, 2016 21:14
-
-
Save TylerK/0519a0c57b2fec8b9f40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Let's say you have a list of 4 icons that need to "pop up" in sequence when their parent element is hovered. | |
* To give the icons a more initial exageration, use loose "initial" damping and a stiffer "final" damping. | |
* If you want to give your staggered animation more oomph at the end, reverse these values. | |
*/ | |
<StaggeredMotion | |
defaultStyles={[ { y: 10 }, { y: 10 }, { y: 10 }, { y: 10 } ]} | |
styles={prevInterpolatedStyles => prevInterpolatedStyles.map((_, i) => { | |
return i === 0 | |
// Initial stiffness and damping | |
? { y: spring(0, { stiffness: 300, damping: 18 }) } | |
// Final stiffness and damping | |
: { y: spring(prevInterpolatedStyles[i - 1].y, { stiffness: 300, damping: 26 }) }; | |
})} | |
> | |
[...] | |
</StaggeredMotion> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment