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/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 bool Animation::IsLooping() const
84 return GetImplementation(*this).IsLooping();
87 void Animation::SetEndAction(Dali::Animation::EndAction endAction)
89 GetImplementation(*this).SetEndAction(endAction);
92 Dali::Animation::EndAction Animation::GetEndAction() const
94 return GetImplementation(*this).GetEndAction();
97 void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
99 GetImplementation(*this).SetDisconnectAction( disconnectAction );
102 Animation::EndAction Animation::GetDisconnectAction() const
104 return GetImplementation(*this).GetDisconnectAction();
107 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
109 GetImplementation(*this).SetDefaultAlphaFunction(alpha);
112 AlphaFunction Animation::GetDefaultAlphaFunction() const
114 return GetImplementation(*this).GetDefaultAlphaFunction();
117 void Animation::Play()
119 GetImplementation(*this).Play();
122 void Animation::PlayFrom(float progress)
124 GetImplementation(*this).PlayFrom(progress);
128 void Animation::Pause()
130 GetImplementation(*this).Pause();
133 void Animation::Stop()
135 GetImplementation(*this).Stop();
138 void Animation::Clear()
140 GetImplementation(*this).Clear();
143 Animation::AnimationSignalType& Animation::FinishedSignal()
145 return GetImplementation(*this).FinishedSignal();
148 void Animation::AnimateBy(Property target, Property::Value relativeValue)
150 GetImplementation(*this).AnimateBy(target, relativeValue);
153 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha)
155 GetImplementation(*this).AnimateBy(target, relativeValue, alpha);
158 void Animation::AnimateBy(Property target, Property::Value relativeValue, TimePeriod period)
160 GetImplementation(*this).AnimateBy(target, relativeValue, period);
163 void Animation::AnimateBy(Property target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
165 GetImplementation(*this).AnimateBy(target, relativeValue, alpha, period);
168 void Animation::AnimateTo(Property target, Property::Value destinationValue)
170 GetImplementation(*this).AnimateTo(target, destinationValue);
173 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha)
175 GetImplementation(*this).AnimateTo(target, destinationValue, alpha);
178 void Animation::AnimateTo(Property target, Property::Value destinationValue, TimePeriod period)
180 GetImplementation(*this).AnimateTo(target, destinationValue, period);
183 void Animation::AnimateTo(Property target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
185 GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
188 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
190 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
193 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
195 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
198 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
200 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
203 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
205 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
208 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
210 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
213 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
215 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
219 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
221 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
224 void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
226 GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
230 // Actor specific animations
232 void Animation::Animate( Actor actor, Path path, const Vector3& forward )
234 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
237 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
239 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
242 void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
244 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
247 void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
249 GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
252 void Animation::Show(Actor actor, float delaySeconds)
254 GetImplementation(*this).Show(GetImplementation(actor), delaySeconds);
257 void Animation::Hide(Actor actor, float delaySeconds)
259 GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
262 void Animation::SetCurrentProgress( float progress )
264 return GetImplementation(*this).SetCurrentProgress( progress );
267 float Animation::GetCurrentProgress()
269 return GetImplementation(*this).GetCurrentProgress();
272 void Animation::SetSpeedFactor( float factor )
274 GetImplementation(*this).SetSpeedFactor( factor );
277 float Animation::GetSpeedFactor() const
279 return GetImplementation(*this).GetSpeedFactor();
282 void Animation::SetPlayRange( const Vector2& range )
284 GetImplementation(*this).SetPlayRange(range);
287 Vector2 Animation::GetPlayRange() const
289 return GetImplementation(*this).GetPlayRange();