Do TweenMax instances need to be cleared/unset/killed manually or is it done automatically? Here's the following code I'm using to add effect to a piece of text on screen:
TweenMax.to($('#score'), 0.25, { fontSize: '56px', onComplete: myFunction });
function myFunction(){
TweenMax.to($('#score'), 0.125, { fontSize: '28px' });
}
This piece of code runs a lot and I'm afraid over time some garbage would pile up.
You could try and use the kill() method:
Also you can store your reference to the tween in a variable:
var myTween = TweenMax.to($('#score'), 0.25, { fontSize: '56px', onComplete: myFunction });
function myFunction(){
myTween.kill();
myTween = TweenMax.to($('#score'), 0.125, { fontSize: '28px' });
}
For more info checkout the GreenSock TweenMax Docs .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.