rj-action-library/Runtime/Animation/Smoothing/ExpSmoothing.cs

26 lines
592 B
C#
Raw Normal View History

2025-01-13 18:11:12 +00:00
using System.Collections;
using System.Collections.Generic;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class ExpSmoothing: Smoothing
{
[Export( PropertyHint.Range, "0,200")]
public float coefficient = 1;
protected override float _ComputeInterpolationAmount( float delta )
{
return 1f - Mathf.Exp( -coefficient * delta );
}
public static float GetDurationForCoefficient( float coefficient )
{
var exp = new ExpSmoothing();
exp.coefficient = coefficient;
return exp.ComputeDuration();
}
}
}