#define DALI_INTERNAL_ANIMATION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/object/ref-object.h>
-#include <dali/public-api/animation/animation.h>
-#include <dali/public-api/object/base-object.h>
#include <dali/devel-api/animation/animation-devel.h>
#include <dali/devel-api/common/owner-container.h>
-#include <dali/internal/event/animation/key-frames-impl.h>
#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/animation/key-frames.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/ref-object.h>
namespace Dali
{
-
namespace Internal
{
-
namespace SceneGraph
{
class Animation;
class UpdateManager;
-}
+} // namespace SceneGraph
class Actor;
class Animation;
/**
* @copydoc Dali::DevelAnimation::SetProgressNotification()
*/
- void SetProgressNotification( float progress );
+ void SetProgressNotification(float progress);
/**
* @copydoc Dali::DevelAnimation::GetProgressNotification()
/**
* @copydoc Dali::Animation::PlayFrom()
*/
- void PlayFrom( float progress );
+ void PlayFrom(float progress);
/**
* @copydoc Dali::Animation::PlayAfter()
*/
- void PlayAfter( float delaySeconds );
+ void PlayAfter(float delaySeconds);
/**
* @copydoc Dali::Animation::Pause()
* @return True if the signal was connected.
* @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
*/
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
/**
* Performs actions as requested using the action name.
void AnimateTo(Property& target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames);
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, Interpolation interpolation)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, Interpolation interpolation );
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, Interpolation interpolation);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, TimePeriod period)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period);
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, TimePeriod period);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, TimePeriod period, Interpolation interpolation)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation);
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, TimePeriod period, Interpolation interpolation);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha);
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha, Interpolation interpolation)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation);
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha, Interpolation interpolation);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period)
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period);
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period);
/**
- * @copydoc Dali::Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation )
+ * @copydoc Dali::Animation::AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation )
*/
- void AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation );
+ void AnimateBetween(Property target, Dali::KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation);
// Actor-specific convenience functions
/**
* @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward )
*/
- void Animate( Actor& actor, const Path& path, const Vector3& forward );
+ void Animate(Actor& actor, const Path& path, const Vector3& forward);
/**
* @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
*/
- void Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha );
+ void Animate(Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha);
/**
* @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
*/
- void Animate( Actor& actor, const Path& path, const Vector3& forward, TimePeriod period );
+ void Animate(Actor& actor, const Path& path, const Vector3& forward, TimePeriod period);
/**
* @copydoc Dali::Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
*/
- void Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha, TimePeriod period);
+ void Animate(Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha, TimePeriod period);
/**
* @copydoc Dali::Animation::Show()
/**
* @copydoc Dali::Animation::SetSpeedFactor()
*/
- void SetSpeedFactor( float factor );
+ void SetSpeedFactor(float factor);
/**
* @copydoc Dali::Animation::GetSpeedFactor()
/**
* @copydoc Dali::Animation::SetPlayRange()
*/
- void SetPlayRange( const Vector2& range );
+ void SetPlayRange(const Vector2& range);
/**
* @copydoc Dali::Animation::GetPlayRange()
Vector2 GetPlayRange() const;
/**
+ * @copydoc Dali::Animation::SetBlendPoint()
+ */
+ void SetBlendPoint(float blendPoint);
+
+ /**
+ * @copydoc Dali::Animation::GetBlendPoint()
+ */
+ float GetBlendPoint() const;
+
+ /**
* @copydoc Dali::Animation::SetLoopingMode()
*/
- void SetLoopingMode( Dali::Animation::LoopingMode loopingMode );
+ void SetLoopingMode(Dali::Animation::LoopingMode loopingMode);
/**
* @copydoc Dali::Animation::GetLoopingMode()
Dali::Animation::LoopingMode GetLoopingMode() const;
public: // For connecting animators to animations
-
/**
* Add an animator connector.
* @param[in] connector The animator connector.
*/
- void AddAnimatorConnector( AnimatorConnectorBase* connector );
+ void AddAnimatorConnector(AnimatorConnectorBase* connector);
/**
* Retrieve the SceneGraph::Animation object.
}
protected:
-
/**
* Construct a new Animation.
* @param[in] eventThreadServices The interface for sending messages to the scene graph
* @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( EventThreadServices& eventThreadServices,
- AnimationPlaylist& playlist,
- float durationSeconds,
- EndAction endAction,
- EndAction disconnectAction,
- AlphaFunction defaultAlpha);
+ Animation(EventThreadServices& eventThreadServices,
+ AnimationPlaylist& playlist,
+ float durationSeconds,
+ EndAction endAction,
+ EndAction disconnectAction,
+ AlphaFunction defaultAlpha);
/**
* Second-phase constructor.
~Animation() override;
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 );
+ void ExtendDuration(const TimePeriod& timePeriod);
// Undefined
Animation(const Animation&);
Animation& operator=(const Animation& rhs);
private:
-
struct ConnectorTargetValues
{
ConnectorTargetValues() = default;
{
}
+ // Move operations
+ ConnectorTargetValues(ConnectorTargetValues&& rhs) noexcept
+ : targetValue(std::move(rhs.targetValue)),
+ timePeriod(std::move(rhs.timePeriod)),
+ connectorIndex(rhs.connectorIndex),
+ animatorType(rhs.animatorType)
+ {
+ }
+
+ ConnectorTargetValues& operator=(ConnectorTargetValues&& rhs) noexcept
+ {
+ targetValue = std::move(rhs.targetValue);
+ timePeriod = std::move(rhs.timePeriod);
+ connectorIndex = rhs.connectorIndex;
+ animatorType = rhs.animatorType;
+ return *this;
+ }
+
Property::Value targetValue;
TimePeriod timePeriod{0.f};
std::size_t connectorIndex{0};
};
private:
-
/**
* Compares the end times of the animators returning true if lhs end time is less than rhs end time.
* @param[in] lhs The first comparator
* @param[in] rhs The second comparator
* @return True if end time of lhs is less, false otherwise.
*/
- static bool CompareConnectorEndTimes( const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs );
+ static bool CompareConnectorEndTimes(const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs);
/**
* Notifies all the objects whose properties are being animated.
* @param[in] notifyValueType Whether we should set the current or target value
*/
- void NotifyObjects( Notify notifyValueType );
+ void NotifyObjects(Notify notifyValueType);
/**
* Sends message to SceneGraph with final progress value
*/
void SendFinalProgressNotificationMessage();
+ /**
+ * @brief Append ConnectorTargetValues into the container.
+ *
+ * @param[in] connectorTargetValues moved ConnectorTargetValues that will be append end of container
+ */
+ void AppendConnectorTargetValues(ConnectorTargetValues&& connectorTargetValues);
+
private:
using AnimatorConnectorContainer = OwnerContainer<AnimatorConnectorBase*>;
using ConnectorTargetValuesContainer = std::vector<ConnectorTargetValues>;
- const SceneGraph::Animation* mAnimation{ nullptr };
+ const SceneGraph::Animation* mAnimation{nullptr};
EventThreadServices& mEventThreadServices;
AnimationPlaylist& mPlaylist;
AlphaFunction mDefaultAlpha;
Vector2 mPlayRange{0.0f, 1.0f};
+ float mBlendPoint{0.0f};
float mDurationSeconds;
float mSpeedFactor{1.0f};
int32_t mNotificationCount{0}; ///< Keep track of how many Finished signals have been emitted.
EndAction mEndAction;
EndAction mDisconnectAction;
Dali::Animation::State mState{Dali::Animation::STOPPED};
- bool mAutoReverseEnabled{false}; ///< Flag to identify that the looping mode is auto reverse.
+ bool mAutoReverseEnabled{false}; ///< Flag to identify that the looping mode is auto reverse.
+ bool mConnectorTargetValuesSortRequired{false}; ///< Flag to whether we need to sort mConnectorTargetValues or not
};
} // namespace Internal
inline Internal::Animation& GetImplementation(Dali::Animation& animation)
{
- DALI_ASSERT_ALWAYS( animation && "Animation handle is empty" );
+ DALI_ASSERT_ALWAYS(animation && "Animation handle is empty");
BaseObject& handle = animation.GetBaseObject();
inline const Internal::Animation& GetImplementation(const Dali::Animation& animation)
{
- DALI_ASSERT_ALWAYS( animation && "Animation handle is empty" );
+ DALI_ASSERT_ALWAYS(animation && "Animation handle is empty");
const BaseObject& handle = animation.GetBaseObject();