Merge remote-tracking branch 'origin/API4'
[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     /// <since_tizen> preview </since_tizen>
11     public interface IAnimatorMotionMapper
12     {
13         /// <summary>
14         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
15         /// </summary>
16         /// <since_tizen> preview </since_tizen>
17         double Calculate(double position);
18     }
19
20     /// <summary>
21     /// The LinearMotionMapper class.
22     /// </summary>
23     /// <since_tizen> preview </since_tizen>
24     public class LinearMotionMapper : IAnimatorMotionMapper
25     {
26         /// <summary>
27         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
28         /// </summary>
29         /// <since_tizen> preview </since_tizen>
30         public double Calculate(double position)
31         {
32             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Linear, 0, 0);
33         }
34     }
35
36     /// <summary>
37     /// The AccelerateMotionMapper class.
38     /// </summary>
39     /// <since_tizen> preview </since_tizen>
40     public class AccelerateMotionMapper : IAnimatorMotionMapper
41     {
42         /// <summary>
43         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
44         /// </summary>
45         /// <since_tizen> preview </since_tizen>
46         public double Calculate(double position)
47         {
48             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Accelerate, 0, 0);
49         }
50     }
51
52     /// <summary>
53     /// The DecelerateMotionMapper class.
54     /// </summary>
55     /// <since_tizen> preview </since_tizen>
56     public class DecelerateMotionMapper : IAnimatorMotionMapper
57     {
58         /// <summary>
59         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
60         /// </summary>
61         /// <since_tizen> preview </since_tizen>
62         public double Calculate(double position)
63         {
64             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Decelerate, 0, 0);
65         }
66     }
67
68     /// <summary>
69     /// The SinusoidalMotionMapper class.
70     /// </summary>
71     /// <since_tizen> preview </since_tizen>
72     public class SinusoidalMotionMapper : IAnimatorMotionMapper
73     {
74         /// <summary>
75         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
76         /// </summary>
77         /// <since_tizen> preview </since_tizen>
78         public double Calculate(double position)
79         {
80             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Sinusoidal, 0, 0);
81         }
82     }
83
84     /// <summary>.
85     /// The AccelerateFactorMotionMapper class.
86     /// </summary>
87     /// <since_tizen> preview </since_tizen>
88     public class AccelerateFactorMotionMapper : IAnimatorMotionMapper
89     {
90         /// <summary>
91         /// The power factor of AccelerateFactorMotionMapper.
92         /// </summary>
93         /// <since_tizen> preview </since_tizen>
94         public double PowerFactor { get; set; } = 0;
95
96         /// <summary>
97         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
98         /// </summary>
99         /// <since_tizen> preview </since_tizen>
100         public double Calculate(double position)
101         {
102             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.AccelerateFactor, PowerFactor, 0);
103         }
104     }
105
106     /// <summary>
107     /// The DecelerateFactorMotionMapper class.
108     /// </summary>
109     /// <since_tizen> preview </since_tizen>
110     public class DecelerateFactorMotionMapper : IAnimatorMotionMapper
111     {
112         /// <summary>
113         /// The power factor of DecelerateFactorMotionMapper.
114         /// </summary>
115         /// <since_tizen> preview </since_tizen>
116         public double PowerFactor { get; set; } = 0;
117
118         /// <summary>
119         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
120         /// </summary>
121         /// <since_tizen> preview </since_tizen>
122         public double Calculate(double position)
123         {
124             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DecelerateFactor, PowerFactor, 0);
125         }
126     }
127
128     /// <summary>
129     /// The SinusoidalFactorMotionMapper class.
130     /// </summary>
131     /// <since_tizen> preview </since_tizen>
132     public class SinusoidalFactorMotionMapper : IAnimatorMotionMapper
133     {
134         /// <summary>
135         /// The power factor of SinusoidalFactorMotionMapper.
136         /// </summary>
137         /// <since_tizen> preview </since_tizen>
138         public double PowerFactor { get; set; } = 0;
139
140         /// <summary>
141         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
142         /// </summary>
143         /// <since_tizen> preview </since_tizen>
144         public double Calculate(double position)
145         {
146             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.SinusoidalFactor, PowerFactor, 0);
147         }
148     }
149
150     /// <summary>
151     /// The DivisorInterpolatedMotionMapper class.
152     /// </summary>
153     /// <since_tizen> preview </since_tizen>
154     public class DivisorInterpolatedMotionMapper : IAnimatorMotionMapper
155     {
156         /// <summary>
157         /// The Divisor of DivisorInterpolatedMotionMapper.
158         /// </summary>
159         /// <since_tizen> preview </since_tizen>
160         public double Divisor { get; set; } = 0;
161
162         /// <summary>
163         /// The power of DivisorInterpolatedMotionMapper.
164         /// </summary>
165         /// <since_tizen> preview </since_tizen>
166         public double Power { get; set; } = 0;
167
168         /// <summary>
169         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
170         /// </summary>
171         /// <since_tizen> preview </since_tizen>
172         public double Calculate(double position)
173         {
174             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.DivisorInterp, Divisor, Power);
175         }
176     }
177
178     /// <summary>
179     /// The BounceMotionMapper class.
180     /// </summary>
181     /// <since_tizen> preview </since_tizen>
182     public class BounceMotionMapper : IAnimatorMotionMapper
183     {
184         /// <summary>
185         /// The bounces of BounceMotionMapper.
186         /// </summary>
187         /// <since_tizen> preview </since_tizen>
188         public int Bounces { get; set; } = 0;
189
190         /// <summary>
191         /// The decay factor of BounceMotionMapper.
192         /// </summary>
193         /// <since_tizen> preview </since_tizen>
194         public double DecayFactor { get; set; } = 0;
195
196         /// <summary>
197         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
198         /// </summary>
199         /// <since_tizen> preview </since_tizen>
200         public double Calculate(double position)
201         {
202             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Bounces);
203         }
204     }
205
206     /// <summary>
207     /// The SpringMotionMapper class.
208     /// </summary>
209     /// <since_tizen> preview </since_tizen>
210     public class SpringMotionMapper : IAnimatorMotionMapper
211     {
212         /// <summary>
213         /// The wobbles of SpringMotionMapper.
214         /// </summary>
215         /// <since_tizen> preview </since_tizen>
216         public int Wobbles { get; set; } = 0;
217
218         /// <summary>
219         /// The decay factor of SpringMotionMapper.
220         /// </summary>
221         /// <since_tizen> preview </since_tizen>
222         public double DecayFactor { get; set; } = 0;
223
224         /// <summary>
225         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
226         /// </summary>
227         /// <since_tizen> preview </since_tizen>
228         public double Calculate(double position)
229         {
230             return Interop.Ecore.ecore_animator_pos_map(position, Interop.Ecore.PositionMap.Bounce, DecayFactor, Wobbles);
231         }
232     }
233
234     /// <summary>
235     /// The CubicBezierMotionMapper class.
236     /// </summary>
237     /// <since_tizen> preview </since_tizen>
238     public class CubicBezierMotionMapper : IAnimatorMotionMapper
239     {
240         /// <summary>
241         /// The X1 of CubicBezierMotionMapper.
242         /// </summary>
243         /// <since_tizen> preview </since_tizen>
244         public double X1 { get; set; } = 0;
245
246         /// <summary>
247         /// The Y1 of CubicBezierMotionMapper.
248         /// </summary>
249         /// <since_tizen> preview </since_tizen>
250         public double Y1 { get; set; } = 0;
251
252         /// <summary>
253         /// The X2 of CubicBezierMotionMapper.
254         /// </summary>
255         /// <since_tizen> preview </since_tizen>
256         public double X2 { get; set; } = 0;
257
258         /// <summary>
259         /// The Y2 of CubicBezierMotionMapper.
260         /// </summary>
261         /// <since_tizen> preview </since_tizen>
262         public double Y2 { get; set; } = 0;
263
264         /// <summary>
265         /// Maps an input position from 0.0 to 1.0 along a timeline to a position in a different curve.
266         /// </summary>
267         /// <since_tizen> preview </since_tizen>
268         public double Calculate(double position)
269         {
270             double[] values = { X1, Y1, X2, Y2 };
271             return Interop.Ecore.ecore_animator_pos_map_n(position, Interop.Ecore.PositionMap.Bounce, values.Length, values);
272         }
273     }
274 }