26 lines
592 B
C#
26 lines
592 B
C#
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|