Merge "Added P/N test cases, fixed last 2 cases." into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.cpp
1 /*
2  * Copyright (c) 2014 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-functions.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/effects/shader-effect-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 void Animation::SetDuration(float durationSeconds)
68 {
69   GetImplementation(*this).SetDuration(durationSeconds);
70 }
71
72 float Animation::GetDuration() const
73 {
74   return GetImplementation(*this).GetDuration();
75 }
76
77 void Animation::SetLooping(bool looping)
78 {
79   GetImplementation(*this).SetLooping(looping);
80 }
81
82 bool Animation::IsLooping() const
83 {
84   return GetImplementation(*this).IsLooping();
85 }
86
87 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
88 {
89   GetImplementation(*this).SetEndAction(endAction);
90 }
91
92 Dali::Animation::EndAction Animation::GetEndAction() const
93 {
94   return GetImplementation(*this).GetEndAction();
95 }
96
97 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
98 {
99   GetImplementation(*this).SetDisconnectAction( disconnectAction );
100 }
101
102 Animation::EndAction Animation::GetDisconnectAction() const
103 {
104   return GetImplementation(*this).GetDisconnectAction();
105 }
106
107 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
108 {
109   GetImplementation(*this).SetDefaultAlphaFunction(alpha);
110 }
111
112 AlphaFunction Animation::GetDefaultAlphaFunction() const
113 {
114   return GetImplementation(*this).GetDefaultAlphaFunction();
115 }
116
117 void Animation::Play()
118 {
119   GetImplementation(*this).Play();
120 }
121
122 void Animation::PlayFrom(float progress)
123 {
124   GetImplementation(*this).PlayFrom(progress);
125 }
126
127
128 void Animation::Pause()
129 {
130   GetImplementation(*this).Pause();
131 }
132
133 void Animation::Stop()
134 {
135   GetImplementation(*this).Stop();
136 }
137
138 void Animation::Clear()
139 {
140   GetImplementation(*this).Clear();
141 }
142
143 Animation::AnimationSignalType& Animation::FinishedSignal()
144 {
145   return GetImplementation(*this).FinishedSignal();
146 }
147
148 void Animation::AnimateBy(Property target, Property::Value relativeValue)
149 {
150   GetImplementation(*this).AnimateBy(target, relativeValue);
151 }
152
153 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
154 {
155   GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
156 }
157
158 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
159 {
160   GetImplementation(*this).AnimateBy(target, relativeValue, period);
161 }
162
163 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
164 {
165   GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
166 }
167
168 void Animation::AnimateTo(Property target, Property::Value destinationValue)
169 {
170   GetImplementation(*this).AnimateTo(target, destinationValue);
171 }
172
173 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
174 {
175   GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
176 }
177
178 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
179 {
180   GetImplementation(*this).AnimateTo(target, destinationValue, period);
181 }
182
183 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
184 {
185   GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
186 }
187
188 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
189 {
190   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
191 }
192
193 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
194 {
195   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
196 }
197
198 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
199 {
200   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
201 }
202
203 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
204 {
205   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
206 }
207
208 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
209 {
210   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
211 }
212
213 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
214 {
215   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
216 }
217
218
219 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
220 {
221   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
222 }
223
224 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
225 {
226   GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
227 }
228
229
230 // Actor specific animations
231
232 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
233 {
234   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
235 }
236
237 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
238 {
239   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
240 }
241
242 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
243 {
244   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
245 }
246
247 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
248 {
249   GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
250 }
251
252 void Animation::Show(Actor actor, float delaySeconds)
253 {
254   GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
255 }
256
257 void Animation::Hide(Actor actor, float delaySeconds)
258 {
259   GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
260 }
261
262 void Animation::SetCurrentProgress( float progress )
263 {
264   return GetImplementation(*this).SetCurrentProgress( progress );
265 }
266
267 float Animation::GetCurrentProgress()
268 {
269   return GetImplementation(*this).GetCurrentProgress();
270 }
271
272 void Animation::SetSpeedFactor( float factor )
273 {
274   GetImplementation(*this).SetSpeedFactor( factor );
275 }
276
277 float Animation::GetSpeedFactor() const
278 {
279   return GetImplementation(*this).GetSpeedFactor();
280 }
281
282 void Animation::SetPlayRange( const Vector2& range )
283 {
284   GetImplementation(*this).SetPlayRange(range);
285 }
286
287 Vector2 Animation::GetPlayRange() const
288 {
289   return GetImplementation(*this).GetPlayRange();
290 }
291
292 } // namespace Dali