#ifndef __DALI_INTERNAL_ANIMATION_H__
#define __DALI_INTERNAL_ANIMATION_H__
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/base-object.h>
#include <dali/internal/event/animation/animator-connector-base.h>
#include <dali/internal/event/animation/key-frames-impl.h>
+#include <dali/internal/event/animation/path-impl.h>
namespace Dali
{
class Actor;
class Animation;
class AnimationPlaylist;
-class ProxyObject;
-class ShaderEffect;
+class Object;
typedef IntrusivePtr<Animation> AnimationPtr;
typedef std::vector<AnimationPtr> AnimationContainer;
{
public:
- typedef Dali::Animation::AnyFunction AnyFunction;
typedef Dali::Animation::EndAction EndAction;
+ typedef Dali::Animation::Interpolation Interpolation;
typedef void (*FinishedCallback)(Object* object);
static AnimationPtr New(float durationSeconds);
/**
- * Create a new Animation object.
- * @param[in] durationSeconds The duration of the animation.
- * @param[in] endAction The action to perform when the animation ends.
- * @param[in] destroyAction The action to perform when the animation ends.
- * @return A smart-pointer to the newly allocated Animation.
+ * @copydoc Dali::Animation::SetDuration()
*/
- static AnimationPtr New(float durationSeconds, EndAction endAction, EndAction destroyAction);
+ void SetDuration(float seconds);
/**
- * Create a new Animation object.
- * @param[in] durationSeconds The duration of the animation.
- * @param[in] endAction The action to perform when the animation ends.
- * @param[in] destroyAction The action to perform when the animation ends.
- * @param[in] alpha The default alpha function to apply to animators.
- * @return A smart-pointer to the newly allocated Animation.
+ * @copydoc Dali::Animation::GetDuration()
*/
- static AnimationPtr New(float durationSeconds, EndAction endAction, EndAction destroyAction, AlphaFunction alpha);
+ float GetDuration() const;
/**
- * Set the duration of an animation.
- * @pre durationSeconds must be greater than zero.
- * @param[in] seconds The duration in seconds.
+ * @copydoc Dali::Animation::SetLooping()
*/
- void SetDuration(float seconds);
+ void SetLooping(bool on);
/**
- * Retrieve the duration of an animation.
- * @return The duration in seconds.
+ * @copydoc Dali::Animation::SetLoopCount()
*/
- float GetDuration() const;
+ void SetLoopCount(int count);
+
+ /**
+ * @copydoc Dali::Animation::GetLoopCount()
+ */
+ int GetLoopCount();
/**
- * Set whether the animation will loop.
- * @param[in] looping True if the animation will loop.
+ * @copydoc Dali::Animation::GetCurrentLoop()
*/
- void SetLooping(bool looping);
+ int GetCurrentLoop();
/**
- * Query whether the animation will loop.
- * @return True if the animation will loop.
+ * @copydoc Dali::Animation::IsLooping()
*/
bool IsLooping() const;
/**
- * Set the end action of the animation.
- * @param[in] action The end action.
+ * @copydoc Dali::Animation::SetEndAction()
*/
void SetEndAction(EndAction action);
/**
- * Returns the end action of the animation.
+ * @copydoc Dali::Animation::GetEndAction()
*/
EndAction GetEndAction() const;
/**
- * Set the destroy action of the animation.
- * @param[in] action The destroy action.
+ * @copydoc Dali::Animation::SetDisconnectAction()
*/
- void SetDestroyAction(EndAction action);
+ void SetDisconnectAction(EndAction action);
/**
- * Returns the destroy action of the animation.
+ * @copydoc Dali::Animation::GetDisconnectAction()
*/
- EndAction GetDestroyAction() const;
+ EndAction GetDisconnectAction() const;
/**
- * Set the default alpha function for an animation.
- * This is applied to individual property animations, if no further alpha functions are supplied.
- * @param[in] alpha The default alpha function.
+ * @copydoc Dali::Animation::SetDefaultAlphaFunction()
*/
void SetDefaultAlphaFunction(AlphaFunction alpha)
{
}
/**
- * Retrieve the default alpha function for an animation.
- * @return The default alpha function.
+ * @copydoc Dali::Animation::GetDefaultAlphaFunction()
*/
AlphaFunction GetDefaultAlphaFunction() const
{
}
/**
- * (Re)start the animation.
+ * @copydoc Dali::Animation::Play()
*/
void Play();
/**
- * Pause the animation.
+ * @copydoc Dali::Animation::PlayFrom()
+ */
+ void PlayFrom( float progress );
+
+ /**
+ * @copydoc Dali::Animation::Pause()
*/
void Pause();
/**
- * Stop the animation.
+ * @copydoc Dali::Animation::GetState()
+ */
+ Dali::Animation::State GetState() const;
+
+ /**
+ * @copydoc Dali::Animation::Stop()
*/
void Stop();
/**
- * Clear the animation.
- * This disconnects any objects that were being animated, effectively stopping the animation.
+ * @copydoc Dali::Animation::Clear()
*/
void Clear();
/**
* @copydoc Dali::Animation::FinishedSignal()
*/
- Dali::Animation::AnimationSignalV2& FinishedSignal();
+ Dali::Animation::AnimationSignalType& FinishedSignal();
/**
* Emit the Finished signal
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action was done
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
/**
* This callback is intended for internal use only, to avoid the overhead of using a signal.
* @param [in] alpha The alpha function to apply.
* @param [in] period The effect will occur during this time period.
*/
- void AnimateTo(ProxyObject& targetObject, Property::Index targetPropertyIndex, int componentIndex, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period);
-
+ void AnimateTo(Object& targetObject, Property::Index targetPropertyIndex, int componentIndex, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period);
/**
- * Animate a property between the keyframe time / value pairs.
- * It uses the current duration of the animation to run the key
- * frame animator. Note, If the animation duration is subsequently
- * changed, this does not change to match.
- *
- * @param[in] target The target object + property to animate
- * @param[in] keyFrames The set of time / value pairs between which to animate.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames)
*/
void AnimateBetween(Property target, const KeyFrames& keyFrames);
/**
- * Animate a property between the keyframe time / value pairs.
- * @param[in] target The target object + property to animate
- * @param[in] keyFrames The set of time / value pairs between which to animate.
- * @param[in] period The effect will occur duing this time period.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period);
-
- /**
- * Animate a property between the keyframe time / value pairs.
- * @param[in] target The target object + property to animate
- * @param[in] keyFrames The set of time / value pairs between which to animate.
- * @param[in] alpha The alpha function to apply to the overall progress.
- */
- void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, Interpolation interpolation );
/**
- * Animate a property between the keyframe time / value pairs.
- * @param[in] target The target object + property to animate
- * @param[in] keyFrames The set of time / value pairs between which to animate.
- * @param[in] alpha The alpha function to apply to the overall progress.
- * @param[in] period The effect will occur duing this time period.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
-
- /**
- * @copydoc Dali::Animation::Animate( Property target, Property::Type targetType, AnyFunction func )
- */
- void Animate( Property& target, Property::Type targetType, AnyFunction& func );
-
- /**
- * @copydoc Dali::Animation::Animate(Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha )
- */
- void Animate( Property& target, Property::Type targetType, AnyFunction& func, AlphaFunction& alpha );
-
- /**
- * @copydoc Dali::Animation::Animate(Property target, Property::Type targetType, AnyFunction func, TimePeriod period)
- */
- void Animate( Property& target, Property::Type targetType, AnyFunction& func, TimePeriod period );
-
- /**
- * @copydoc Dali::Animation::Animate(Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha, TimePeriod period)
- */
- void Animate( Property& target, Property::Type targetType, AnyFunction& func, AlphaFunction& alpha, TimePeriod period );
-
- // Action-specific convenience functions
-
- /**
- * Translate an actor.
- * The default alpha function will be used.
- * The translation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] x Translation in the X-direction.
- * @param [in] y Translation in the Y-direction.
- * @param [in] z Translation in the Z-direction.
- */
- void MoveBy(Actor& actor, float x, float y, float z);
-
- /**
- * Translate an actor. This overload allows the alpha function to be customized.
- * The translation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] translation The translation.
- * @param [in] alpha The alpha function to apply.
- */
- void MoveBy(Actor& actor, const Vector3& translation, AlphaFunction alpha);
-
- /**
- * Translate an actor. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] translation The translation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void MoveBy(Actor& actor, const Vector3& translation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Translate an actor to a target position.
- * The default alpha function will be used.
- * The translation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] x Translation in the X-direction.
- * @param [in] y Translation in the Y-direction.
- * @param [in] z Translation in the Z-direction.
- */
- void MoveTo(Actor& actor, float x, float y, float z);
-
- /**
- * Translate an actor to a target position. This overload allows the alpha function to be customized.
- * The translation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] translation The translation.
- * @param [in] alpha The alpha function to apply.
- */
- void MoveTo(Actor& actor, const Vector3& translation, AlphaFunction alpha);
-
- /**
- * Translate an actor to a target position. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] translation The translation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void MoveTo(Actor& actor, const Vector3& translation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Translate an actor using a custom function.
- * The animatorFunc will be called from the rendering thread; it should return quickly, to avoid performance degredation.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
- * @param [in] actor The actor to animate.
- * @param [in] func The function to call during the animation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void Move(Actor& actor, AnimatorFunctionVector3 func, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Rotate an actor around an arbitrary axis.
- * The default alpha function will be used.
- * The rotation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] angle The angle in radians.
- * @param [in] axis The axis of rotation.
- */
- void RotateBy(Actor& actor, Radian angle, const Vector3& axis);
-
- /**
- * Rotate an actor around an arbitrary axis. This overload allows the alpha function to be customized.
- * The rotation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] angle The angle in radians.
- * @param [in] axis The axis of rotation.
- * @param [in] alpha The alpha function to apply.
- */
- void RotateBy(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha);
-
- /**
- * Rotate an actor around an arbitrary axis. This overload allows the rotation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
- * @param [in] actor The actor to animate.
- * @param [in] angle The angle in radians.
- * @param [in] axis The axis of rotation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the rotation.
- */
- void RotateBy(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Rotate an actor to a target orientation.
- * The default alpha function will be used.
- * The rotation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] angle The target rotation angle in radians.
- * @param [in] axis The target axis of rotation.
- */
- void RotateTo(Actor& actor, Radian angle, const Vector3& axis);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period);
/**
- * Rotate an actor to a target orientation.
- * The default alpha function will be used.
- * The rotation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] orientation The target orientation.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
*/
- void RotateTo(Actor& actor, const Quaternion& orientation);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation);
/**
- * Rotate an actor to a target orientation. This overload allows the alpha function to be customized.
- * The rotation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] angle The target rotation angle in radians.
- * @param [in] axis The target axis of rotation.
- * @param [in] alpha The alpha function to apply.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
*/
- void RotateTo(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha);
/**
- * Rotate an actor to a target orientation. This overload allows the alpha function to be customized.
- * The rotation will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] orientation The target orientation.
- * @param [in] alpha The alpha function to apply.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
*/
- void RotateTo(Actor& actor, const Quaternion& orientation, AlphaFunction alpha);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation);
/**
- * Rotate an actor to a target orientation. This overload allows the rotation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] orientation The target orientation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the rotation.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
*/
- void RotateTo(Actor& actor, const Quaternion& orientation, AlphaFunction alpha, float delaySeconds, float durationSeconds);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
/**
- * Rotate an actor to a target orientation. This overload allows the rotation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] angle The target rotation angle in radians.
- * @param [in] axis The target axis of rotation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the rotation.
+ * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation )
*/
- void RotateTo(Actor& actor, Radian angle, const Vector3& axis, AlphaFunction alpha, float delaySeconds, float durationSeconds);
+ void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation );
- /**
- * Rotate an actor using a custom function.
- * The animatorFunc will be called from the rendering thread; it should return quickly, to avoid performance degredation.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
- * @param [in] actor The actor to animate.
- * @param [in] func The function to call during the animation.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void Rotate(Actor& actor, AnimatorFunctionQuaternion func, AlphaFunction alpha, float delaySeconds, float durationSeconds);
+ // Actor-specific convenience functions
/**
- * Scale an actor.
- * The default alpha function will be used.
- * The scaling will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] x Scale factor in the X-direction.
- * @param [in] y Scale factor in the Y-direction.
- * @param [in] z Scale factor in the Z-direction.
+ * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward )
*/
- void ScaleBy(Actor& actor, float x, float y, float z);
+ void Animate( Actor& actor, const Path& path, const Vector3& forward );
/**
- * Scale an actor. This overload allows the alpha function to be customized.
- * The scaling will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] scale The scale factor.
- * @param [in] alpha The alpha function to apply.
+ * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
*/
- void ScaleBy(Actor& actor, const Vector3& scale, AlphaFunction alpha);
+ void Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha );
/**
- * Scale an actor. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] scale The scale factor.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
+ * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
*/
- void ScaleBy(Actor& actor, const Vector3& scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
+ void Animate( Actor& actor, const Path& path, const Vector3& forward, TimePeriod period );
/**
- * Scale an actor to a target scale factor.
- * The default alpha function will be used.
- * The scaling will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] x Target scale-factor in the X-direction.
- * @param [in] y Target scale-factor in the Y-direction.
- * @param [in] z Target scale-factor in the Z-direction.
+ * @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
*/
- void ScaleTo(Actor& actor, float x, float y, float z);
+ void Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha, TimePeriod period);
/**
- * Scale an actor to a target scale factor. This overload allows the alpha function to be customized.
- * The scaling will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] scale The target scale factor.
- * @param [in] alpha The alpha function to apply.
- */
- void ScaleTo(Actor& actor, const Vector3& scale, AlphaFunction alpha);
-
- /**
- * Scale an actor to a target scale factor. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] scale The target scale factor.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void ScaleTo(Actor& actor, const Vector3& scale, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Show an actor during the animation.
- * @param [in] actor The actor to animate.
- * @param [in] delaySeconds The initial delay from the start of the animation.
+ * @copydoc Dali::Animation::Show()
*/
void Show(Actor& actor, float delaySeconds);
/**
- * Hide an actor during the animation.
- * @param [in] actor The actor to animate.
- * @param [in] delaySeconds The initial delay from the start of the animation.
+ * @copydoc Dali::Animation::Hide()
*/
void Hide(Actor& actor, float delaySeconds);
- /**
- * Animate the opacity of an actor.
- * The default alpha function will be used.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] opacity The relative change in opacity.
- */
- void OpacityBy(Actor& actor, float opacity);
-
- /**
- * Animate the opacity of an actor. This overload allows the alpha function to be customized.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] opacity The relative change in opacity.
- * @param [in] alpha The alpha function to apply.
- */
- void OpacityBy(Actor& actor, float opacity, AlphaFunction alpha);
-
- /**
- * Animate the opacity of an actor. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] opacity The relative change in opacity.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void OpacityBy(Actor& actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Animate an actor to a target opacity.
- * The default alpha function will be used.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] opacity The target opacity.
- */
- void OpacityTo(Actor& actor, float opacity);
-
- /**
- * Animate an actor to a target opacity. This overload allows the alpha function to be customized.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] opacity The target opacity.
- * @param [in] alpha The alpha function to apply.
- */
- void OpacityTo(Actor& actor, float opacity, AlphaFunction alpha);
-
- /**
- * Animate an actor to a target opacity. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] opacity The target opacity.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void OpacityTo(Actor& actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Animate the color of an actor.
- * The default alpha function will be used.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] color The relative change in color.
+ /*
+ * @copydoc Dali::Animation::SetCurrentProgress()
*/
- void ColorBy(Actor& actor, const Vector4& color);
+ void SetCurrentProgress(float progress);
- /**
- * Animate the color of an actor. This overload allows the alpha function to be customized.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] color The relative change in color.
- * @param [in] alpha The alpha function to apply.
- */
- void ColorBy(Actor& actor, const Vector4& color, AlphaFunction alpha);
-
- /**
- * Animate the color of an actor. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
- * @param [in] actor The actor to animate.
- * @param [in] color The relative change in color.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
+ /*
+ * @copydoc Dali::Animation::GetCurrentProgress()
*/
- void ColorBy(Actor& actor, const Vector4& color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
+ float GetCurrentProgress();
- /**
- * Animate an actor to a target color.
- * The default alpha function will be used.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] color The target color.
+ /*
+ * @copydoc Dali::Animation::SetSpeedFactor()
*/
- void ColorTo(Actor& actor, const Vector4& color);
+ void SetSpeedFactor( float factor );
- /**
- * Animate an actor to a target color. This overload allows the alpha function to be customized.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] color The target color.
- * @param [in] alpha The alpha function to apply.
+ /*
+ * @copydoc Dali::Animation::GetSpeedFactor()
*/
- void ColorTo(Actor& actor, const Vector4& color, AlphaFunction alpha);
+ float GetSpeedFactor() const;
- /**
- * Animate an actor to a target color. This overload allows the translation start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be zero or greater; zero is useful when animating boolean values.
- * @param [in] actor The actor to animate.
- * @param [in] color The target color.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
+ /*
+ * @copydoc Dali::Animation::SetPlayRange()
*/
- void ColorTo(Actor& actor, const Vector4& color, AlphaFunction alpha, float delaySeconds, float durationSeconds);
+ void SetPlayRange( const Vector2& range );
- /**
- * Resize an actor.
- * The default alpha function will be used.
- * The resizing will start & end when the animation begins & ends.
- * The depth defaults to the minimum of width & height.
- * @param [in] actor The actor to animate.
- * @param [in] width The target width.
- * @param [in] height The target height.
+ /*
+ * @copydoc Dali::Animation::GetPlayRange
*/
- void Resize(Actor& actor, float width, float height);
-
- /**
- * Resize an actor. This overload allows the alpha function to be customized.
- * The resizing will start & end when the animation begins & ends.
- * The depth defaults to the minimum of width & height.
- * @param [in] actor The actor to animate.
- * @param [in] width The target width.
- * @param [in] height The target height.
- * @param [in] alpha The alpha function to apply.
- */
- void Resize(Actor& actor, float width, float height, AlphaFunction alpha);
-
- /**
- * Resize an actor. This overload allows the resizing start & end time to be customized.
- * The depth defaults to the minimum of width & height.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] width The target width.
- * @param [in] height The target height.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void Resize(Actor& actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Resize an actor.
- * The default alpha function will be used.
- * The resizing will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] size The target size.
- */
- void Resize(Actor& actor, const Vector3& size);
-
- /**
- * Resize an actor. This overload allows the alpha function to be customized.
- * The resizing will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] size The target size.
- * @param [in] alpha The alpha function to apply.
- */
- void Resize(Actor& actor, const Vector3& size, AlphaFunction alpha);
-
- /**
- * Resize an actor. This overload allows the resizing start & end time to be customized.
- * @pre delaySeconds must be zero or greater.
- * @pre durationSeconds must be greater than zero.
- * @param [in] actor The actor to animate.
- * @param [in] size The target size.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the animation.
- * @param [in] durationSeconds The duration of the translation.
- */
- void Resize(Actor& actor, const Vector3& size, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Animate the parent-origin of an actor.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] parentOrigin The target value.
- */
- void ParentOriginTo(Actor& actor, const Vector3& parentOrigin);
-
- /**
- * Animate the parent-origin of an actor.
- * This overload allows the alpha function to be customized.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] parentOrigin The target value.
- * @param [in] alpha The alpha function to apply.
- */
- void ParentOriginTo(Actor& actor, const Vector3& parentOrigin, AlphaFunction alpha);
-
- /**
- * Animate the parent-origin of an actor.
- * This overload allows the start & end time to be customized.
- * @pre delaySeconds & durationSeconds must be zero or greater.
- * @param [in] actor The actor to animate.
- * @param [in] parentOrigin The target value.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the effect.
- * @param [in] durationSeconds The duration of the effect.
- */
- void ParentOriginTo(Actor& actor, const Vector3& parentOrigin, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * Animate the anchor-point of an actor.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] anchorPoint The target value.
- */
- void AnchorPointTo(Actor& actor, const Vector3& anchorPoint);
-
- /**
- * Animate the anchor-point of an actor.
- * This overload allows the alpha function to be customized.
- * The effect will start & end when the animation begins & ends.
- * @param [in] actor The actor to animate.
- * @param [in] anchorPoint The target value.
- * @param [in] alpha The alpha function to apply.
- */
- void AnchorPointTo(Actor& actor, const Vector3& anchorPoint, AlphaFunction alpha);
-
- /**
- * Animate the anchor-point of an actor.
- * This overload allows the start & end time to be customized.
- * @pre delaySeconds & durationSeconds must be zero or greater.
- * @param [in] actor The actor to animate.
- * @param [in] anchorPoint The target value.
- * @param [in] alpha The alpha function to apply.
- * @param [in] delaySeconds The initial delay from the start of the effect.
- * @param [in] durationSeconds The duration of the effect.
- */
- void AnchorPointTo(Actor& actor, const Vector3& anchorPoint, AlphaFunction alpha, float delaySeconds, float durationSeconds);
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, float value)
- */
- void AnimateProperty( Internal::ShaderEffect& shaderEffect, const std::string& name, float value );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, float value, AlphaFunction alpha)
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, float value, AlphaFunction alpha );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, float value, AlphaFunction alpha, float delaySeconds, float durationSeconds)
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, float value, AlphaFunction alpha, float delaySeconds, float durationSeconds );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector2 value )
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector2 value );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector2 value, AlphaFunction alpha )
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector2 value, AlphaFunction alpha );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector2 value, AlphaFunction alpha, float delaySeconds, float durationSeconds)
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector2 value, AlphaFunction alpha, float delaySeconds, float durationSeconds );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector3 value )
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector3 value );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector3 value, AlphaFunction alpha )
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector3 value, AlphaFunction alpha );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector3 value, AlphaFunction alpha, float delaySeconds, float durationSeconds )
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector3 value, AlphaFunction alpha, float delaySeconds, float durationSeconds );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector4 value )
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector4 value );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector4 value, AlphaFunction alpha)
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector4 value, AlphaFunction alpha );
-
- /**
- * @copydoc Dali::Animation::AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector4 value, AlphaFunction alpha, float delaySeconds, float durationSeconds)
- */
- void AnimateProperty( ShaderEffect& shaderEffect, const std::string& name, Vector4 value, AlphaFunction alpha, float delaySeconds, float durationSeconds );
+ Vector2 GetPlayRange() const;
public: // For connecting animators to animations
}
/**
- * Retrieve the UpdateManager associated with this animation.
- * @return The UpdateManager.
+ * Retrieve the event thread services object
+ * @return The interface for sending messages to the scene graph
*/
- SceneGraph::UpdateManager& GetUpdateManager()
+ EventThreadServices& GetEventThreadServices()
{
- return mUpdateManager;
+ return mEventThreadServices;
}
protected:
/**
* Construct a new Animation.
- * @param[in] updateManager The UpdateManager associated with this animation.
+ * @param[in] eventThreadServices The interface for sending messages to the scene graph
* @param[in] playlist The list of currently playing animations.
* @param[in] durationSeconds The duration of the animation in seconds.
* @param[in] endAction The action to perform when the animation ends.
- * @param[in] destroyAction The action to perform when the animation is destroyed.
+ * @param[in] disconnectAction The action to perform when the property owner of an animator is disconnected.
* @param[in] defaultAlpha The default alpha function to apply to animators.
*/
- Animation( SceneGraph::UpdateManager& updateManager,
+ Animation( EventThreadServices& eventThreadServices,
AnimationPlaylist& playlist,
float durationSeconds,
EndAction endAction,
- EndAction destroyAction,
+ EndAction disconnectAction,
AlphaFunction defaultAlpha);
/**
private:
+ /**
+ * Extends the duration when an animator is added with TimePeriod that exceeds current duration.
+ * @param[in] timePeriod The time period for an animator.
+ */
+ void ExtendDuration( const TimePeriod& timePeriod );
+
// Undefined
Animation(const Animation&);
Animation& operator=(const Animation& rhs);
private:
-
- SceneGraph::UpdateManager& mUpdateManager;
+ EventThreadServices& mEventThreadServices;
AnimationPlaylist& mPlaylist;
const SceneGraph::Animation* mAnimation;
int mNotificationCount; ///< Keep track of how many Finished signals have been emitted.
- Dali::Animation::AnimationSignalV2 mFinishedSignal;
+ Dali::Animation::AnimationSignalType mFinishedSignal;
FinishedCallback mFinishedCallback;
Object* mFinishedCallbackObject;
// Cached for public getters
float mDurationSeconds;
- bool mIsLooping;
+ float mSpeedFactor;
+ int mLoopCount;
+ int mCurrentLoop;
+ Vector2 mPlayRange;
EndAction mEndAction;
- EndAction mDestroyAction;
+ EndAction mDisconnectAction;
AlphaFunction mDefaultAlpha;
+ Dali::Animation::State mState;
};