gsap react

Solutions on MaxInterview for gsap react by the best coders in the world

showing results for - "gsap react"
Claudio
10 Jan 2018
1const el = useRef();
2const q = gsap.utils.selector(el);
3
4useEffect(() => {
5   // Target ALL descendants with the class of .box
6  gsap.to(q(".box"), { x: 100 });
7}, []);
Micaela
14 Oct 2018
1function App() {
2  // store a reference to the box div
3  const boxRef = useRef();
4
5  // wait until DOM has been rendered
6  useEffect(() => {
7    gsap.to(boxRef.current, { rotation: "+=360" });
8  });
9  
10  // DOM to render
11  return <div className="box" ref={boxRef}>Hello</div>;
12}