using System; using System.Collections.Generic; using System.Text; namespace ElmSharp { /// /// The AnimatorMotionMapper interface /// public interface AnimatorMotionMapper { /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// double Caculate(double position); } /// /// The LinearMotionMapper class /// public class LinearMotionMapper : AnimatorMotionMapper { /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Linear, 0, 0); } } /// /// The AccelerateMotionMapper class /// public class AccelerateMotionMapper : AnimatorMotionMapper { /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Accelerate, 0, 0); } } /// /// The DecelerateMotionMapper class /// public class DecelerateMotionMapper : AnimatorMotionMapper { /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Decelerate, 0, 0); } } /// /// The SinusoidalMotionMapper class /// public class SinusoidalMotionMapper : AnimatorMotionMapper { /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Sinusoidal, 0, 0); } } /// /// The AccelerateFactorMotionMapper class /// public class AccelerateFactorMotionMapper : AnimatorMotionMapper { /// /// The power factor of AccelerateFactorMotionMapper /// public double PowerFactor { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.AccelerateFactor, PowerFactor, 0); } } /// /// The DecelerateFactorMotionMapper class /// public class DecelerateFactorMotionMapper : AnimatorMotionMapper { /// /// The power factor of DecelerateFactorMotionMapper /// public double PowerFactor { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DecelerateFactor, PowerFactor, 0); } } /// /// The SinusoidalFactorMotionMapper class /// public class SinusoidalFactorMotionMapper : AnimatorMotionMapper { /// /// The power factor of SinusoidalFactorMotionMapper /// public double PowerFactor { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.SinusoidalFactor, PowerFactor, 0); } } /// /// The DivisorInterpolatedMotionMapper class /// public class DivisorInterpolatedMotionMapper : AnimatorMotionMapper { /// /// The Divisor of DivisorInterpolatedMotionMapper /// public double Divisor { get; set; } = 0; /// /// The power of DivisorInterpolatedMotionMapper /// public double Power { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DivisorInterp, Divisor, Power); } } /// /// The BounceMotionMapper class /// public class BounceMotionMapper : AnimatorMotionMapper { /// /// The bounces of BounceMotionMapper /// public int Bounces { get; set; } = 0; /// /// The decay factor of BounceMotionMapper /// public double DecayFactor { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Bounces); } } /// /// The SpringMotionMapper class /// public class SpringMotionMapper : AnimatorMotionMapper { /// /// The wobbles of SpringMotionMapper /// public int Wobbles { get; set; } = 0; /// /// The decat factir of SpringMotionMapper /// public double DecayFactor { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Wobbles); } } /// /// The CubicBezierMotionMapper class /// public class CubicBezierMotionMapper : AnimatorMotionMapper { /// /// The X1 of CubicBezierMotionMapper /// public double X1 { get; set; } = 0; /// /// The Y1 of CubicBezierMotionMapper /// public double Y1 { get; set; } = 0; /// /// The X2 of CubicBezierMotionMapper /// public double X2 { get; set; } = 0; /// /// The Y2 of CubicBezierMotionMapper /// public double Y2 { get; set; } = 0; /// /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve /// public double Caculate(double position) { double[] values = { X1, Y1, X2, Y2 }; return Interop.Ecore.ecore_animator_pos_map_n(position, Interop.Ecore.PositionMap.Bounce, values.Length, values); } } }