Merge "Clean up the code to build successfully on macOS" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / update / animation / scene-graph-animator.h
index b8da716..3ff3144 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H
+#define DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cmath>
+#include <functional>
+
 // INTERNAL INCLUDES
-#include <dali/devel-api/common/owner-container.h>
-#include <dali/internal/event/animation/key-frames-impl.h>
-#include <dali/internal/event/animation/path-impl.h>
-#include <dali/internal/update/nodes/node.h>
-#include <dali/internal/update/common/property-base.h>
 #include <dali/public-api/animation/alpha-function.h>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/animation/time-period.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/math/quaternion.h>
 #include <dali/public-api/math/radian.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <dali/internal/event/animation/key-frames-impl.h>
+#include <dali/internal/event/animation/path-impl.h>
+#include <dali/internal/update/nodes/node.h>
+#include <dali/internal/update/common/property-base.h>
 #include <dali/internal/update/animation/property-accessor.h>
 #include <dali/integration-api/debug.h>
 
@@ -40,29 +44,21 @@ namespace Dali
 namespace Internal
 {
 
-typedef Dali::Animation::Interpolation Interpolation;
+using Interpolation = Dali::Animation::Interpolation;
 
-struct AnimatorFunctionBase;
 
 namespace SceneGraph
 {
 
-class AnimatorBase;
-
-typedef OwnerContainer< AnimatorBase* > AnimatorContainer;
-
-typedef AnimatorContainer::Iterator AnimatorIter;
-typedef AnimatorContainer::ConstIterator AnimatorConstIter;
-
 /**
  * An abstract base class for Animators, which can be added to scene graph animations.
  * Each animator changes a single property of an object in the scene graph.
  */
-class AnimatorBase
+class AnimatorBase : public PropertyOwner::Observer
 {
 public:
 
-  typedef float (*AlphaFunc)(float progress); ///< Definition of an alpha function
+  using AlphaFunc = float (*)(float progress); ///< Definition of an alpha function
 
   /**
    * Observer to determine when the animator is no longer present
@@ -86,17 +82,20 @@ public:
   /**
    * Constructor.
    */
-  AnimatorBase()
-  : mLifecycleObserver(nullptr),
-    mDurationSeconds(1.0f),
-    mIntervalDelaySeconds(0.0f),
-    mSpeedFactor(1.0f),
-    mLoopCount(1),
-    mAlphaFunction(AlphaFunction::DEFAULT),
-    mDisconnectAction(Dali::Animation::BakeFinal),
-    mActive(false),
-    mEnabled(true),
-    mConnectedToSceneGraph(false),
+  AnimatorBase( PropertyOwner* propertyOwner,
+                AlphaFunction alphaFunction,
+                const TimePeriod& timePeriod )
+  : mLifecycleObserver( nullptr ),
+    mPropertyOwner( propertyOwner ),
+    mDurationSeconds( timePeriod.durationSeconds ),
+    mIntervalDelaySeconds( timePeriod.delaySeconds ),
+    mSpeedFactor( 1.0f ),
+    mCurrentProgress( 0.f ),
+    mAlphaFunction( alphaFunction ),
+    mDisconnectAction( Dali::Animation::BAKE_FINAL ),
+    mAnimationPlaying( false ),
+    mEnabled( true ),
+    mConnectedToSceneGraph( false ),
     mAutoReverseEnabled( false )
   {
   }
@@ -104,8 +103,12 @@ public:
   /**
    * Virtual destructor.
    */
-  virtual ~AnimatorBase()
+  ~AnimatorBase() override
   {
+    if (mPropertyOwner && mConnectedToSceneGraph)
+    {
+      mPropertyOwner->RemoveObserver(*this);
+    }
     if( mLifecycleObserver != nullptr )
     {
       mLifecycleObserver->ObjectDestroyed();
@@ -122,10 +125,51 @@ public:
     mLifecycleObserver = nullptr;
   }
 
+private: // From PropertyOwner::Observer
+
+  /**
+   * @copydoc PropertyOwner::Observer::PropertyOwnerConnected( PropertyOwner& owner )
+   */
+  void PropertyOwnerConnected( PropertyOwner& owner ) final
+  {
+    mEnabled = true;
+  }
+
+  /**
+   * @copydoc PropertyOwner::Observer::PropertyOwnerDisconnected( BufferIndex bufferIndex, PropertyOwner& owner )
+   */
+  void PropertyOwnerDisconnected( BufferIndex bufferIndex, PropertyOwner& owner ) final
+  {
+    // If we are active, then bake the value if required
+    if ( mAnimationPlaying && mDisconnectAction != Dali::Animation::DISCARD )
+    {
+      // Bake to target-value if BakeFinal, otherwise bake current value
+      Update( bufferIndex, ( mDisconnectAction == Dali::Animation::BAKE ? mCurrentProgress : 1.0f ), true );
+    }
+
+    mEnabled = false;
+  }
+
+  /**
+   * @copydoc PropertyOwner::Observer::PropertyOwnerDestroyed( PropertyOwner& owner )
+   */
+  void PropertyOwnerDestroyed( PropertyOwner& owner ) final
+  {
+    mPropertyOwner = nullptr;
+  }
+
+public:
   /**
    * Called when Animator is added to the scene-graph in update-thread.
    */
-  virtual void ConnectToSceneGraph() = 0;
+  void ConnectToSceneGraph()
+  {
+    mConnectedToSceneGraph = true;
+    mPropertyOwner->AddObserver(*this);
+
+    // Enable if the target object is valid and connected to the scene graph.
+    mEnabled = mPropertyOwner->IsAnimationPossible();
+  }
 
   /**
    * Set the duration of the animator.
@@ -153,7 +197,7 @@ public:
     mSpeedFactor = factor;
   }
 
-  void SetLoopCount(int loopCount)
+  void SetLoopCount(int32_t loopCount)
   {
     mLoopCount = loopCount;
   }
@@ -329,7 +373,7 @@ public:
         float upperBound(1.0f);
         float currentT(0.5f);
         float currentX = EvaluateCubicBezier( controlPoints.x, controlPoints.z, currentT);
-        while( fabs( progress - currentX ) > tolerance )
+        while( fabsf( progress - currentX ) > tolerance )
         {
           if( progress > currentX )
           {
@@ -376,20 +420,11 @@ public:
    */
   void SetActive( bool active )
   {
-    mActive = active;
+    mAnimationPlaying = active;
   }
 
   /**
-   * Retrieve whether the animator has been set to active or not.
-   * @return The active state.
-   */
-  bool GetActive() const
-  {
-    return mActive;
-  }
-
-  /**
-   * Retrive wheter the animator's target object is valid and on the stage.
+   * Whether the animator's target object is valid and on the stage.
    * @return The enabled state.
    */
   bool IsEnabled() const
@@ -412,7 +447,10 @@ public:
    * @return True if animator is orphan, false otherwise   *
    * @note The SceneGraph::Animation will delete any orphan animator in its Update method.
    */
-  virtual bool Orphan() = 0;
+  bool Orphan()
+  {
+    return (mPropertyOwner == nullptr);
+  }
 
   /**
    * Update the scene object attached to the animator.
@@ -420,7 +458,34 @@ public:
    * @param[in] progress A value from 0 to 1, where 0 is the start of the animation, and 1 is the end point.
    * @param[in] bake Bake.
    */
-  virtual void Update(BufferIndex bufferIndex, float progress, bool bake) = 0;
+  void Update( BufferIndex bufferIndex, float progress, bool bake )
+  {
+    if( mLoopCount >= 0 )
+    {
+      // Update the progress value
+      progress = SetProgress( progress );
+    }
+
+    if( mPropertyOwner )
+    {
+      mPropertyOwner->SetUpdated( true );
+    }
+
+    float alpha = ApplyAlphaFunction( progress );
+
+    // PropertyType specific part
+    DoUpdate( bufferIndex, bake, alpha );
+
+    mCurrentProgress = progress;
+  }
+
+  /**
+   * Type specific part of the animator
+   * @param bufferIndex index to use
+   * @param bake whether to bake or not
+   * @param alpha value from alpha based on progress
+   */
+  virtual void DoUpdate( BufferIndex bufferIndex, bool bake, float alpha ) = 0;
 
 protected:
 
@@ -438,16 +503,18 @@ protected:
   }
 
   LifecycleObserver* mLifecycleObserver;
+  PropertyOwner* mPropertyOwner;
+
   float mDurationSeconds;
   float mIntervalDelaySeconds;
   float mSpeedFactor;
-
-  int mLoopCount;
+  float mCurrentProgress;
 
   AlphaFunction mAlphaFunction;
 
+  int32_t                    mLoopCount{1};
   Dali::Animation::EndAction mDisconnectAction;     ///< EndAction to apply when target object gets disconnected from the stage.
-  bool mActive:1;                                   ///< Animator is "active" while it's running.
+  bool mAnimationPlaying:1;                         ///< whether disconnect has been applied while it's running.
   bool mEnabled:1;                                  ///< Animator is "enabled" while its target object is valid and on the stage.
   bool mConnectedToSceneGraph:1;                    ///< True if ConnectToSceneGraph() has been called in update-thread.
   bool mAutoReverseEnabled:1;
@@ -456,9 +523,13 @@ protected:
 /**
  * An animator for a specific property type PropertyType.
  */
-template < typename PropertyType, typename PropertyAccessorType >
-class Animator : public AnimatorBase, public PropertyOwner::Observer
+template<typename PropertyType, typename PropertyAccessorType>
+class Animator final : public AnimatorBase
 {
+  using AnimatorFunction = std::function<PropertyType(float, const PropertyType&)>;
+
+  AnimatorFunction mAnimatorFunction;
+
 public:
 
   /**
@@ -469,96 +540,30 @@ public:
    * @param[in] timePeriod The time period of this animation.
    * @return A newly allocated animator.
    */
-  static AnimatorBase* New( const PropertyOwner& propertyOwner,
-                            const PropertyBase& property,
-                            AnimatorFunctionBase* animatorFunction,
-                            AlphaFunction alphaFunction,
-                            const TimePeriod& timePeriod )
+  static AnimatorBase* New(const PropertyOwner& propertyOwner,
+                           const PropertyBase&  property,
+                           AnimatorFunction     animatorFunction,
+                           AlphaFunction        alphaFunction,
+                           const TimePeriod&    timePeriod)
   {
-    typedef Animator< PropertyType, PropertyAccessorType > AnimatorType;
-
     // The property was const in the actor-thread, but animators are used in the scene-graph thread.
-    AnimatorType* animator = new AnimatorType( const_cast<PropertyOwner*>( &propertyOwner ),
-                                               const_cast<PropertyBase*>( &property ),
-                                               animatorFunction );
-
-    animator->SetAlphaFunction( alphaFunction );
-    animator->SetIntervalDelay( timePeriod.delaySeconds );
-    animator->SetDuration( timePeriod.durationSeconds );
-
-    return animator;
-  }
-
-  /**
-   * Virtual destructor.
-   */
-  virtual ~Animator()
-  {
-    if (mPropertyOwner && mConnectedToSceneGraph)
-    {
-      mPropertyOwner->RemoveObserver(*this);
-    }
-
-    delete mAnimatorFunction;
-  }
-
-  /**
-   * Called when Animator is added to the scene-graph in update-thread.
-   */
-  virtual void ConnectToSceneGraph()
-  {
-    mConnectedToSceneGraph = true;
-    mPropertyOwner->AddObserver(*this);
-  }
-
-  /**
-   * Called when mPropertyOwner is connected to the scene graph.
-   */
-  virtual void PropertyOwnerConnected( PropertyOwner& owner )
-  {
-    mEnabled = true;
+    return new Animator(const_cast<PropertyOwner*>(&propertyOwner),
+                        const_cast<PropertyBase*>(&property),
+                        std::move(animatorFunction),
+                        alphaFunction,
+                        timePeriod);
   }
 
   /**
-   * Called when mPropertyOwner is disconnected from the scene graph.
+   * @copydoc AnimatorBase::DoUpdate( BufferIndex bufferIndex, bool bake, float alpha )
    */
-  virtual void PropertyOwnerDisconnected( BufferIndex bufferIndex, PropertyOwner& owner )
+  void DoUpdate( BufferIndex bufferIndex, bool bake, float alpha ) final
   {
-    // If we are active, then bake the value if required
-    if ( mActive && mDisconnectAction != Dali::Animation::Discard )
-    {
-      // Bake to target-value if BakeFinal, otherwise bake current value
-      Update( bufferIndex, ( mDisconnectAction == Dali::Animation::Bake ? mCurrentProgress : 1.0f ), true );
-    }
-
-    mActive = false;
-    mEnabled = false;
-  }
-
-  /**
-   * Called shortly before mPropertyOwner is destroyed
-   */
-  virtual void PropertyOwnerDestroyed( PropertyOwner& owner )
-  {
-    mPropertyOwner = NULL;
-  }
-
-  /**
-   * From AnimatorBase.
-   */
-  virtual void Update( BufferIndex bufferIndex, float progress, bool bake )
-  {
-    if( mLoopCount >= 0 )
-    {
-      // Update the progress value
-      progress = SetProgress( progress );
-    }
-
-    float alpha = ApplyAlphaFunction( progress );
-
     const PropertyType& current = mPropertyAccessor.Get( bufferIndex );
 
-    const PropertyType result = (*mAnimatorFunction)( alpha, current );
+    // need to cast the return value in case property is integer
+    const PropertyType result = static_cast<PropertyType>(mAnimatorFunction(alpha, current));
+
     if ( bake )
     {
       mPropertyAccessor.Bake( bufferIndex, result );
@@ -567,16 +572,6 @@ public:
     {
       mPropertyAccessor.Set( bufferIndex, result );
     }
-
-    mCurrentProgress = progress;
-  }
-
-  /**
-   * From AnimatorBase.
-   */
-  virtual bool Orphan()
-  {
-    return (mPropertyOwner == NULL);
   }
 
 private:
@@ -584,13 +579,14 @@ private:
   /**
    * Private constructor; see also Animator::New().
    */
-  Animator( PropertyOwner* propertyOwner,
-            PropertyBase* property,
-            AnimatorFunctionBase* animatorFunction )
-  : mPropertyOwner( propertyOwner ),
-    mPropertyAccessor( property ),
-    mAnimatorFunction( animatorFunction ),
-    mCurrentProgress( 0.0f )
+  Animator(PropertyOwner*    propertyOwner,
+           PropertyBase*     property,
+           AnimatorFunction  animatorFunction,
+           AlphaFunction     alphaFunction,
+           const TimePeriod& timePeriod)
+  : AnimatorBase(propertyOwner, alphaFunction, timePeriod),
+    mAnimatorFunction(std::move(animatorFunction)),
+    mPropertyAccessor(property)
   {
     // WARNING - this object is created in the event-thread
     // The scene-graph mPropertyOwner object cannot be observed here
@@ -604,11 +600,8 @@ private:
 
 protected:
 
-  PropertyOwner* mPropertyOwner;
   PropertyAccessorType mPropertyAccessor;
 
-  AnimatorFunctionBase* mAnimatorFunction;
-  float mCurrentProgress;
 };
 
 
@@ -616,9 +609,13 @@ protected:
 /**
  * An animator for a specific property type PropertyType.
  */
-template <typename T, typename PropertyAccessorType>
-class AnimatorTransformProperty : public AnimatorBase, public PropertyOwner::Observer
+template<typename PropertyType, typename PropertyAccessorType>
+class AnimatorTransformProperty final : public AnimatorBase
 {
+  using AnimatorFunction = std::function<PropertyType(float, const PropertyType&)>;
+
+  AnimatorFunction mAnimatorFunction;
+
 public:
 
   /**
@@ -629,96 +626,30 @@ public:
    * @param[in] timePeriod The time period of this animation.
    * @return A newly allocated animator.
    */
-  static AnimatorBase* New( const PropertyOwner& propertyOwner,
-                            const PropertyBase& property,
-                            AnimatorFunctionBase* animatorFunction,
-                            AlphaFunction alphaFunction,
-                            const TimePeriod& timePeriod )
+  static AnimatorBase* New(const PropertyOwner& propertyOwner,
+                           const PropertyBase&  property,
+                           AnimatorFunction     animatorFunction,
+                           AlphaFunction        alphaFunction,
+                           const TimePeriod&    timePeriod)
   {
 
     // The property was const in the actor-thread, but animators are used in the scene-graph thread.
-    AnimatorTransformProperty* animator = new AnimatorTransformProperty( const_cast<PropertyOwner*>( &propertyOwner ),
-                                               const_cast<PropertyBase*>( &property ),
-                                               animatorFunction );
-
-    animator->SetAlphaFunction( alphaFunction );
-    animator->SetIntervalDelay( timePeriod.delaySeconds );
-    animator->SetDuration( timePeriod.durationSeconds );
-
-    return animator;
-  }
-
-  /**
-   * Virtual destructor.
-   */
-  virtual ~AnimatorTransformProperty()
-  {
-    if (mPropertyOwner && mConnectedToSceneGraph)
-    {
-      mPropertyOwner->RemoveObserver(*this);
-    }
-
-    delete mAnimatorFunction;
+    return new AnimatorTransformProperty(const_cast<PropertyOwner*>(&propertyOwner),
+                                         const_cast<PropertyBase*>(&property),
+                                         std::move(animatorFunction),
+                                         alphaFunction,
+                                         timePeriod);
   }
 
   /**
-   * Called when Animator is added to the scene-graph in update-thread.
+   * @copydoc AnimatorBase::DoUpdate( BufferIndex bufferIndex, bool bake, float alpha )
    */
-  virtual void ConnectToSceneGraph()
+  void DoUpdate( BufferIndex bufferIndex, bool bake, float alpha ) final
   {
-    mConnectedToSceneGraph = true;
-    mPropertyOwner->AddObserver(*this);
-  }
-
-  /**
-   * Called when mPropertyOwner is connected to the scene graph.
-   */
-  virtual void PropertyOwnerConnected( PropertyOwner& owner )
-  {
-    mEnabled = true;
-  }
-
-  /**
-   * Called when mPropertyOwner is disconnected from the scene graph.
-   */
-  virtual void PropertyOwnerDisconnected( BufferIndex bufferIndex, PropertyOwner& owner )
-  {
-    // If we are active, then bake the value if required
-    if ( mActive && mDisconnectAction != Dali::Animation::Discard )
-    {
-      // Bake to target-value if BakeFinal, otherwise bake current value
-      Update( bufferIndex, ( mDisconnectAction == Dali::Animation::Bake ? mCurrentProgress : 1.0f ), true );
-    }
-
-    mActive = false;
-    mEnabled = false;
-  }
-
-  /**
-   * Called shortly before mPropertyOwner is destroyed
-   */
-  virtual void PropertyOwnerDestroyed( PropertyOwner& owner )
-  {
-    mPropertyOwner = NULL;
-  }
-
-  /**
-   * From AnimatorBase.
-   */
-  virtual void Update( BufferIndex bufferIndex, float progress, bool bake )
-  {
-    if( mLoopCount >= 0 )
-    {
-      // Update the progress value
-      progress = SetProgress( progress );
-    }
-
-    float alpha = ApplyAlphaFunction( progress );
-
-    const T& current = mPropertyAccessor.Get( bufferIndex );
-
-    const T result = (*mAnimatorFunction)( alpha, current );
+    const PropertyType& current = mPropertyAccessor.Get( bufferIndex );
 
+    // need to cast the return value in case property is integer
+    const PropertyType result = static_cast<PropertyType>(mAnimatorFunction(alpha, current));
 
     if ( bake )
     {
@@ -728,16 +659,6 @@ public:
     {
       mPropertyAccessor.Set( bufferIndex, result );
     }
-
-    mCurrentProgress = progress;
-  }
-
-  /**
-   * From AnimatorBase.
-   */
-  virtual bool Orphan()
-  {
-    return (mPropertyOwner == NULL);
   }
 
 private:
@@ -745,135 +666,73 @@ private:
   /**
    * Private constructor; see also Animator::New().
    */
-  AnimatorTransformProperty( PropertyOwner* propertyOwner,
-            PropertyBase* property,
-            AnimatorFunctionBase* animatorFunction )
-  : mPropertyOwner( propertyOwner ),
-    mPropertyAccessor( property ),
-    mAnimatorFunction( animatorFunction ),
-    mCurrentProgress( 0.0f )
+  AnimatorTransformProperty(PropertyOwner*    propertyOwner,
+                            PropertyBase*     property,
+                            AnimatorFunction  animatorFunction,
+                            AlphaFunction     alphaFunction,
+                            const TimePeriod& timePeriod)
+  : AnimatorBase(propertyOwner, alphaFunction, timePeriod),
+    mAnimatorFunction(std::move(animatorFunction)),
+    mPropertyAccessor(property)
   {
     // WARNING - this object is created in the event-thread
     // The scene-graph mPropertyOwner object cannot be observed here
   }
 
   // Undefined
-  AnimatorTransformProperty( const AnimatorTransformProperty& );
-
-  // Undefined
-  AnimatorTransformProperty& operator=( const AnimatorTransformProperty& );
+  AnimatorTransformProperty() = delete;
+  AnimatorTransformProperty( const AnimatorTransformProperty& ) = delete;
+  AnimatorTransformProperty& operator=( const AnimatorTransformProperty& ) = delete;
 
 protected:
 
-  PropertyOwner* mPropertyOwner;
   PropertyAccessorType mPropertyAccessor;
 
-  AnimatorFunctionBase* mAnimatorFunction;
-  float mCurrentProgress;
 };
 
 } // namespace SceneGraph
 
-/*
- * AnimatorFunction base class.
- * All update functions must inherit from AnimatorFunctionBase and overload the appropiate "()" operator
- */
-struct AnimatorFunctionBase
-{
-  /**
-   * Constructor
-   */
-  AnimatorFunctionBase(){}
-
-  /*
-   * Virtual destructor (Intended as base class)
-   */
-  virtual ~AnimatorFunctionBase(){}
-
-  ///Stub "()" operators.
-  virtual bool operator()(float progress, const bool& property)
-  {
-    return property;
-  }
-
-  virtual float operator()(float progress, const int& property)
-  {
-    return property;
-  }
-
-  virtual float operator()(float progress, const unsigned int& property)
-  {
-    return property;
-  }
-
-  virtual float operator()(float progress, const float& property)
-  {
-    return property;
-  }
-
-  virtual Vector2 operator()(float progress, const Vector2& property)
-  {
-    return property;
-  }
-
-  virtual Vector3 operator()(float progress, const Vector3& property)
-  {
-    return property;
-  }
-
-  virtual Vector4 operator()(float progress, const Vector4& property)
-  {
-    return property;
-  }
-
-  virtual Quaternion operator()(float progress, const Quaternion& property)
-  {
-    return property;
-  }
-};
-
 // Update functions
 
-struct AnimateByInteger : public AnimatorFunctionBase
+struct AnimateByInteger
 {
   AnimateByInteger(const int& relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
-  float operator()(float alpha, const int& property)
+  float operator()(float alpha, const int32_t& property)
   {
-    return int(property + mRelative * alpha + 0.5f );
+    // integers need to be correctly rounded
+    return roundf(static_cast<float>( property ) + static_cast<float>( mRelative ) * alpha );
   }
 
-  int mRelative;
+  int32_t mRelative;
 };
 
-struct AnimateToInteger : public AnimatorFunctionBase
+struct AnimateToInteger
 {
   AnimateToInteger(const int& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
-  float operator()(float alpha, const int& property)
+  float operator()(float alpha, const int32_t& property)
   {
-    return int(property + ((mTarget - property) * alpha) + 0.5f);
+    // integers need to be correctly rounded
+    return roundf(static_cast<float>( property ) + (static_cast<float>(mTarget - property) * alpha) );
   }
 
-  int mTarget;
+  int32_t mTarget;
 };
 
-struct AnimateByFloat : public AnimatorFunctionBase
+struct AnimateByFloat
 {
   AnimateByFloat(const float& relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   float operator()(float alpha, const float& property)
   {
     return float(property + mRelative * alpha);
@@ -882,14 +741,13 @@ struct AnimateByFloat : public AnimatorFunctionBase
   float mRelative;
 };
 
-struct AnimateToFloat : public AnimatorFunctionBase
+struct AnimateToFloat
 {
   AnimateToFloat(const float& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   float operator()(float alpha, const float& property)
   {
     return float(property + ((mTarget - property) * alpha));
@@ -898,14 +756,13 @@ struct AnimateToFloat : public AnimatorFunctionBase
   float mTarget;
 };
 
-struct AnimateByVector2 : public AnimatorFunctionBase
+struct AnimateByVector2
 {
   AnimateByVector2(const Vector2& relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector2 operator()(float alpha, const Vector2& property)
   {
     return Vector2(property + mRelative * alpha);
@@ -914,14 +771,13 @@ struct AnimateByVector2 : public AnimatorFunctionBase
   Vector2 mRelative;
 };
 
-struct AnimateToVector2 : public AnimatorFunctionBase
+struct AnimateToVector2
 {
   AnimateToVector2(const Vector2& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector2 operator()(float alpha, const Vector2& property)
   {
     return Vector2(property + ((mTarget - property) * alpha));
@@ -930,14 +786,13 @@ struct AnimateToVector2 : public AnimatorFunctionBase
   Vector2 mTarget;
 };
 
-struct AnimateByVector3 : public AnimatorFunctionBase
+struct AnimateByVector3
 {
   AnimateByVector3(const Vector3& relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector3 operator()(float alpha, const Vector3& property)
   {
     return Vector3(property + mRelative * alpha);
@@ -946,14 +801,13 @@ struct AnimateByVector3 : public AnimatorFunctionBase
   Vector3 mRelative;
 };
 
-struct AnimateToVector3 : public AnimatorFunctionBase
+struct AnimateToVector3
 {
   AnimateToVector3(const Vector3& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector3 operator()(float alpha, const Vector3& property)
   {
     return Vector3(property + ((mTarget - property) * alpha));
@@ -962,14 +816,13 @@ struct AnimateToVector3 : public AnimatorFunctionBase
   Vector3 mTarget;
 };
 
-struct AnimateByVector4 : public AnimatorFunctionBase
+struct AnimateByVector4
 {
   AnimateByVector4(const Vector4& relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector4 operator()(float alpha, const Vector4& property)
   {
     return Vector4(property + mRelative * alpha);
@@ -978,14 +831,13 @@ struct AnimateByVector4 : public AnimatorFunctionBase
   Vector4 mRelative;
 };
 
-struct AnimateToVector4 : public AnimatorFunctionBase
+struct AnimateToVector4
 {
   AnimateToVector4(const Vector4& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector4 operator()(float alpha, const Vector4& property)
   {
     return Vector4(property + ((mTarget - property) * alpha));
@@ -994,14 +846,13 @@ struct AnimateToVector4 : public AnimatorFunctionBase
   Vector4 mTarget;
 };
 
-struct AnimateByOpacity : public AnimatorFunctionBase
+struct AnimateByOpacity
 {
   AnimateByOpacity(const float& relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector4 operator()(float alpha, const Vector4& property)
   {
     Vector4 result(property);
@@ -1013,14 +864,13 @@ struct AnimateByOpacity : public AnimatorFunctionBase
   float mRelative;
 };
 
-struct AnimateToOpacity : public AnimatorFunctionBase
+struct AnimateToOpacity
 {
   AnimateToOpacity(const float& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector4 operator()(float alpha, const Vector4& property)
   {
     Vector4 result(property);
@@ -1032,14 +882,13 @@ struct AnimateToOpacity : public AnimatorFunctionBase
   float mTarget;
 };
 
-struct AnimateByBoolean : public AnimatorFunctionBase
+struct AnimateByBoolean
 {
   AnimateByBoolean(bool relativeValue)
   : mRelative(relativeValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   bool operator()(float alpha, const bool& property)
   {
     // Alpha is not useful here, just keeping to the same template as other update functors
@@ -1049,14 +898,13 @@ struct AnimateByBoolean : public AnimatorFunctionBase
   bool mRelative;
 };
 
-struct AnimateToBoolean : public AnimatorFunctionBase
+struct AnimateToBoolean
 {
   AnimateToBoolean(bool targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   bool operator()(float alpha, const bool& property)
   {
     // Alpha is not useful here, just keeping to the same template as other update functors
@@ -1066,7 +914,7 @@ struct AnimateToBoolean : public AnimatorFunctionBase
   bool mTarget;
 };
 
-struct RotateByAngleAxis : public AnimatorFunctionBase
+struct RotateByAngleAxis
 {
   RotateByAngleAxis(const Radian& angleRadians, const Vector3& axis)
   : mAngleRadians( angleRadians ),
@@ -1074,7 +922,6 @@ struct RotateByAngleAxis : public AnimatorFunctionBase
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Quaternion operator()(float alpha, const Quaternion& rotation)
   {
     if (alpha > 0.0f)
@@ -1089,14 +936,13 @@ struct RotateByAngleAxis : public AnimatorFunctionBase
   Vector3 mAxis;
 };
 
-struct RotateToQuaternion : public AnimatorFunctionBase
+struct RotateToQuaternion
 {
   RotateToQuaternion(const Quaternion& targetValue)
   : mTarget(targetValue)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Quaternion operator()(float alpha, const Quaternion& rotation)
   {
     return Quaternion::Slerp(rotation, mTarget, alpha);
@@ -1105,161 +951,156 @@ struct RotateToQuaternion : public AnimatorFunctionBase
   Quaternion mTarget;
 };
 
-
-struct KeyFrameBooleanFunctor : public AnimatorFunctionBase
+struct KeyFrameBooleanFunctor
 {
-  KeyFrameBooleanFunctor(KeyFrameBooleanPtr keyFrames)
-  : mKeyFrames(keyFrames)
+  KeyFrameBooleanFunctor(KeyFrameBoolean keyFrames)
+  : mKeyFrames(std::move(keyFrames))
   {
   }
 
-  using AnimatorFunctionBase::operator();
   bool operator()(float progress, const bool& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, Dali::Animation::Linear);
+      return mKeyFrames.GetValue(progress, Dali::Animation::LINEAR);
     }
     return property;
   }
 
-  KeyFrameBooleanPtr mKeyFrames;
+  KeyFrameBoolean mKeyFrames;
 };
 
-struct KeyFrameIntegerFunctor : public AnimatorFunctionBase
+struct KeyFrameIntegerFunctor
 {
-  KeyFrameIntegerFunctor(KeyFrameIntegerPtr keyFrames, Interpolation interpolation)
-  : mKeyFrames(keyFrames),mInterpolation(interpolation)
+  KeyFrameIntegerFunctor(KeyFrameInteger keyFrames, Interpolation interpolation)
+  : mKeyFrames(std::move(keyFrames)),
+    mInterpolation(interpolation)
   {
   }
 
-  using AnimatorFunctionBase::operator();
-  float operator()(float progress, const int& property)
+  float operator()(float progress, const int32_t& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, mInterpolation);
+      return static_cast<float>(mKeyFrames.GetValue(progress, mInterpolation));
     }
-    return property;
+    return static_cast<float>( property );
   }
 
-  KeyFrameIntegerPtr mKeyFrames;
+  KeyFrameInteger mKeyFrames;
   Interpolation mInterpolation;
 };
 
-struct KeyFrameNumberFunctor : public AnimatorFunctionBase
+struct KeyFrameNumberFunctor
 {
-  KeyFrameNumberFunctor(KeyFrameNumberPtr keyFrames, Interpolation interpolation)
-  : mKeyFrames(keyFrames),mInterpolation(interpolation)
+  KeyFrameNumberFunctor(KeyFrameNumber keyFrames, Interpolation interpolation)
+  : mKeyFrames(std::move(keyFrames)),
+    mInterpolation(interpolation)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   float operator()(float progress, const float& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, mInterpolation);
+      return mKeyFrames.GetValue(progress, mInterpolation);
     }
     return property;
   }
 
-  KeyFrameNumberPtr mKeyFrames;
+  KeyFrameNumber mKeyFrames;
   Interpolation mInterpolation;
 };
 
-struct KeyFrameVector2Functor : public AnimatorFunctionBase
+struct KeyFrameVector2Functor
 {
-  KeyFrameVector2Functor(KeyFrameVector2Ptr keyFrames, Interpolation interpolation)
-  : mKeyFrames(keyFrames),mInterpolation(interpolation)
+  KeyFrameVector2Functor(KeyFrameVector2 keyFrames, Interpolation interpolation)
+  : mKeyFrames(std::move(keyFrames)),
+    mInterpolation(interpolation)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector2 operator()(float progress, const Vector2& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, mInterpolation);
+      return mKeyFrames.GetValue(progress, mInterpolation);
     }
     return property;
   }
 
-  KeyFrameVector2Ptr mKeyFrames;
+  KeyFrameVector2 mKeyFrames;
   Interpolation mInterpolation;
 };
 
-
-struct KeyFrameVector3Functor : public AnimatorFunctionBase
+struct KeyFrameVector3Functor
 {
-  KeyFrameVector3Functor(KeyFrameVector3Ptr keyFrames, Interpolation interpolation)
-  : mKeyFrames(keyFrames),mInterpolation(interpolation)
+  KeyFrameVector3Functor(KeyFrameVector3 keyFrames, Interpolation interpolation)
+  : mKeyFrames(std::move(keyFrames)),
+    mInterpolation(interpolation)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector3 operator()(float progress, const Vector3& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, mInterpolation);
+      return mKeyFrames.GetValue(progress, mInterpolation);
     }
     return property;
   }
 
-  KeyFrameVector3Ptr mKeyFrames;
+  KeyFrameVector3 mKeyFrames;
   Interpolation mInterpolation;
 };
 
-struct KeyFrameVector4Functor : public AnimatorFunctionBase
+struct KeyFrameVector4Functor
 {
-  KeyFrameVector4Functor(KeyFrameVector4Ptr keyFrames, Interpolation interpolation)
-  : mKeyFrames(keyFrames),mInterpolation(interpolation)
+  KeyFrameVector4Functor(KeyFrameVector4 keyFrames, Interpolation interpolation)
+  : mKeyFrames(std::move(keyFrames)),
+    mInterpolation(interpolation)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector4 operator()(float progress, const Vector4& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, mInterpolation);
+      return mKeyFrames.GetValue(progress, mInterpolation);
     }
     return property;
   }
 
-  KeyFrameVector4Ptr mKeyFrames;
+  KeyFrameVector4 mKeyFrames;
   Interpolation mInterpolation;
 };
 
-struct KeyFrameQuaternionFunctor : public AnimatorFunctionBase
+struct KeyFrameQuaternionFunctor
 {
-  KeyFrameQuaternionFunctor(KeyFrameQuaternionPtr keyFrames)
-  : mKeyFrames(keyFrames)
+  KeyFrameQuaternionFunctor(KeyFrameQuaternion keyFrames)
+  : mKeyFrames(std::move(keyFrames))
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Quaternion operator()(float progress, const Quaternion& property)
   {
-    if(mKeyFrames->IsActive(progress))
+    if(mKeyFrames.IsActive(progress))
     {
-      return mKeyFrames->GetValue(progress, Dali::Animation::Linear);
+      return mKeyFrames.GetValue(progress, Dali::Animation::LINEAR);
     }
     return property;
   }
 
-  KeyFrameQuaternionPtr mKeyFrames;
+  KeyFrameQuaternion mKeyFrames;
 };
 
-struct PathPositionFunctor : public AnimatorFunctionBase
+struct PathPositionFunctor
 {
   PathPositionFunctor( PathPtr path )
   : mPath(path)
   {
   }
 
-  using AnimatorFunctionBase::operator();
   Vector3 operator()(float progress, const Vector3& property)
   {
     Vector3 position(property);
@@ -1270,7 +1111,7 @@ struct PathPositionFunctor : public AnimatorFunctionBase
   PathPtr mPath;
 };
 
-struct PathRotationFunctor : public AnimatorFunctionBase
+struct PathRotationFunctor
 {
   PathRotationFunctor( PathPtr path, const Vector3& forward )
   : mPath(path),
@@ -1279,7 +1120,6 @@ struct PathRotationFunctor : public AnimatorFunctionBase
     mForward.Normalize();
   }
 
-  using AnimatorFunctionBase::operator();
   Quaternion operator()(float progress, const Quaternion& property)
   {
     Vector3 tangent;
@@ -1301,4 +1141,4 @@ struct PathRotationFunctor : public AnimatorFunctionBase
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_ANIMATOR_H