React higher order component for Slik animations
About
A library that wraps your React components, providing them with animation values as props when they update.
Installation
Use npm to install react-slik.
npm install react-slik --save --save-exact
I'd recommend pinning to a specific version and using --save-exact
and --save
to add this to your package.json automatically.
Getting started
-
Require react-slik in the file where you'll be animating.
;; -
Create your animations.
const animation = from: 0 to: 1; -
Create a component.
Component{const scale = thisprops;return<div style=transform: `scale(, )`>Hello World!</div>;} -
Animate your component.
const options =bind: 'update' // Default, update on all eventsstartOnMount: true // DefaultstopOnUnmount: true // Default;const AnimatedComponent = ; -
Render your component.
<AnimatedComponent />