sync ElmSharp source code latest
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / AnimatorMotionMapper.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace ElmSharp
6 {
7     public interface AnimatorMotionMapper
8     {
9         double Caculate(double position);
10     }
11
12     public class LinearMotionMapper : AnimatorMotionMapper
13     {
14         public double Caculate(double position)
15         {
16             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Linear, 0, 0);
17         }
18     }
19
20     public class AccelerateMotionMapper : AnimatorMotionMapper
21     {
22         public double Caculate(double position)
23         {
24             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Accelerate, 0, 0);
25         }
26     }
27
28     public class DecelerateMotionMapper : AnimatorMotionMapper
29     {
30         public double Caculate(double position)
31         {
32             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Decelerate, 0, 0);
33         }
34     }
35
36     public class SinusoidalMotionMapper : AnimatorMotionMapper
37     {
38         public double Caculate(double position)
39         {
40             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Sinusoidal, 0, 0);
41         }
42     }
43
44     public class AccelerateFactorMotionMapper : AnimatorMotionMapper
45     {
46         public double PowerFactor { get; set; } = 0;
47
48         public double Caculate(double position)
49         {
50             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.AccelerateFactor, PowerFactor, 0);
51         }
52     }
53
54     public class DecelerateFactorMotionMapper : AnimatorMotionMapper
55     {
56         public double PowerFactor { get; set; } = 0;
57
58         public double Caculate(double position)
59         {
60             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DecelerateFactor, PowerFactor, 0);
61         }
62     }
63
64     public class SinusoidalFactorMotionMapper : AnimatorMotionMapper
65     {
66         public double PowerFactor { get; set; } = 0;
67
68         public double Caculate(double position)
69         {
70             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.SinusoidalFactor, PowerFactor, 0);
71         }
72     }
73
74     public class DivisorInterpolatedMotionMapper : AnimatorMotionMapper
75     {
76         public double Divisor { get; set; } = 0;
77         public double Power { get; set; } = 0;
78
79         public double Caculate(double position)
80         {
81             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DivisorInterp, Divisor, Power);
82         }
83     }
84
85     public class BounceMotionMapper : AnimatorMotionMapper
86     {
87         public int Bounces { get; set; } = 0;
88         public double DecayFactor { get; set; } = 0;
89         public double Caculate(double position)
90         {
91             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Bounces);
92         }
93     }
94
95     public class SpringMotionMapper : AnimatorMotionMapper
96     {
97         public int Wobbles { get; set; } = 0;
98         public double DecayFactor { get; set; } = 0;
99
100         public double Caculate(double position)
101         {
102             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Wobbles);
103         }
104     }
105
106     public class CubicBezierMotionMapper : AnimatorMotionMapper
107     {
108         public double X1 { get; set; } = 0;
109         public double Y1 { get; set; } = 0;
110         public double X2 { get; set; } = 0;
111         public double Y2 { get; set; } = 0;
112
113         public double Caculate(double position)
114         {
115             double[] values = { X1, Y1, X2, Y2 };
116             return Interop.Ecore.ecore_animator_pos_map_n(position, Interop.Ecore.PositionMap.Bounce, values.Length, values);
117         }
118     }
119 }