# "Evaluating" an animation curve

0 favourites
• 3 posts
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
• Hello there!

Since we can define eases/animation curves I was wondering if it is possible to "evaluate" a number off that animation curve.

So I would want to have a function where I would give the code a number on the scale of 0-1 (the x-axis of the curve) and would end up getting the y-position of the curve at that x position.

I know that this is possible in unity and for reference I am linking their documentation for evaluating a curve here: docs.unity3d.com/ScriptReference/AnimationCurve.Evaluate.html

Is this maybe possible using some JS code if it is not possible to do it with event sheets?

• Generally speaking you can use the lerp, qarp, or cubic expressions (or some combination) with your ease formula to get the value at any point within an ease. Easing formulas can be found online easings.net

Note that you'll want one for each the x and y axes.

For example, for a quadratic ease in/out

lerp(startpositiony,endpositiony,x<0.5?2*x^2:1-((-2*x+2)^2/2))

Would give you the y value between start and end positions when inputting an x value between 0-1.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Generally speaking you can use the lerp, qarp, or cubic expressions (or some combination) with your ease formula to get the value at any point within an ease. Easing formulas can be found online easings.net

Note that you'll want one for each the x and y axes.

For example, for a quadratic ease in/out

lerp(startpositiony,endpositiony,x<0.5?2*x^2:1-((-2*x+2)^2/2))

Would give you the y value between start and end positions when inputting an x value between 0-1.

Hi! Yeah I know that I can use easaing functions and they are functional (hehe) but I find it a lot easier to tweak things if I can make my own curves so I was wondering if it is possible to do it with animation curves that we create.

• 3 posts