Jump to content
Search Community

Starting TweenMax from an onClick event instead of 'autoplay'

tomekpilot test
Moderator Tag

Go to solution Solved by Diaco,

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

Greetings!

I have my first TweenMax doing everything i need, (including interaction with externals controls/buttons) but I'm drawing a blank as how to prevent it from 'autoplay'

 

 

My relevant 1liner:

var tl =  TweenMax.to(point, currentSpeed, {css: { left: "95%"}, repeat:repeat, yoyo:true, repeatDelay:0, ease:Linear.easeNone});

... so for example my 'pause' button works fine:

$('#pause').click( function(){tl.pause();});

... how do I make it start only when I press my $('#start') button? 

I figure I missed something simple, hence my apologies and thanks in advance.

 

Link to comment
Share on other sites

To add to Diaco.AW's great advice.. here is how to start with timeline paused using TimelineMax / TimelineLite:

var Anim = new TimelineMax({paused:true});

Anim.to("#foo", 1, {left: "95%"});

$("#play").click(function(){ Anim.play() }) ;

:

Hope this helps! :)

  • Like 4
Link to comment
Share on other sites

  • 4 months later...
  • 3 weeks later...

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...