Release 4.0.0-preview1-00332
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / IAnimatorMotionMapper.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace ElmSharp
6 {
7     /// <summary>
8     /// The AnimatorMotionMapper interface
9     /// </summary>
10     public interface IAnimatorMotionMapper
11     {
12         /// <summary>
13         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
14         /// </summary>
15         double Calculate(double position);
16     }
17
18     /// <summary>
19     /// The LinearMotionMapper class
20     /// </summary>
21     public class LinearMotionMapper : IAnimatorMotionMapper
22     {
23         /// <summary>
24         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
25         /// </summary>
26         public double Calculate(double position)
27         {
28             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Linear, 0, 0);
29         }
30     }
31
32     /// <summary>
33     /// The AccelerateMotionMapper class
34     /// </summary>
35     public class AccelerateMotionMapper : IAnimatorMotionMapper
36     {
37         /// <summary>
38         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
39         /// </summary>
40         public double Calculate(double position)
41         {
42             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Accelerate, 0, 0);
43         }
44     }
45
46     /// <summary>
47     /// The DecelerateMotionMapper class
48     /// </summary>
49     public class DecelerateMotionMapper : IAnimatorMotionMapper
50     {
51         /// <summary>
52         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
53         /// </summary>
54         public double Calculate(double position)
55         {
56             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Decelerate, 0, 0);
57         }
58     }
59
60     /// <summary>
61     /// The SinusoidalMotionMapper class
62     /// </summary>
63     public class SinusoidalMotionMapper : IAnimatorMotionMapper
64     {
65         /// <summary>
66         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
67         /// </summary>
68         public double Calculate(double position)
69         {
70             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Sinusoidal, 0, 0);
71         }
72     }
73
74     /// <summary>
75     /// The AccelerateFactorMotionMapper class
76     /// </summary>
77     public class AccelerateFactorMotionMapper : IAnimatorMotionMapper
78     {
79         /// <summary>
80         /// The power factor of AccelerateFactorMotionMapper
81         /// </summary>
82         public double PowerFactor { get; set; } = 0;
83
84         /// <summary>
85         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
86         /// </summary>
87         public double Calculate(double position)
88         {
89             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.AccelerateFactor, PowerFactor, 0);
90         }
91     }
92
93     /// <summary>
94     /// The DecelerateFactorMotionMapper class
95     /// </summary>
96     public class DecelerateFactorMotionMapper : IAnimatorMotionMapper
97     {
98         /// <summary>
99         /// The power factor of DecelerateFactorMotionMapper
100         /// </summary>
101         public double PowerFactor { get; set; } = 0;
102
103         /// <summary>
104         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
105         /// </summary>
106         public double Calculate(double position)
107         {
108             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DecelerateFactor, PowerFactor, 0);
109         }
110     }
111
112     /// <summary>
113     /// The SinusoidalFactorMotionMapper class
114     /// </summary>
115     public class SinusoidalFactorMotionMapper : IAnimatorMotionMapper
116     {
117         /// <summary>
118         /// The power factor of SinusoidalFactorMotionMapper
119         /// </summary>
120         public double PowerFactor { get; set; } = 0;
121
122         /// <summary>
123         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
124         /// </summary>
125         public double Calculate(double position)
126         {
127             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.SinusoidalFactor, PowerFactor, 0);
128         }
129     }
130
131     /// <summary>
132     /// The DivisorInterpolatedMotionMapper class
133     /// </summary>
134     public class DivisorInterpolatedMotionMapper : IAnimatorMotionMapper
135     {
136         /// <summary>
137         /// The Divisor of DivisorInterpolatedMotionMapper
138         /// </summary>
139         public double Divisor { get; set; } = 0;
140
141         /// <summary>
142         /// The power of DivisorInterpolatedMotionMapper
143         /// </summary>
144         public double Power { get; set; } = 0;
145
146         /// <summary>
147         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
148         /// </summary>
149         public double Calculate(double position)
150         {
151             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DivisorInterp, Divisor, Power);
152         }
153     }
154
155     /// <summary>
156     /// The BounceMotionMapper class
157     /// </summary>
158     public class BounceMotionMapper : IAnimatorMotionMapper
159     {
160         /// <summary>
161         /// The bounces of BounceMotionMapper
162         /// </summary>
163         public int Bounces { get; set; } = 0;
164
165         /// <summary>
166         /// The decay factor of BounceMotionMapper
167         /// </summary>
168         public double DecayFactor { get; set; } = 0;
169
170         /// <summary>
171         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
172         /// </summary>
173         public double Calculate(double position)
174         {
175             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Bounces);
176         }
177     }
178
179     /// <summary>
180     /// The SpringMotionMapper class
181     /// </summary>
182     public class SpringMotionMapper : IAnimatorMotionMapper
183     {
184         /// <summary>
185         /// The wobbles of SpringMotionMapper
186         /// </summary>
187         public int Wobbles { get; set; } = 0;
188
189         /// <summary>
190         /// The decat factir of SpringMotionMapper
191         /// </summary>
192         public double DecayFactor { get; set; } = 0;
193
194         /// <summary>
195         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
196         /// </summary>
197         public double Calculate(double position)
198         {
199             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Wobbles);
200         }
201     }
202
203     /// <summary>
204     /// The CubicBezierMotionMapper class
205     /// </summary>
206     public class CubicBezierMotionMapper : IAnimatorMotionMapper
207     {
208         /// <summary>
209         /// The X1 of CubicBezierMotionMapper
210         /// </summary>
211         public double X1 { get; set; } = 0;
212
213         /// <summary>
214         /// The Y1 of CubicBezierMotionMapper
215         /// </summary>
216         public double Y1 { get; set; } = 0;
217
218         /// <summary>
219         /// The X2 of CubicBezierMotionMapper
220         /// </summary>
221         public double X2 { get; set; } = 0;
222
223         /// <summary>
224         /// The Y2 of CubicBezierMotionMapper
225         /// </summary>
226         public double Y2 { get; set; } = 0;
227
228         /// <summary>
229         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve
230         /// </summary>
231         public double Calculate(double position)
232         {
233             double[] values = { X1, Y1, X2, Y2 };
234             return Interop.Ecore.ecore_animator_pos_map_n(position, Interop.Ecore.PositionMap.Bounce, values.Length, values);
235         }
236     }
237 }