<div class="box gradient-green"></div>
<button>Restart</button>
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
flex-direction: column;
gap: 1rem;
}
// fromTo approach
document.querySelector("button").addEventListener("click", () => gsap.fromTo(".box", {opacity: 0}, {opacity: 1}));
// Control method approach
// const anim = gsap.from(".box", {opacity: 0});
// document.querySelector("button").addEventListener("click", () => anim.restart());