Skip to main content
Participant
March 1, 2022
Question

JSFL: Is it possible to get the ease used for a tween?

  • March 1, 2022
  • 3 replies
  • 671 views

I am attempting to make a mini animation engine using a texture atlas exported from Animate, then using GSAP to perform the animations in my game. However, I find the frame by frame JSON that is exported from Animate to be too large and unwieldy. Since GSAP uses a lot of the same ease interpolations as Animate, I was hoping to be able to read these eases from the frame data. I have yet to figure out a way to do this.

It is easy to set the ease of a tween using something like:

 

an.getDocumentDOM().getTimeline().setFrameProperty("easeType", 5, 4, 0);

 

In order to read an ease, I've attempted to use:

 

var easeType = an.getDocumentDOM().getTimeline().getFrameProperty("easeType", 0, 9);
fl.trace(easeType);

 

Where '0' and '9' are the first and last frame of my tween. This only returns a very unhelpful string of "easeType". Using "frame.getCustomEase()" also doesn't appear to be what I need.

Is there some way of accessing this information?

This topic has been closed for replies.

3 replies

Participant
March 10, 2022

Not sure I'm even being remotely helpful but the Motion Tween engine allows you to double click the span, create a custom ease and then save it as a preset. There's got to be an XFL file locally that stores all this that could be opened and scavenged...

Clif_MAuthor
Participant
March 10, 2022

I do appreciate you looking into it and trying to think of alternative solutions. While that is interesting, I also did some tests comparing the eases that Animate uses to the ease functions at easings.net and found that they (the couple that I tested at least) appear to use the exact same functions, or produce the exact same results at least. So I already went ahead and implemented those into my engine. 

Unless I'm misunderstanding why I would want to do this?

Clif_MAuthor
Participant
March 10, 2022

So I haven't found a way to do this through JSFL, but I did find that you can save your Animate file as a .xfl file, then use this file to scrape the eases from. I'll probably just end up making my own texture atlas straight from this file eventually. 

Legend
March 1, 2022

The JSFL documentation hasn't been updated in almost a decade, so it has nothing about ease formulas, which were only added about five years ago. It's possible the API doesn't even expose this information. JSFL seems to be a very low priority for the Animate team these days.