Merge "Change the timing of Context::GlContextCreated()" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/animation/animation.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/alpha-function.h>
23 #include <dali/public-api/animation/time-period.h>
24 #include <dali/internal/event/actors/actor-impl.h>
25 #include <dali/internal/event/animation/animation-impl.h>
26 #include <dali/internal/event/animation/path-impl.h>
27
28 namespace Dali
29 {
30
31 Animation::Animation()
32 {
33 }
34
35 Animation::Animation(Internal::Animation* animation)
36 : BaseHandle(animation)
37 {
38 }
39
40 Animation Animation::New(float durationSeconds)
41 {
42   Internal::AnimationPtr internal = Dali::Internal::Animation::New(durationSeconds);
43
44   return Animation(internal.Get());
45 }
46
47 Animation Animation::DownCast( BaseHandle handle )
48 {
49   return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
50 }
51
52 Animation::~Animation()
53 {
54 }
55
56 Animation::Animation(const Animation& handle) = default;
57
58 Animation& Animation::operator=(const Animation& rhs) = default;
59
60 Animation::Animation( Animation&& rhs ) = default;
61
62 Animation& Animation::operator=( Animation&& rhs ) = default;
63
64 void Animation::SetDuration(float durationSeconds)
65 {
66   GetImplementation(*this).SetDuration(durationSeconds);
67 }
68
69 float Animation::GetDuration() const
70 {
71   return GetImplementation(*this).GetDuration();
72 }
73
74 void Animation::SetLooping(bool looping)
75 {
76   GetImplementation(*this).SetLooping(looping);
77 }
78
79 void Animation::SetLoopCount(int32_t count)
80 {
81   GetImplementation(*this).SetLoopCount(count);
82 }
83
84 int32_t Animation::GetLoopCount()
85 {
86   return GetImplementation(*this).GetLoopCount();
87 }
88
89 int32_t Animation::GetCurrentLoop()
90 {
91   return GetImplementation(*this).GetCurrentLoop();
92 }
93
94 bool Animation::IsLooping() const
95 {
96   return GetImplementation(*this).IsLooping();
97 }
98
99 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
100 {
101   GetImplementation(*this).SetEndAction(endAction);
102 }
103
104 Dali::Animation::EndAction Animation::GetEndAction() const
105 {
106   return GetImplementation(*this).GetEndAction();
107 }
108
109 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
110 {
111   GetImplementation(*this).SetDisconnectAction( disconnectAction );
112 }
113
114 Animation::EndAction Animation::GetDisconnectAction() const
115 {
116   return GetImplementation(*this).GetDisconnectAction();
117 }
118
119 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
120 {
121   GetImplementation(*this).SetDefaultAlphaFunction(alpha);
122 }
123
124 AlphaFunction Animation::GetDefaultAlphaFunction() const
125 {
126   return GetImplementation(*this).GetDefaultAlphaFunction();
127 }
128
129 void Animation::Play()
130 {
131   GetImplementation(*this).Play();
132 }
133
134 void Animation::PlayFrom(float progress)
135 {
136   GetImplementation(*this).PlayFrom(progress);
137 }
138
139 void Animation::PlayAfter( float delaySeconds )
140 {
141   GetImplementation( *this ).PlayAfter( delaySeconds );
142 }
143
144 void Animation::Pause()
145 {
146   GetImplementation(*this).Pause();
147 }
148
149 Dali::Animation::State Animation::GetState() const
150 {
151   return GetImplementation(*this).GetState();
152 }
153
154 void Animation::Stop()
155 {
156   GetImplementation(*this).Stop();
157 }
158
159 void Animation::Clear()
160 {
161   GetImplementation(*this).Clear();
162 }
163
164 void Animation::SetLoopingMode( LoopingMode loopingMode )
165 {
166   GetImplementation( *this ).SetLoopingMode( loopingMode );
167 }
168
169 Animation::LoopingMode Animation::GetLoopingMode() const
170 {
171   return GetImplementation( *this ).GetLoopingMode();
172 }
173
174 Animation::AnimationSignalType& Animation::FinishedSignal()
175 {
176   return GetImplementation(*this).FinishedSignal();
177 }
178
179 void Animation::AnimateBy(Property target, Property::Value relativeValue)
180 {
181   GetImplementation(*this).AnimateBy(target, relativeValue);
182 }
183
184 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
185 {
186   GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
187 }
188
189 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
190 {
191   GetImplementation(*this).AnimateBy(target, relativeValue, period);
192 }
193
194 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
195 {
196   GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
197 }
198
199 void Animation::AnimateTo(Property target, Property::Value destinationValue)
200 {
201   GetImplementation(*this).AnimateTo(target, destinationValue);
202 }
203
204 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
205 {
206   GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
207 }
208
209 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
210 {
211   GetImplementation(*this).AnimateTo(target, destinationValue, period);
212 }
213
214 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
215 {
216   GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
217 }
218
219 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
220 {
221   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
222 }
223
224 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
225 {
226   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
227 }
228
229 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
230 {
231   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
232 }
233
234 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
235 {
236   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
237 }
238
239 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
240 {
241   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
242 }
243
244 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
245 {
246   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
247 }
248
249
250 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
251 {
252   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
253 }
254
255 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
256 {
257   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
258 }
259
260
261 // Actor specific animations
262
263 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
264 {
265   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
266 }
267
268 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
269 {
270   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
271 }
272
273 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
274 {
275   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
276 }
277
278 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
279 {
280   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
281 }
282
283 void Animation::Show(Actor actor, float delaySeconds)
284 {
285   GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
286 }
287
288 void Animation::Hide(Actor actor, float delaySeconds)
289 {
290   GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
291 }
292
293 void Animation::SetCurrentProgress( float progress )
294 {
295   return GetImplementation(*this).SetCurrentProgress( progress );
296 }
297
298 float Animation::GetCurrentProgress()
299 {
300   return GetImplementation(*this).GetCurrentProgress();
301 }
302
303 void Animation::SetSpeedFactor( float factor )
304 {
305   GetImplementation(*this).SetSpeedFactor( factor );
306 }
307
308 float Animation::GetSpeedFactor() const
309 {
310   return GetImplementation(*this).GetSpeedFactor();
311 }
312
313 void Animation::SetPlayRange( const Vector2& range )
314 {
315   GetImplementation(*this).SetPlayRange(range);
316 }
317
318 Vector2 Animation::GetPlayRange() const
319 {
320   return GetImplementation(*this).GetPlayRange();
321 }
322
323 } // namespace Dali