/// <summary>
/// The AnimatorMotionMapper interface
/// </summary>
- public interface AnimatorMotionMapper
+ public interface IAnimatorMotionMapper
{
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- double Caculate(double position);
+ double Calculate(double position);
}
/// <summary>
/// The LinearMotionMapper class
/// </summary>
- public class LinearMotionMapper : AnimatorMotionMapper
+ public class LinearMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Linear, 0, 0);
}
/// <summary>
/// The AccelerateMotionMapper class
/// </summary>
- public class AccelerateMotionMapper : AnimatorMotionMapper
+ public class AccelerateMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Accelerate, 0, 0);
}
/// <summary>
/// The DecelerateMotionMapper class
/// </summary>
- public class DecelerateMotionMapper : AnimatorMotionMapper
+ public class DecelerateMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Decelerate, 0, 0);
}
/// <summary>
/// The SinusoidalMotionMapper class
/// </summary>
- public class SinusoidalMotionMapper : AnimatorMotionMapper
+ public class SinusoidalMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Sinusoidal, 0, 0);
}
/// <summary>
/// The AccelerateFactorMotionMapper class
/// </summary>
- public class AccelerateFactorMotionMapper : AnimatorMotionMapper
+ public class AccelerateFactorMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The power factor of AccelerateFactorMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.AccelerateFactor, PowerFactor, 0);
}
/// <summary>
/// The DecelerateFactorMotionMapper class
/// </summary>
- public class DecelerateFactorMotionMapper : AnimatorMotionMapper
+ public class DecelerateFactorMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The power factor of DecelerateFactorMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DecelerateFactor, PowerFactor, 0);
}
/// <summary>
/// The SinusoidalFactorMotionMapper class
/// </summary>
- public class SinusoidalFactorMotionMapper : AnimatorMotionMapper
+ public class SinusoidalFactorMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The power factor of SinusoidalFactorMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.SinusoidalFactor, PowerFactor, 0);
}
/// <summary>
/// The DivisorInterpolatedMotionMapper class
/// </summary>
- public class DivisorInterpolatedMotionMapper : AnimatorMotionMapper
+ public class DivisorInterpolatedMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The Divisor of DivisorInterpolatedMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DivisorInterp, Divisor, Power);
}
/// <summary>
/// The BounceMotionMapper class
/// </summary>
- public class BounceMotionMapper : AnimatorMotionMapper
+ public class BounceMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The bounces of BounceMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Bounces);
}
/// <summary>
/// The SpringMotionMapper class
/// </summary>
- public class SpringMotionMapper : AnimatorMotionMapper
+ public class SpringMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The wobbles of SpringMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Wobbles);
}
/// <summary>
/// The CubicBezierMotionMapper class
/// </summary>
- public class CubicBezierMotionMapper : AnimatorMotionMapper
+ public class CubicBezierMotionMapper : IAnimatorMotionMapper
{
/// <summary>
/// The X1 of CubicBezierMotionMapper
/// <summary>
/// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
/// </summary>
- public double Caculate(double position)
+ public double Calculate(double position)
{
double[] values = { X1, Y1, X2, Y2 };
return Interop.Ecore.ecore_animator_pos_map_n(position, Interop.Ecore.PositionMap.Bounce, values.Length, values);
int X1, Y1, X2, Y2;
- Tuple<string, AnimatorMotionMapper>[] mappers =
+ Tuple<string, IAnimatorMotionMapper>[] mappers =
{
- new Tuple<string, AnimatorMotionMapper>("Linear", new LinearMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Accelerate", new AccelerateMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Decelerate", new DecelerateMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Sinusoida", new SinusoidalMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Bounce", new BounceMotionMapper{ Bounces = 3, DecayFactor = 1.8 }),
- new Tuple<string, AnimatorMotionMapper>("Spring", new SpringMotionMapper{ Wobbles = 3, DecayFactor = 1.8 }),
- new Tuple<string, AnimatorMotionMapper>("AccelerateFactor", new AccelerateFactorMotionMapper{ PowerFactor = 1.5 }),
- new Tuple<string, AnimatorMotionMapper>("DecelerateFactor", new DecelerateFactorMotionMapper{ PowerFactor = 1.5 }),
- new Tuple<string, AnimatorMotionMapper>("SinusoidaFactor", new SinusoidalFactorMotionMapper{ PowerFactor = 1.5 }),
- new Tuple<string, AnimatorMotionMapper>("DivisorInterpolate", new DivisorInterpolatedMotionMapper{ Divisor = 1.0, Power = 2.0 }),
- new Tuple<string, AnimatorMotionMapper>("CubicBezier", new CubicBezierMotionMapper{ X1 = 0, X2 = 1, Y1 = 0, Y2 = 1})
+ new Tuple<string, IAnimatorMotionMapper>("Linear", new LinearMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Accelerate", new AccelerateMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Decelerate", new DecelerateMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Sinusoida", new SinusoidalMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Bounce", new BounceMotionMapper{ Bounces = 3, DecayFactor = 1.8 }),
+ new Tuple<string, IAnimatorMotionMapper>("Spring", new SpringMotionMapper{ Wobbles = 3, DecayFactor = 1.8 }),
+ new Tuple<string, IAnimatorMotionMapper>("AccelerateFactor", new AccelerateFactorMotionMapper{ PowerFactor = 1.5 }),
+ new Tuple<string, IAnimatorMotionMapper>("DecelerateFactor", new DecelerateFactorMotionMapper{ PowerFactor = 1.5 }),
+ new Tuple<string, IAnimatorMotionMapper>("SinusoidaFactor", new SinusoidalFactorMotionMapper{ PowerFactor = 1.5 }),
+ new Tuple<string, IAnimatorMotionMapper>("DivisorInterpolate", new DivisorInterpolatedMotionMapper{ Divisor = 1.0, Power = 2.0 }),
+ new Tuple<string, IAnimatorMotionMapper>("CubicBezier", new CubicBezierMotionMapper{ X1 = 0, X2 = 1, Y1 = 0, Y2 = 1})
};
int map_index = 0;
void OnTimeline()
{
- double o = mappers[map_index].Item2.Caculate(timelineAnimator.Position);
+ double o = mappers[map_index].Item2.Calculate(timelineAnimator.Position);
int x = (int)((X2 * o) + (X1 * (1.0 - o)));
int y = (int)((Y2 * o) + (Y1 * (1.0 - o)));
int X1, Y1, X2, Y2;
- Tuple<string, AnimatorMotionMapper>[] mappers =
+ Tuple<string, IAnimatorMotionMapper>[] mappers =
{
- new Tuple<string, AnimatorMotionMapper>("Linear", new LinearMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Accelerate", new AccelerateMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Decelerate", new DecelerateMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Sinusoida", new SinusoidalMotionMapper()),
- new Tuple<string, AnimatorMotionMapper>("Bounce", new BounceMotionMapper{ Bounces = 3, DecayFactor = 1.8 }),
- new Tuple<string, AnimatorMotionMapper>("Spring", new SpringMotionMapper{ Wobbles = 3, DecayFactor = 1.8 }),
- new Tuple<string, AnimatorMotionMapper>("AccelerateFactor", new AccelerateFactorMotionMapper{ PowerFactor = 1.5 }),
- new Tuple<string, AnimatorMotionMapper>("DecelerateFactor", new DecelerateFactorMotionMapper{ PowerFactor = 1.5 }),
- new Tuple<string, AnimatorMotionMapper>("SinusoidaFactor", new SinusoidalFactorMotionMapper{ PowerFactor = 1.5 }),
- new Tuple<string, AnimatorMotionMapper>("DivisorInterpolate", new DivisorInterpolatedMotionMapper{ Divisor = 1.0, Power = 2.0 }),
- new Tuple<string, AnimatorMotionMapper>("CubicBezier", new CubicBezierMotionMapper{ X1 = 0, X2 = 1, Y1 = 0, Y2 = 1})
+ new Tuple<string, IAnimatorMotionMapper>("Linear", new LinearMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Accelerate", new AccelerateMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Decelerate", new DecelerateMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Sinusoida", new SinusoidalMotionMapper()),
+ new Tuple<string, IAnimatorMotionMapper>("Bounce", new BounceMotionMapper{ Bounces = 3, DecayFactor = 1.8 }),
+ new Tuple<string, IAnimatorMotionMapper>("Spring", new SpringMotionMapper{ Wobbles = 3, DecayFactor = 1.8 }),
+ new Tuple<string, IAnimatorMotionMapper>("AccelerateFactor", new AccelerateFactorMotionMapper{ PowerFactor = 1.5 }),
+ new Tuple<string, IAnimatorMotionMapper>("DecelerateFactor", new DecelerateFactorMotionMapper{ PowerFactor = 1.5 }),
+ new Tuple<string, IAnimatorMotionMapper>("SinusoidaFactor", new SinusoidalFactorMotionMapper{ PowerFactor = 1.5 }),
+ new Tuple<string, IAnimatorMotionMapper>("DivisorInterpolate", new DivisorInterpolatedMotionMapper{ Divisor = 1.0, Power = 2.0 }),
+ new Tuple<string, IAnimatorMotionMapper>("CubicBezier", new CubicBezierMotionMapper{ X1 = 0, X2 = 1, Y1 = 0, Y2 = 1})
};
int map_index = 0;
void OnTimeline()
{
- double o = mappers[map_index].Item2.Caculate(timelineAnimator.Position);
+ double o = mappers[map_index].Item2.Calculate(timelineAnimator.Position);
int x = (int)((X2 * o) + (X1 * (1.0 - o)));
int y = (int)((Y2 * o) + (Y1 * (1.0 - o)));