Jump to content
Search Community

pechschwarz Gmbh

Business
  • Posts

    1
  • Joined

  • Last visited

About pechschwarz Gmbh

pechschwarz Gmbh's Achievements

  1. Hey there! I have created a timeline within the useGSAP hook (React / Next.js), which I want to play or reverse using a button. Unfortunately, only the "normal" playback works. export default function Home() { const [animation, setAnimation] = useState(false); useGSAP(() => { const timeline = gsap.timeline({ paused: true }); timeline.to(".text", { fontSize: "50px", }); if (animation) { timeline.play(); } else { timeline.reverse(); } }, [animation]); return ( <div> <div className="text">text!</div> <button onClick={() => { setAnimation(!animation); }} > toggle animation </button> </div> ); } Have a look (Codesandbox)!
×
×
  • Create New...