2 * Copyright (c) 2015 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-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/effects/shader-effect-impl.h>
31 Animation::Animation()
35 Animation::Animation(Internal::Animation* animation)
36 : BaseHandle(animation)
40 Animation Animation::New(float durationSeconds)
42 Internal::AnimationPtr internal = Dali::Internal::Animation::New(durationSeconds);
44 return Animation(internal.Get());
47 Animation Animation::DownCast( BaseHandle handle )
49 return Animation( dynamic_cast<Dali::Internal::Animation*>(handle.GetObjectPtr()) );
52 Animation::~Animation()
56 Animation::Animation(const Animation& handle)
61 Animation& Animation::operator=(const Animation& rhs)
63 BaseHandle::operator=(rhs);
67 void Animation::SetDuration(float durationSeconds)
69 GetImplementation(*this).SetDuration(durationSeconds);
72 float Animation::GetDuration() const
74 return GetImplementation(*this).GetDuration();
77 void Animation::SetLooping(bool looping)
79 GetImplementation(*this).SetLooping(looping);
82 void Animation::SetLoopCount(int count)
84 GetImplementation(*this).SetLoopCount(count);
87 int Animation::GetLoopCount()
89 return GetImplementation(*this).GetLoopCount();
92 int Animation::GetCurrentLoop()
94 return GetImplementation(*this).GetCurrentLoop();
97 bool Animation::IsLooping() const
99 return GetImplementation(*this).IsLooping();
102 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
104 GetImplementation(*this).SetEndAction(endAction);
107 Dali::Animation::EndAction Animation::GetEndAction() const
109 return GetImplementation(*this).GetEndAction();
112 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
114 GetImplementation(*this).SetDisconnectAction( disconnectAction );
117 Animation::EndAction Animation::GetDisconnectAction() const
119 return GetImplementation(*this).GetDisconnectAction();
122 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
124 GetImplementation(*this).SetDefaultAlphaFunction(alpha);
127 AlphaFunction Animation::GetDefaultAlphaFunction() const
129 return GetImplementation(*this).GetDefaultAlphaFunction();
132 void Animation::Play()
134 GetImplementation(*this).Play();
137 void Animation::PlayFrom(float progress)
139 GetImplementation(*this).PlayFrom(progress);
143 void Animation::Pause()
145 GetImplementation(*this).Pause();
148 Dali::Animation::State Animation::GetState() const
150 return GetImplementation(*this).GetState();
153 void Animation::Stop()
155 GetImplementation(*this).Stop();
158 void Animation::Clear()
160 GetImplementation(*this).Clear();
163 Animation::AnimationSignalType& Animation::FinishedSignal()
165 return GetImplementation(*this).FinishedSignal();
168 void Animation::AnimateBy(Property target, Property::Value relativeValue)
170 GetImplementation(*this).AnimateBy(target, relativeValue);
173 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
175 GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
178 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
180 GetImplementation(*this).AnimateBy(target, relativeValue, period);
183 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
185 GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
188 void Animation::AnimateTo(Property target, Property::Value destinationValue)
190 GetImplementation(*this).AnimateTo(target, destinationValue);
193 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
195 GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
198 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
200 GetImplementation(*this).AnimateTo(target, destinationValue, period);
203 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
205 GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
208 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
210 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
213 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
215 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
218 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
220 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
223 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
225 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
228 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
230 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
233 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
235 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
239 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
241 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
244 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
246 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
250 // Actor specific animations
252 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
254 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
257 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
259 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
262 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
264 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
267 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
269 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
272 void Animation::Show(Actor actor, float delaySeconds)
274 GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
277 void Animation::Hide(Actor actor, float delaySeconds)
279 GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
282 void Animation::SetCurrentProgress( float progress )
284 return GetImplementation(*this).SetCurrentProgress( progress );
287 float Animation::GetCurrentProgress()
289 return GetImplementation(*this).GetCurrentProgress();
292 void Animation::SetSpeedFactor( float factor )
294 GetImplementation(*this).SetSpeedFactor( factor );
297 float Animation::GetSpeedFactor() const
299 return GetImplementation(*this).GetSpeedFactor();
302 void Animation::SetPlayRange( const Vector2& range )
304 GetImplementation(*this).SetPlayRange(range);
307 Vector2 Animation::GetPlayRange() const
309 return GetImplementation(*this).GetPlayRange();