I have get all TweenMax instance from a page.
So I use :
TweenMax.getAllTweens()
This works if the tweens are declared like this :
TweenMax.to
or TweenMax.formTo
or whatever but if the tweens are nested in a TimelineMax / Lite, TweenMax.getAllTweens()
return an array of objects instead of my desired array of TweenMax tweens . So I can't use TweenMax methods on them.
I tryed to declare TweenMax instances, store them in variables and add them to TimelineMax like this :
var tween = TweenMax.to('selector', {x: 100})
new TimelineMax().add(tween)
This solution is working but the following :
new TimelineMax().to('selector', {x: 100})
Doesn't work.
Do you have an idea of how I could deal with this issue and get all tweens instances ?
Not sure to be understandable, don't hesitate to ask me questions.
My issue can be tested on https://ihatetomatoes.net/demos/simple-scrollmagic-tutorial/ . Open console and type TweenMax.getAllTweens()
getChildren()
on the timeline instance should return you what you want. Find details on link.
https://greensock.com/docs/TimelineMax/getChildren()
Here is also a codepen for your pleasure
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.