Jump to content
Search Community

Convert Flash Ease curve to GreenSock Custom Ease

c-andrews test
Moderator Tag

Recommended Posts

HI, I am currently creating a little Flash IDE animation exporter which exports a timeline animation using JSFL. Part of what i am exporting is the custom ease curve that you get in the IDE. Here is an example of what it spits out:

 

[{ x:0.00000, y:0.00000 },{ x:0.33333, y:0.00000 },{ x:0.66667, y:0.33333 },{ x:1.00000, y:1.00000 }]

 

What i am trying to do it convert this curve into a CustomEase. This is what i am currently doing:

 

1. First put all the x values into an array and another for the y. ( points.x and points.y )

while( i < points.length )
{
bezierPoints.x.push( points[i].x );
bezierPoints.y.push( points[i].y );
i ++;
}

 

2. Use BezierPlugin.parseBeziers( points, true )

var parsedBezierPoints:Object = BezierPlugin.parseBeziers( bezierPoints, true );

 

3. Pull out the y values from parsedBezierPoints and put them into an object of s, cp, and e

var yPoints:Array = parsedBezierPoints:Object.y
var data:Array = []
var i:int = 0;
while ( i < $points.length )
{
data[i] = { s:yPoints[i][0], cp:yPoints[i][1], e:yPoints[i][2] };
i++
}

 

example trace:

[{"e":0,"s":0,"cp":-0.08325},{"e":0.333,"s":0,"cp":0},{"e":1,"s":0.333,"cp":0}]

 

4. Create the custom ease using the new data

CustomEase.create( "DIGEase", data );

 

For some reason i keep getting a gitter and not a smooth ease on the animation. Can anyone see if im doing something wrong or point me in a right direction.

 

Thanks in advance.

Link to comment
Share on other sites

Help me understand why you're trying to do this rather than just using the CustomEase interface or something like that? Even a 3rd party tool should work - you can use virtually any ease that conforms to the industry standard (4 parameters).

 

I'm not seeing an obvious error, but I'd need to really dig in and figure out what the Flash interface is exporting and how that relates to the CustomEase and what it's expecting, etc. That isn't something I can tackle right now (wish I could - I'm just slammed with tons of other work to accomplish).

Link to comment
Share on other sites

Hi, sorry, I am exporting timeline animation from Flash to XML and then importing that into my project so that I can build the animations.

 

The problem that I had is that JSFL exports the ease curve as a Cubic Bezier instead of a Quadratic Bezier. By working this out I then solved my problem by using a midPoint approximation technique. Here are a couple of links of resources if any one is interested:

 

http://timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm.

 

More info on extending flash with JSFL can be found here: http://livedocs.adobe.com/flash/9.0/main/flash_cs3_extending.pdf

 

To export a frames ease curve you call frame.getCustomEase() from a JSFL script.

 

Thanks anyway :-)

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