What would be a shorter and better way to achieve the same animation?
For example would it be possible to use yoyo effect for it?
const myAnimation = gsap.timeline({ repeat: -1 });
myAnimation
.fromTo('.rectangle', {
duration: 3,
scale: 0,
opacity: 0,
rotate: -160
},
{
duration: 3,
scale: 1,
opacity: 1,
rotate: 0
})
.to('.rectangle', {
duration: 3,
scale: 2,
opacity: 1,
rotate: 160
}, '<=1')
.to('.rectangle', {
duration: 3,
scale: 0,
opacity: 0,
rotate: -160
})