Jump to content
GreenSock

jiggy1965

Tween to frame in Adobe Animate

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

Is it possible to tween to a specific frame of my Adobe Animate Timeline? Let's say I've got an Animate file with 100 frames with a keyframe animation moving a ball from left to right. And instead of running that I wish to control that with GSAP. Tweening to keyframe 50 for example. Something like this, which doesn't work:

 

this.stop();
tl = new TimelineMax();
tl.to(this.root, 2, {frame:50})

Using something like this should make the tween move from keyframe 0 to 50 but it does nothing. Is such a thing possible?

Link to comment
Share on other sites

Yes, but I'm talking about keyframes in an Adobe Animate file :-) . I've included the GSAP library in my Adobe Animate file and in Animate I've got 100 keyframes.

 

Now I wish to use tween.to to make it go to specific keyframes of my Adobe Animate file. Kinda like this.gotoAndStop(50) in Adobe Animate. But I'm not sure whether I can target Adobe Animate keyframes through GSAP.

Link to comment
Share on other sites

Ah, figured it out myself :-) I used a tween to update a variable and used that for my Animate gotoAndStop:

 

this.stop();
var root=this;
tl = new TimelineMax();
var keyframe = {frame: 0};
tl.to(keyframe, 1, {frame: 50, ease:Elastic.easeOut, onUpdate:updateHandler});

function updateHandler() {
 root.gotoAndStop(keyframe.frame);
}

It first creates the keyframe variable. Then it tweens that and on every update it executes a function which reads that update keyframe variable and uses it to execute Animate's gotoAndStop. Attached the sample files if you're interested. Both the Animate file and the published html file.

tester.fla tester.html

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