Jump to content
Search Community

Help ~ I use cubic bezier (n,n,n,n ) easing Animation~

kim gyu cheol 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

Do you want to know an algorithm? How does it, and is it transformed?

 

 

Code used in the main file

TweenMax.to(mc_3, 0.5, {x:500,ease:new CubicBezier(.17, .17, .4, 1)});

 

 

I made a file in a folder.

com\greensock\easing

I make file CubicBezier.as

 

 

public static var SineInOut_33: CubicBezier = new CubicBezier(0.33, 0, 0.67, 1);
 

 

------------------------ 

override public function getRatio(p: Number): Number {
 
 
 
var Point_1: Number = this.a.x
var Point_2: Number = this.b.x
var Point_3: Number = this.c.x
var Point_4: Number = this.d.x
 
 
 
var get_value: Number = 6 * (1 - p) * (this.c.x + this.b.y + this.b.x) + 6 * p * (this.c.y + this.c.x + this.b.y);
return get_value;
 
 
}
Link to comment
Share on other sites

Does that work? That equation looks like the second derivative of a Bezier.

https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves

 

For easing, you have to find y given x. So x will be in the range [0.0,1.0], and is the value that you would pass into getRatio.

 

Check out this post for more information.

http://greensock.com/forums/topic/7952-javascript-custom-ease/?p=51357

 

It's written in JavaScript, but it would be very easy to convert to ActionScript. Here's the source code for the easings.

https://gist.github.com/OSUblake/4d9f0caf980f4ee492ef

 

 

  • Like 1
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...