2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/animation/animation.h>
22 #include <dali/public-api/animation/alpha-functions.h>
23 #include <dali/public-api/animation/time-period.h>
24 #include <dali/public-api/math/quaternion.h>
25 #include <dali/public-api/math/degree.h>
26 #include <dali/public-api/math/radian.h>
27 #include <dali/public-api/math/vector2.h>
28 #include <dali/internal/event/actors/actor-impl.h>
29 #include <dali/internal/event/animation/animation-impl.h>
30 #include <dali/internal/event/effects/shader-effect-impl.h>
35 Animation::Animation()
39 Animation::Animation(Internal::Animation* animation)
40 : BaseHandle(animation)
44 Animation Animation::New(float durationSeconds)
46 Internal::AnimationPtr internal = Dali::Internal::Animation::New(durationSeconds);
48 return Animation(internal.Get());
51 Animation Animation::DownCast( BaseHandle handle )
53 return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
56 Animation::~Animation()
60 Animation::Animation(const Animation& handle)
65 Animation& Animation::operator=(const Animation& rhs)
67 BaseHandle::operator=(rhs);
71 void Animation::SetDuration(float durationSeconds)
73 GetImplementation(*this).SetDuration(durationSeconds);
76 float Animation::GetDuration() const
78 return GetImplementation(*this).GetDuration();
81 void Animation::SetLooping(bool looping)
83 GetImplementation(*this).SetLooping(looping);
86 bool Animation::IsLooping() const
88 return GetImplementation(*this).IsLooping();
91 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
93 GetImplementation(*this).SetEndAction(endAction);
96 Dali::Animation::EndAction Animation::GetEndAction() const
98 return GetImplementation(*this).GetEndAction();
101 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
103 GetImplementation(*this).SetDisconnectAction( disconnectAction );
106 Animation::EndAction Animation::GetDisconnectAction() const
108 return GetImplementation(*this).GetDisconnectAction();
111 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
113 GetImplementation(*this).SetDefaultAlphaFunction(alpha);
116 AlphaFunction Animation::GetDefaultAlphaFunction() const
118 return GetImplementation(*this).GetDefaultAlphaFunction();
121 void Animation::Play()
123 GetImplementation(*this).Play();
126 void Animation::PlayFrom(float progress)
128 GetImplementation(*this).PlayFrom(progress);
132 void Animation::Pause()
134 GetImplementation(*this).Pause();
137 void Animation::Stop()
139 GetImplementation(*this).Stop();
142 void Animation::Clear()
144 GetImplementation(*this).Clear();
147 Animation::AnimationSignalType& Animation::FinishedSignal()
149 return GetImplementation(*this).FinishedSignal();
152 void Animation::AnimateBy(Property target, Property::Value relativeValue)
154 GetImplementation(*this).AnimateBy(target, relativeValue);
157 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
159 GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
162 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
164 GetImplementation(*this).AnimateBy(target, relativeValue, period);
167 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
169 GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
172 void Animation::AnimateTo(Property target, Property::Value destinationValue)
174 GetImplementation(*this).AnimateTo(target, destinationValue);
177 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
179 GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
182 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
184 GetImplementation(*this).AnimateTo(target, destinationValue, period);
187 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
189 GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
192 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
194 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
197 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
199 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
202 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
204 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
207 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
209 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
212 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
214 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
217 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
219 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
223 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
225 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
228 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
230 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
234 // Actor specific animations
236 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
238 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
241 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
243 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
246 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
248 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
251 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
253 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
256 void Animation::Show(Actor actor, float delaySeconds)
258 GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
261 void Animation::Hide(Actor actor, float delaySeconds)
263 GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
266 void Animation::SetCurrentProgress( float progress )
268 return GetImplementation(*this).SetCurrentProgress( progress );
271 float Animation::GetCurrentProgress()
273 return GetImplementation(*this).GetCurrentProgress();
276 void Animation::SetSpeedFactor( float factor )
278 GetImplementation(*this).SetSpeedFactor( factor );
281 float Animation::GetSpeedFactor() const
283 return GetImplementation(*this).GetSpeedFactor();
286 void Animation::SetPlayRange( const Vector2& range )
288 GetImplementation(*this).SetPlayRange(range);
291 Vector2 Animation::GetPlayRange() const
293 return GetImplementation(*this).GetPlayRange();