Change copy constructor and copy assignment in common classes to use the default...
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.cpp
index edc33b1..aea5404 100644 (file)
@@ -1,41 +1,33 @@
-//
-// 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) 2020 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.
+ *
+ */
 
 // CLASS HEADER
 #include <dali/public-api/animation/animation.h>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
 #include <dali/public-api/animation/time-period.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/public-api/math/degree.h>
-#include <dali/public-api/math/radian.h>
-#include <dali/public-api/math/vector2.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/animation/animation-impl.h>
-#include <dali/internal/event/effects/shader-effect-impl.h>
+#include <dali/internal/event/animation/path-impl.h>
 
 namespace Dali
 {
 
-const char* const Animation::SIGNAL_FINISHED = "finished";
-const char* const Animation::ACTION_PLAY = "play";
-const char* const Animation::ACTION_STOP = "stop";
-const char* const Animation::ACTION_PAUSE = "pause";
-
 Animation::Animation()
 {
 }
@@ -61,6 +53,14 @@ Animation::~Animation()
 {
 }
 
+Animation::Animation(const Animation& handle) = default;
+
+Animation& Animation::operator=(const Animation& rhs) = default;
+
+Animation::Animation( Animation&& rhs ) = default;
+
+Animation& Animation::operator=( Animation&& rhs ) = default;
+
 void Animation::SetDuration(float durationSeconds)
 {
   GetImplementation(*this).SetDuration(durationSeconds);
@@ -76,6 +76,21 @@ void Animation::SetLooping(bool looping)
   GetImplementation(*this).SetLooping(looping);
 }
 
+void Animation::SetLoopCount(int32_t count)
+{
+  GetImplementation(*this).SetLoopCount(count);
+}
+
+int32_t Animation::GetLoopCount()
+{
+  return GetImplementation(*this).GetLoopCount();
+}
+
+int32_t Animation::GetCurrentLoop()
+{
+  return GetImplementation(*this).GetCurrentLoop();
+}
+
 bool Animation::IsLooping() const
 {
   return GetImplementation(*this).IsLooping();
@@ -91,14 +106,14 @@ Dali::Animation::EndAction Animation::GetEndAction() const
   return GetImplementation(*this).GetEndAction();
 }
 
-void Animation::SetDestroyAction(Dali::Animation::EndAction destroyAction)
+void Animation::SetDisconnectAction( Animation::EndAction disconnectAction )
 {
-  GetImplementation(*this).SetDestroyAction(destroyAction);
+  GetImplementation(*this).SetDisconnectAction( disconnectAction );
 }
 
-Dali::Animation::EndAction Animation::GetDestroyAction() const
+Animation::EndAction Animation::GetDisconnectAction() const
 {
-  return GetImplementation(*this).GetDestroyAction();
+  return GetImplementation(*this).GetDisconnectAction();
 }
 
 void Animation::SetDefaultAlphaFunction(AlphaFunction alpha)
@@ -116,11 +131,26 @@ void Animation::Play()
   GetImplementation(*this).Play();
 }
 
+void Animation::PlayFrom(float progress)
+{
+  GetImplementation(*this).PlayFrom(progress);
+}
+
+void Animation::PlayAfter( float delaySeconds )
+{
+  GetImplementation( *this ).PlayAfter( delaySeconds );
+}
+
 void Animation::Pause()
 {
   GetImplementation(*this).Pause();
 }
 
+Dali::Animation::State Animation::GetState() const
+{
+  return GetImplementation(*this).GetState();
+}
+
 void Animation::Stop()
 {
   GetImplementation(*this).Stop();
@@ -131,7 +161,17 @@ void Animation::Clear()
   GetImplementation(*this).Clear();
 }
 
-Animation::AnimationSignalV2& Animation::FinishedSignal()
+void Animation::SetLoopingMode( LoopingMode loopingMode )
+{
+  GetImplementation( *this ).SetLoopingMode( loopingMode );
+}
+
+Animation::LoopingMode Animation::GetLoopingMode() const
+{
+  return GetImplementation( *this ).GetLoopingMode();
+}
+
+Animation::AnimationSignalType& Animation::FinishedSignal()
 {
   return GetImplementation(*this).FinishedSignal();
 }
@@ -176,191 +216,68 @@ void Animation::AnimateTo(Property target, Property::Value destinationValue, Alp
   GetImplementation(*this).AnimateTo(target, destinationValue, alpha, period);
 }
 
