Merge "Fix PropertyNotification issue" 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)
57 : BaseHandle(handle)
58 {
59 }
60
61 Animation& Animation::operator=(const Animation& rhs)
62 {
63   BaseHandle::operator=(rhs);
64   return *this;
65 }
66
67 Animation::Animation( Animation&& rhs ) = default;
68
69 Animation& Animation::operator=( Animation&& rhs ) = default;
70
71 void Animation::SetDuration(float durationSeconds)
72 {
73   GetImplementation(*this).SetDuration(durationSeconds);
74 }
75
76 float Animation::GetDuration() const
77 {
78   return GetImplementation(*this).GetDuration();
79 }
80
81 void Animation::SetLooping(bool looping)
82 {
83   GetImplementation(*this).SetLooping(looping);
84 }
85
86 void Animation::SetLoopCount(int32_t count)
87 {
88   GetImplementation(*this).SetLoopCount(count);
89 }
90
91 int32_t Animation::GetLoopCount()
92 {
93   return GetImplementation(*this).GetLoopCount();
94 }
95
96 int32_t Animation::GetCurrentLoop()
97 {
98   return GetImplementation(*this).GetCurrentLoop();
99 }
100
101 bool Animation::IsLooping() const
102 {
103   return GetImplementation(*this).IsLooping();
104 }
105
106 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
107 {
108   GetImplementation(*this).SetEndAction(endAction);
109 }
110
111 Dali::Animation::EndAction Animation::GetEndAction() const
112 {
113   return GetImplementation(*this).GetEndAction();
114 }
115
116 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
117 {
118   GetImplementation(*this).SetDisconnectAction( disconnectAction );
119 }
120
121 Animation::EndAction Animation::GetDisconnectAction() const
122 {
123   return GetImplementation(*this).GetDisconnectAction();
124 }
125
126 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
127 {
128   GetImplementation(*this).SetDefaultAlphaFunction(alpha);
129 }
130
131 AlphaFunction Animation::GetDefaultAlphaFunction() const
132 {
133   return GetImplementation(*this).GetDefaultAlphaFunction();
134 }
135
136 void Animation::Play()
137 {
138   GetImplementation(*this).Play();
139 }
140
141 void Animation::PlayFrom(float progress)
142 {
143   GetImplementation(*this).PlayFrom(progress);
144 }
145
146 void Animation::PlayAfter( float delaySeconds )
147 {
148   GetImplementation( *this ).PlayAfter( delaySeconds );
149 }
150
151 void Animation::Pause()
152 {
153   GetImplementation(*this).Pause();
154 }
155
156 Dali::Animation::State Animation::GetState() const
157 {
158   return GetImplementation(*this).GetState();
159 }
160
161 void Animation::Stop()
162 {
163   GetImplementation(*this).Stop();
164 }
165
166 void Animation::Clear()
167 {
168   GetImplementation(*this).Clear();
169 }
170
171 void Animation::SetLoopingMode( LoopingMode loopingMode )
172 {
173   GetImplementation( *this ).SetLoopingMode( loopingMode );
174 }
175
176 Animation::LoopingMode Animation::GetLoopingMode() const
177 {
178   return GetImplementation( *this ).GetLoopingMode();
179 }
180
181 Animation::AnimationSignalType& Animation::FinishedSignal()
182 {
183   return GetImplementation(*this).FinishedSignal();
184 }
185
186 void Animation::AnimateBy(Property target, Property::Value relativeValue)
187 {
188   GetImplementation(*this).AnimateBy(target, relativeValue);
189 }
190
191 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
192 {
193   GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
194 }
195
196 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
197 {
198   GetImplementation(*this).AnimateBy(target, relativeValue, period);
199 }
200
201 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
202 {
203   GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
204 }
205
206 void Animation::AnimateTo(Property target, Property::Value destinationValue)
207 {
208   GetImplementation(*this).AnimateTo(target, destinationValue);
209 }
210
211 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
212 {
213   GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
214 }
215
216 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
217 {
218   GetImplementation(*this).AnimateTo(target, destinationValue, period);
219 }
220
221 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
222 {
223   GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
224 }
225
226 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
227 {
228   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
229 }
230
231 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
232 {
233   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
234 }
235
236 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
237 {
238   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
239 }
240
241 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
242 {
243   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
244 }
245
246 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
247 {
248   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
249 }
250
251 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
252 {
253   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
254 }
255
256
257 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
258 {
259   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
260 }
261
262 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
263 {
264   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
265 }
266
267
268 // Actor specific animations
269
270 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
271 {
272   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
273 }
274
275 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
276 {
277   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
278 }
279
280 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
281 {
282   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
283 }
284
285 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
286 {
287   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
288 }
289
290 void Animation::Show(Actor actor, float delaySeconds)
291 {
292   GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
293 }
294
295 void Animation::Hide(Actor actor, float delaySeconds)
296 {
297   GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
298 }
299
300 void Animation::SetCurrentProgress( float progress )
301 {
302   return GetImplementation(*this).SetCurrentProgress( progress );
303 }
304
305 float Animation::GetCurrentProgress()
306 {
307   return GetImplementation(*this).GetCurrentProgress();
308 }
309
310 void Animation::SetSpeedFactor( float factor )
311 {
312   GetImplementation(*this).SetSpeedFactor( factor );
313 }
314
315 float Animation::GetSpeedFactor() const
316 {
317   return GetImplementation(*this).GetSpeedFactor();
318 }
319
320 void Animation::SetPlayRange( const Vector2& range )
321 {
322   GetImplementation(*this).SetPlayRange(range);
323 }
324
325 Vector2 Animation::GetPlayRange() const
326 {
327   return GetImplementation(*this).GetPlayRange();
328 }
329
330 } // namespace Dali