Jump to content
Search Community

I can't stock timeline

kri2sis test
Moderator Tag

Go to solution Solved by Rodrigo,

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 start with that jewel which is GASP and I already love it so much. So thanx guys for your work.

 

Oh, first I'm french and I try to write right english, so excuse me if you find mistakes.

 

OK, so my probleme is that i can't stock my timeline in  a var to play it after (and the .play() don't work...)

 

I'd like ti stock i var to play later...

 

(Windows 7 SP1, Google Chrome (usualy), and for my devices... a PC made by myself... a good PC)

 

thank you in advance for your help

 

 

(is there some explainations or tuto in french ? i understand english but it oblige me to learn less fast)

See the Pen Eqkzc by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

Hi kri2is and welcome to the GreenSock forums.

 

You're quite in the right path when it comes to store a timeline in a variable actually. Perhaps what you're missing is setting the state of the timeline to paused, so it can be played later on your code:

var tn = new TimelineLite({paused:true}),
    photo = $('#module'),
    texte = $('#module .texte'),
    btn1 = $("#btn1");
	
tn.to(photo,4,{left:700,ease:"easeOut"});

btn1.on("click",function(e)
{
  e.preventDefault();
  
  tn.play(0);
});

Like that every time you click on the button the timeline will start over and over.

 

Also in order to get a better grasp of how the timeline classes work, take a look at the following video and code sample:

 

http://greensock.com/sequence-video

 

Also check this getting started guide:

 

http://greensock.com/jump-start-js#timelinelite

 

As for resources in french, pardonne moi, only stuff in english around here, but perhaps if you do a google search using french, you'll find something, or one of our users knows enough french to help you.

 

Rodrigo.

  • Like 3
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...