41 lines
997 B
C#
41 lines
997 B
C#
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);
|
|
}
|
|
}
|