0.2.2 • Published 6 years ago
resap v0.2.2
Resap
React hooks for easy GSAP animations, cause why not?
npm install resap- useToggle (toggles GSAP animation from base css styling to stated animation based on state changes)
//import useToggle from resap library
import { useToggle } from 'resap'
// create your state!
const [open, set] = React.useState(true);
// create a handler to change your state
const handleClick = () => {
set(!open);
};
// set your gsap animation props! (use useRef or useMemo so the object doesn't get recreated on each render!)
const { current: animProps } = React.useRef({
opacity: 0,
y: 30,
duration: 0.2,
ease: 'power3.out',
});
// call the useToggle hook which returns a ref, passing in your state and the animation props!
const ref = useToggle(open, animProps);
// pass your ref to the object you wish to animate! when your state changes the toggle animation will trigger!
return (
<div ref={ref} onClick={handleClick} />
)(More hooks to be included!)
0.2.1
6 years ago
0.2.0
6 years ago
0.1.16
6 years ago
0.1.17
6 years ago
0.1.18
6 years ago
0.1.19
6 years ago
0.2.2
6 years ago
0.1.12
6 years ago
0.1.13
6 years ago
0.1.14
6 years ago
0.1.15
6 years ago
0.1.11
6 years ago
0.1.10
6 years ago
0.1.9
6 years ago
0.1.8
6 years ago
0.1.2
6 years ago
0.1.7
6 years ago
0.1.4
6 years ago
0.1.3
6 years ago
0.1.6
6 years ago
0.1.5
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago