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