barrowman

Any idea why my GS button in Animate wont work?

Recommended Posts

replayBtn.onclick = function() {
  til.invalidate().restart();
}
//-----------------------
til = new TimelineMax({repeat:3, yoyo:true});
//-----------------------
til.add("one", 0.1)
.add("two", 2.5)
.to(root.Image01, 10, {scaleX:1.10, scaleY:1.10, ease:Sine.easeInOut, overwrite: false}, "one")
.to(root.Image02, 10, {scaleX:1.10, scaleY:1.10, ease:Sine.easeInOut, overwrite: false}, "one")
.from(root.Byline, 1, {alpha:0, ease:Sine.easeInOut, overwrite: false}, "two")
.from(root.CTA, 1, {alpha:0, ease:Sine.easeInOut, overwrite: false}, "two+=0.5")

 

When I click on the button nothing happens. I know i'm missing something obvious, but I've realised I've never actually added a non-Exit button in Animate before and I'm not sure what I'm missing from this...

Share this post


Link to post
Share on other sites

Hmm, I wonder if maybe your targets aren't defined properly or maybe you're not loading GSAP? Tough to tell without seeing a demo. Any chance you could provide a simple codepen? 

Share this post


Link to post
Share on other sites

Try this instead, adding the keyword this to replayBtn (this is if this code is in a FRAME script wherein the replayBtn is accessible within that frame number) >
 

this.replayBtn.on("click", function() {
        til.invalidate().restart();
    });

 
or if you're using the default HTML it exports, you should end up with a reference called exportRoot, which you can use if you can't figure out scope (just replace this with exportRoot and it should work).

How scope works in Animate CC -->

var til = "blah";   // Frame-level Scope

this.til = "blah"; // Movieclip-level Scope

til = "blah";         // Global Scope

  • Like 2

Share this post


Link to post
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.