Does anyone know how I would convert this to the new GSAP v3 syntax using gsap.utils.wrap?
This code animates concentric circles.
let durationStart = 400;
let durationIncrement = 200;
let to = {
repeat: -1,
cycle: {
rotation: index => index % 2 ? -360 : 360,
duration: index => durationStart + (index * durationIncrement),
},
};
timeline.staggerTo(this.rings, 2, to, position);
I'm guessing it would be something like this, does this look correct?
let duration = [];
let durationIncrement = 200;
let durationStart = 400;
let rotation = [];
for (let i = 0; i < this.rings.length; i++) {
rotation.push(i % 2 ? -360 : 360);
duration.push(durationStart + (i * durationIncrement));
}
let to = {
duration: gsap.utils.wrap(duration),
repeat: -1,
rotation: gsap.utils.wrap(rotation),
stagger: 2,
};
timeline.to(this.rings, to, position);