-void Animation::AnimateBetween(Property target, KeyFrames& keyFrames)
-{
-  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames));
-}
-
-void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
-{
-  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
-}
-
-void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
-{
-  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
-}
-
-void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
-{
-  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
-}
-
-void Animation::Animate( Property target, Property::Type targetType, AnyFunction func )
-{
-  GetImplementation(*this).Animate( target, targetType, func );
-}
-
-void Animation::Animate( Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha )
-{
-  GetImplementation(*this).Animate( target, targetType, func, alpha );
-}
-
-void Animation::Animate( Property target, Property::Type targetType, AnyFunction func, TimePeriod period )
-{
-  GetImplementation(*this).Animate( target, targetType, func, period );
-}
-
-void Animation::Animate( Property target, Property::Type targetType, AnyFunction func, AlphaFunction alpha, TimePeriod period )
-{
-  GetImplementation(*this).Animate( target, targetType, func, alpha, period );
-}
-
-// Actor specific animations
-
-void Animation::MoveBy(Actor actor, float x, float y, float z)
-{
-  GetImplementation(*this).MoveBy(GetImplementation(actor), x, y, z);
-}
-
-void Animation::MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha)
-{
-  GetImplementation(*this).MoveBy(GetImplementation(actor), displacement, alpha);
-}
-
-void Animation::MoveBy(Actor actor, Vector3 displacement, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).MoveBy(GetImplementation(actor), displacement, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::MoveTo(Actor actor, float x, float y, float z)
-{
-  GetImplementation(*this).MoveTo(GetImplementation(actor), x, y, z);
-}
-
-void Animation::MoveTo(Actor actor, Vector3 position, AlphaFunction alpha)
-{
-  GetImplementation(*this).MoveTo(GetImplementation(actor), position, alpha);
-}
-
-void Animation::MoveTo(Actor actor, Vector3 position, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames )
 {
-  GetImplementation(*this).MoveTo(GetImplementation(actor), position, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames) );
 }
 
-void Animation::Move(Actor actor, AnimatorFunctionVector3 animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, Interpolation interpolation)
 {
-  GetImplementation(*this).Move(GetImplementation(actor), animatorFunc, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), interpolation );
 }
 
-void Animation::RotateBy(Actor actor, Degree angle, Vector3 axis)
-{
-  GetImplementation(*this).RotateBy(GetImplementation(actor), Radian(angle), axis);
-}
-
-void Animation::RotateBy(Actor actor, Radian angle, Vector3 axis)
-{
-  GetImplementation(*this).RotateBy(GetImplementation(actor), angle, axis);
-}
-
-void Animation::RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha)
-{
-  GetImplementation(*this).RotateBy(GetImplementation(actor), Radian(angle), axis, alpha);
-}
-
-void Animation::RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha)
-{
-  GetImplementation(*this).RotateBy(GetImplementation(actor), angle, axis, alpha);
-}
-
-void Animation::RotateBy(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).RotateBy(GetImplementation(actor), Radian(angle), axis, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::RotateBy(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).RotateBy(GetImplementation(actor), angle, axis, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::RotateTo(Actor actor, Degree angle, Vector3 axis)
-{
-  GetImplementation(*this).RotateTo(GetImplementation(actor), Radian(angle), axis);
-}
-
-void Animation::RotateTo(Actor actor, Radian angle, Vector3 axis)
-{
-  GetImplementation(*this).RotateTo(GetImplementation(actor), angle, axis);
-}
-
-void Animation::RotateTo(Actor actor, Quaternion rotation)
-{
-  GetImplementation(*this).RotateTo(GetImplementation(actor), rotation);
-}
-
-void Animation::RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period)
 {
-  GetImplementation(*this).RotateTo(GetImplementation(actor), Radian(angle), axis, alpha);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period);
 }
 
-void Animation::RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
 {
-  GetImplementation(*this).RotateTo(GetImplementation(actor), angle, axis, alpha);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), period, interpolation );
 }
 
-void Animation::RotateTo(Actor actor, Quaternion rotation, AlphaFunction alpha)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha)
 {
-  GetImplementation(*this).RotateTo(GetImplementation(actor), rotation, alpha);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha);
 }
 
-void Animation::RotateTo(Actor actor, Degree angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
 {
-  GetImplementation(*this).RotateTo(GetImplementation(actor), Radian(angle), axis, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, interpolation);
 }
 
-void Animation::RotateTo(Actor actor, Radian angle, Vector3 axis, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).RotateTo(GetImplementation(actor), angle, axis, alpha, delaySeconds, durationSeconds);
-}
 
-void Animation::RotateTo(Actor actor, Quaternion rotation, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
 {
-  GetImplementation(*this).RotateTo(GetImplementation(actor), rotation, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period);
 }
 
-void Animation::Rotate(Actor actor, AnimatorFunctionQuaternion animatorFunc, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
 {
-  GetImplementation(*this).Rotate(GetImplementation(actor), animatorFunc, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).AnimateBetween(target, GetImplementation(keyFrames), alpha, period, interpolation);
 }
 
-void Animation::ScaleBy(Actor actor, float x, float y, float z)
-{
-  GetImplementation(*this).ScaleBy(GetImplementation(actor), x, y, z);
-}
 
-void Animation::ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha)
-{
-  GetImplementation(*this).ScaleBy(GetImplementation(actor), scale, alpha);
-}
+// Actor specific animations
 
-void Animation::ScaleBy(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::Animate( Actor actor, Path path, const Vector3& forward )
 {
-  GetImplementation(*this).ScaleBy(GetImplementation(actor), scale, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward );
 }
 
-void Animation::ScaleTo(Actor actor, float x, float y, float z)
+void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha )
 {
-  GetImplementation(*this).ScaleTo(GetImplementation(actor), x, y, z);
+  GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha );
 }
 
