port from perforce
This commit is contained in:
40
aiwaz/Aiwaz.Common/Animations/ValueAnimation.cs
Normal file
40
aiwaz/Aiwaz.Common/Animations/ValueAnimation.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Aiwaz.Common.Animations
|
||||
{
|
||||
abstract public class ValueAnimation : Animation
|
||||
{
|
||||
public float StartValue { get; set; }
|
||||
public float EndValue { get; set; }
|
||||
|
||||
public Func<float> ValueGetter;
|
||||
public Action<float> ValueSetter;
|
||||
public Func<string> ValueNamer;
|
||||
|
||||
public float Value
|
||||
{
|
||||
get { return ValueGetter(); }
|
||||
set { ValueSetter(value); }
|
||||
}
|
||||
|
||||
public ValueAnimation()
|
||||
: base()
|
||||
{
|
||||
AnimationName = "Erroneous (Value)";
|
||||
}
|
||||
|
||||
public override void Animate(double time, uint userData)
|
||||
{
|
||||
if (time < StartTime || time > EndTime)
|
||||
return;
|
||||
|
||||
double Time = (time - StartTime) / (EndTime - StartTime);
|
||||
Value = Calculate(Time);
|
||||
}
|
||||
|
||||
protected abstract float Calculate(double NormalizedTime);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user