Hi guys,
I have a gsap timeline which animates an svg circle. (Scale and color).
What I'm trying to achieve is to pass a dynamic color when clicking different buttons, for example:
buttonA.addEventListener('click', (e)=>{runAnimation(DYNAMIC_VALUE)});
and then use that value here:
tl.to(circles, {
stagger:{ each: 0.05},
ease: "none",
fill: `#${DYNAMIC_VALUE}`
})
It seems that the dynamic value is always using the initial value but can't be changed later.
Any idea on how to bypass this issue?
Edit: seems that using a function + tl.invalidate() works, however, spam clicking the button seems to break the animation. Any ideas?
Thank you in advance!