-void Animation::ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha)
+void Animation::Animate( Actor actor, Path path, const Vector3& forward, TimePeriod period )
 {
-  GetImplementation(*this).ScaleTo(GetImplementation(actor), scale, alpha);
+  GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, period);
 }
 
-void Animation::ScaleTo(Actor actor, Vector3 scale, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::Animate( Actor actor, Path path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
 {
-  GetImplementation(*this).ScaleTo(GetImplementation(actor), scale, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).Animate(GetImplementation(actor), GetImplementation( path ), forward, alpha, period );
 }
 
 void Animation::Show(Actor actor, float delaySeconds)
@@ -373,94 +290,34 @@ void Animation::Hide(Actor actor, float delaySeconds)
   GetImplementation(*this).Hide(GetImplementation(actor), delaySeconds);
 }
 
-void Animation::OpacityBy(Actor actor, float opacity)
-{
-  GetImplementation(*this).OpacityBy(GetImplementation(actor), opacity);
-}
-
-void Animation::OpacityBy(Actor actor, float opacity, AlphaFunction alpha)
-{
-  GetImplementation(*this).OpacityBy(GetImplementation(actor), opacity, alpha);
-}
-
-void Animation::OpacityBy(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).OpacityBy(GetImplementation(actor), opacity, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::OpacityTo(Actor actor, float opacity)
-{
-  GetImplementation(*this).OpacityTo(GetImplementation(actor), opacity);
-}
-
-void Animation::OpacityTo(Actor actor, float opacity, AlphaFunction alpha)
-{
-  GetImplementation(*this).OpacityTo(GetImplementation(actor), opacity, alpha);
-}
-
-void Animation::OpacityTo(Actor actor, float opacity, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).OpacityTo(GetImplementation(actor), opacity, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::ColorBy(Actor actor, Vector4 color)
-{
-  GetImplementation(*this).ColorBy(GetImplementation(actor), color);
-}
-
-void Animation::ColorBy(Actor actor, Vector4 color, AlphaFunction alpha)
-{
-  GetImplementation(*this).ColorBy(GetImplementation(actor), color, alpha);
-}
-
-void Animation::ColorBy(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).ColorBy(GetImplementation(actor), color, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::ColorTo(Actor actor, Vector4 color)
-{
-  GetImplementation(*this).ColorTo(GetImplementation(actor), color);
-}
-
-void Animation::ColorTo(Actor actor, Vector4 color, AlphaFunction alpha)
-{
-  GetImplementation(*this).ColorTo(GetImplementation(actor), color, alpha);
-}
-
-void Animation::ColorTo(Actor actor, Vector4 color, AlphaFunction alpha, float delaySeconds, float durationSeconds)
-{
-  GetImplementation(*this).ColorTo(GetImplementation(actor), color, alpha, delaySeconds, durationSeconds);
-}
-
-void Animation::Resize(Actor actor, float width, float height)
+void Animation::SetCurrentProgress( float progress )
 {
-  GetImplementation(*this).Resize(GetImplementation(actor), width, height);
+  return GetImplementation(*this).SetCurrentProgress( progress );
 }
 
-void Animation::Resize(Actor actor, float width, float height, AlphaFunction alpha)
+float Animation::GetCurrentProgress()
 {
-  GetImplementation(*this).Resize(GetImplementation(actor), width, height, alpha);
+  return GetImplementation(*this).GetCurrentProgress();
 }
 
-void Animation::Resize(Actor actor,float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+void Animation::SetSpeedFactor( float factor )
 {
-  GetImplementation(*this).Resize(GetImplementation(actor), width, height, alpha, delaySeconds, durationSeconds);
+  GetImplementation(*this).SetSpeedFactor( factor );
 }
 
-void Animation::Resize(Actor actor, Vector3 size)
+float Animation::GetSpeedFactor() const
 {
-  GetImplementation(*this).Resize(GetImplementation(actor), size);
+  return GetImplementation(*this).GetSpeedFactor();
 }
 
-void Animation::Resize(Actor actor, Vector3 size, AlphaFunction alpha)
+void Animation::SetPlayRange( const Vector2& range )
 {
-  GetImplementation(*this).Resize(GetImplementation(actor), size, alpha);
+  GetImplementation(*this).SetPlayRange(range);
 }
 
-void Animation::Resize(Actor actor, Vector3 size, AlphaFunction alpha, float delaySeconds, float durationSeconds)
+Vector2 Animation::GetPlayRange() const
 {
-  GetImplementation(*this).Resize(GetImplementation(actor), size, alpha, delaySeconds, durationSeconds);
+  return GetImplementation(*this).GetPlayRange();
 }
 
 } // namespace Dali