Jump to content
Search Community

Using TimelineLite/Max to play through an array

patdoyle test
Moderator Tag

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

I have an array of samples that i am displaying as a gauge, and i want the timeline to control where i am in the array. What is the best way to do this? Do i need to make each one of these samples a tween or can i leave it as a number? A nudge in the right direction would be extremely helpful... Thank you

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

I'm having a very difficult time visualizing what you want to do.

I don't know what a sample is or how it can be a tween or left as a number. Thus I really don't know how an Array of samples is being displayed as a gauge.

 

It would really help to see a reduced CodePen demo as explained here: http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/, the simpler the better. It is most important to be able to understand what a sample is and what exactly is in your Array.

 

Thanks!

  • Like 1
Link to comment
Share on other sites

Thanks for the CodePen. I still don't understand what you are going for fully.

 

Maybe this will help: http://codepen.io/GreenSock/pen/sFHAm

 

It uses a TimelineLite to build a sequence of function calls that pull out the next number in your Array.

This is the closest I can get to using a timeline to control where you are in an Array.

 

If the samples are an array of tweens then you could do something like the loop code you commented out

//tween, start position
tl.add(samples[i], i);
  • 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.
×
×
  • Create New...