Jump to content
Search Community

Any idea why my GS button in Animate wont work?

barrowman 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

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

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