Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
trsh

How to play a part of TimelineLite?

Go to solution Solved by OSUblake,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

 

I want to play a Portion of my timeline - by seconds, progress or frames (whatever). For example:

 

1) Timeline is 10 secs

2) I want to play from 5 sec to 7 sec.

3) Add pause I think will not serve very well, as those portions change dynamically :/

 

Can't figure out from documentation, how to do this. 

Link to comment
Share on other sites

 

Sadly, but I want to use TimelineLite, because min library size is critical in this project :(

Link to comment
Share on other sites

  • Solution

You can tween the progress, time, etc of a timeline with a regular tween.

TweenLite.fromTo(myTimeline, 2, { time: 5}, { time: 7, ease: Linear.easeNone });
  • Like 2
Link to comment
Share on other sites

And if you're worried about file size, use a CDN. It stays cached in a users browser for up to a year.

  • Like 1
Link to comment
Share on other sites

And if you're worried about file size, use a CDN. It's gets cached in a users browser for up to a year.

 

True, but first time loads are also important ;)

Link to comment
Share on other sites

True, but CDNs are faster, and there's a good chance that GSAP is already cached. Last time I checked, GSAP was in the top 20 most used libraries, so it's not obscure. I would worry about optimizing assets like images, fonts, and css, over libraries that can served over a CDN, but to each their own.

  • Like 1
Link to comment
Share on other sites

I'd echo Blake's sentiments. And really, the difference between TimelineLite and TimelineMax is very minor, especially in the context of all the other assets you're loading. It might make your page load 20ms faster for the typical user (totally guessing) which is imperceptible. Also keep in mind that you may have to write more custom code to achieve the effects you want, like instead of .tweenFromTo(), you have to write a whole tween (or more), so it may end up costing you just as much in terms of kb (or more) to go with TimelineLite instead of TimelineMax. But it's totally up to you, of course. I just see a lot of people myopically focus on file size instead of actual performance. Please read http://greensock.com/kilobyte-conundrum/ 

 

Again, I don't mean to criticize or be argumentative at all. 

 

Happy tweening!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×