Hi all,
I was wondering if it was possible to have access from code to the default curve presets you can see when opening the curve editor.
Thank you
Hi all,
I was wondering if it was possible to have access from code to the default curve presets you can see when opening the curve editor.
Thank you
As far as I know, they are not available. But they should be easy to set up.
Something like:
public static AnimationCurve CreateStraightCurve()
{
AnimationCurve curve = new AnimationCurve();
curve.AddKey(new Keyframe(0, 1));
curve.AddKey(new Keyframe(1, 1));
return curve;
}
public static AnimationCurve CreateLinearCurve()
{
float tan45 = Mathf.Tan(Mathf.Deg2Rad * 45);
AnimationCurve curve = new AnimationCurve();
curve.AddKey(new Keyframe(0, 0, tan45, tan45));
curve.AddKey(new Keyframe(1, 1, tan45, tan45));
return curve;
}
public static AnimationCurve CreateEaseInEaseOutCurve()
{
AnimationCurve curve = new AnimationCurve();
curve.AddKey(new Keyframe(0, 0, 0, 0));
curve.AddKey(new Keyframe(1, 1, 0, 0));
return curve;
}