Hello, thanks for quick response.
Is this:
dataController.animationSequencer.kill()
dataController.animationSequencer = gsap.timeline({ paused: true })
not the same as this? Does it not assign new instance of timeline to animationSequencer and destroys old one?
dataController.animationSequencer.kill()
dataController.animationSequencer = null
dataController.animationSequencer = gsap.timeline({ paused: true })
I tried with this first, but still got memory leaks:
dataController.clear()
My timeline works properly in both cases (animation runs as predicted), but Transform objects are still piled on in memory, that's why I tried using invalidate too. There is no other place where I'm referencing animated stripes, so only suspect left is gsap.
This is the way I'm adding animations to animationSequencer:
public queueReelAnimation(aditionalStripes: number, animationDelay: number, someOtherArgs){
const reelTimeline = gsap.timeline()
for (let i = 0; i < aditionalStripes; i++) this.insertStripe()
reelTimeline.to(...) //1st part of animation
.to(...) //2nd part of animation
.to(...) //3rd part of animation
this.stripes = this.stripes.slice(1, 4)
dataController.animationSequencer.add(reelTimeline, `<${animationDelay}`)
}
On the side note, I would prefer to use kill instead of clear because I'm adding events to be triggered at certain point in animation. In docs I didn't find that clear removes those events from timeline and I want to be certain that they are gone. I'm adding events using .call(function, args, time).