SET(TC_SOURCES
utc-Dali-Actor.cpp
- utc-Dali-AlphaFunctions.cpp
+ utc-Dali-AlphaFunction.cpp
utc-Dali-AngleAxis.cpp
utc-Dali-AnimatableMesh.cpp
utc-Dali-Animation.cpp
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+
+using namespace Dali;
+
+float customAlphaFunction( float progress )
+{
+ return progress;
+}
+
+void utc_dali_alpha_function_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_alpha_function_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliAlphaFunctionDefaultConstructorP(void)
+{
+ TestApplication application;
+ AlphaFunction alpha;
+
+ //Should return the default alpha function
+ DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
+
+ //Check the mode is BUILTIN_FUNCTION
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionConstructorFromBuiltinP(void)
+{
+ TestApplication application;
+
+ //Construct the alpha function with a built-in function
+ AlphaFunction alpha( AlphaFunction::EASE_IN_OUT);
+
+ //Check if the built-in alpha function is EASE_IN_OUT
+ DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN_OUT, TEST_LOCATION);
+
+ //Check the mode is BUILTIN_FUNCTION
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionConstructorFromFunctionPointerdP(void)
+{
+ TestApplication application;
+
+ //Construct the alpha function with a function pointer
+ AlphaFunction alpha( &customAlphaFunction );
+
+ //Check that the custom function points to the custom alpha function
+ DALI_TEST_EQUALS( alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION);
+
+ //Check the mode is CUSTOM_FUNCTION
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
+
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionConstructorFromControlPointsP(void)
+{
+ TestApplication application;
+
+ //Construct the alpha function with two control points
+ Vector2 controlPoint0 = Vector2(0.0f,1.0f);
+ Vector2 controlPoint1 = Vector2(1.0f,0.0f);
+ AlphaFunction alpha(controlPoint0,controlPoint1);
+
+ //Check if the control points have the correct value
+ Vector4 controlPoints = alpha.GetBezierControlPoints();
+ DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), controlPoint0, TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), controlPoint1, TEST_LOCATION);
+
+ //Check the mode is BEZIER
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionConstructorFromControlPointsN(void)
+{
+ TestApplication application;
+
+ //Construct the alpha function with two control points
+ Vector2 controlPoint0 = Vector2(-10.0f,1.0f);
+ Vector2 controlPoint1 = Vector2(10.0f,0.0f);
+ AlphaFunction alpha(controlPoint0,controlPoint1);
+
+ //x components of the control points should have been clamped to [0,1] to ensure the curve is monotonic
+ Vector4 controlPoints = alpha.GetBezierControlPoints();
+ DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), Vector2(0.0f,1.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), Vector2(1.0f,0.0f), TEST_LOCATION);
+
+ //Check the mode is BEZIER
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionGetBuiltinFunctionP(void)
+{
+ TestApplication application;
+ AlphaFunction alpha( AlphaFunction::EASE_IN);
+
+ //Check if the builtin alpha function is EASE_IN
+ DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
+
+ //Check the mode is BUILTIN_FUNCTION
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionGetCustomFunctionP(void)
+{
+ TestApplication application;
+ AlphaFunction alpha( &customAlphaFunction );
+
+ //Check that the custom function points to the custom alpha function
+ DALI_TEST_EQUALS( alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION);
+
+ //Check the mode is CUSTOM_FUNCTION
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionGetControlPointsFunctionP(void)
+{
+ TestApplication application;
+
+ Vector2 controlPoint0 = Vector2(0.0f,1.0f);
+ Vector2 controlPoint1 = Vector2(1.0f,0.0f);
+ AlphaFunction alpha( controlPoint0,controlPoint1 );
+
+ //Check if the control points have the correct value
+ Vector4 controlPoints = alpha.GetBezierControlPoints();
+ DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), controlPoint0, TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), controlPoint1, TEST_LOCATION);
+
+ //Check the mode is BEZIER
+ DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionGetModeP(void)
+{
+ TestApplication application;
+
+ //Create alpha function using a built-in function
+ AlphaFunction alphaBuiltin( AlphaFunction::EASE_IN);
+
+ //Check the mode is BUILTIN_FUNCTION
+ DALI_TEST_EQUALS( alphaBuiltin.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+
+ //Create alpha function with pointer to function
+ AlphaFunction alphaCustom( &customAlphaFunction );
+ //Check the mode is CUSTOM_FUNCTION
+ DALI_TEST_EQUALS( alphaCustom.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
+
+ //Create alpha function with control points
+ Vector2 controlPoint0 = Vector2(0.0f,1.0f);
+ Vector2 controlPoint1 = Vector2(1.0f,0.0f);
+ AlphaFunction alphaBezier( controlPoint0,controlPoint1 );
+ //Check the mode is BEZIER
+ DALI_TEST_EQUALS( alphaBezier.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliAlphaFunctionBezier(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register a float property
+ float startValue(0.0f);
+ Property::Index index = actor.RegisterProperty( "test-property", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ float targetValue(1.0f);
+
+ Vector2 controlPoint0 = Vector2(0.25f,0.5f);
+ Vector2 controlPoint1 = Vector2(0.75f,0.5f);
+ animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunction(controlPoint0,controlPoint1));
+
+ // Start the animation
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.SendNotification();
+ float epsilon(0.01f);
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), 0.271964f, epsilon, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*40% progress*/);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), 0.432387f, epsilon, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*60% progress*/);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), 0.567613f, epsilon, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*80% progress*/);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), 0.728037f, epsilon, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.SendNotification();
+ DALI_TEST_EQUALS( actor.GetProperty<float>(index), targetValue, TEST_LOCATION );
+
+ END_TEST;
+}
+
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_alpha_functions_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_alpha_functions_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsDefault(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Default( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Default( 0.25f ), 0.25f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Default( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Default( 0.75f ), 0.75f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Default( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsLinear(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Linear( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Linear( 0.25f ), 0.25f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Linear( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Linear( 0.75f ), 0.75f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Linear( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsReverse(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Reverse( 0.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Reverse( 0.25f ), 0.75f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Reverse( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Reverse( 0.75f ), 0.25f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Reverse( 1.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseIn(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseIn( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseIn( 0.25f ), 0.015625f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseIn( 0.5f ), 0.125f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseIn( 0.75f ), 0.421875f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseIn( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseOut(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseOut( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOut( 0.25f ), 0.578125f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOut( 0.5f ), 0.875f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOut( 0.75f ), 0.984375f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOut( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInOut(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOut( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOut( 0.25f ), 0.0625f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOut( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOut( 0.75f ), 0.9375f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOut( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInSine(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine( 0.25f ), 0.07612f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine( 0.5f ), 0.292893f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine( 0.75f ), 0.617317f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseOutSine(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine( 0.25f ), 0.382683f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine( 0.5f ), 0.707107f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine( 0.75f ), 0.92388f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInOutSine(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine( 0.25f ), 0.146447f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine( 0.75f ), 0.853553f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsBounce(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Bounce( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Bounce( 0.25f ), 0.707107f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Bounce( 0.5f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Bounce( 0.75f ), 0.707107f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Bounce( 1.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsBounceBack(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::BounceBack( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::BounceBack( 0.25f ), 0.900316f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::BounceBack( 0.5f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::BounceBack( 0.75f ), -0.300105f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::BounceBack( 1.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseOutBack(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutBack( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutBack( 0.25f ), 0.817410f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutBack( 0.5f ), 1.087698f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutBack( 0.75f ), 1.064137f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutBack( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsSin(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Sin( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin( 0.25f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin( 0.5f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin( 0.75f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin( 1.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsSin2x(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Sin2x( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin2x( 0.25f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin2x( 0.5f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin2x( 0.75f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Sin2x( 1.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsSquare(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::Square( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Square( 0.25f ), 0.0625f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Square( 0.5f ), 0.25f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Square( 0.75f ), 0.5625f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::Square( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInSine33(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine33( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine33( 0.25f ), 0.064146f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine33( 0.5f ), 0.255256f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine33( 0.75f ), 0.569374f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInSine33( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseOutSine33(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine33( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine33( 0.25f ), 0.430626f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine33( 0.5f ), 0.744744f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine33( 0.75f ), 0.935854f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutSine33( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInOutSineXX(void)
-{
- TestApplication application;
-
- {
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine33( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine33( 0.25f ), 0.239263f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine33( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine33( 0.75f ), 0.760737f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine33( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- }
- {
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine50( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine50( 0.25f ), 0.224156f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine50( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine50( 0.75f ), 0.775844f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine50( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- }
- {
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine60( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine60( 0.25f ), 0.211325f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine60( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine60( 0.75f ), 0.788675f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine60( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- }
- {
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine70( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine70( 0.25f ), 0.194806f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine70( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine70( 0.75f ), 0.805194f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine70( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- }
- {
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine80( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine80( 0.25f ), 0.173648f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine80( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine80( 0.75f ), 0.826352f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine80( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- }
- {
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine90( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine90( 0.25f ), 0.146447f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine90( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine90( 0.75f ), 0.853553f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutSine90( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- }
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsDoubleEaseInOutSine60(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::DoubleEaseInOutSine60( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::DoubleEaseInOutSine60( 0.25f ), 0.25f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::DoubleEaseInOutSine60( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::DoubleEaseInOutSine60( 0.75f ), 0.75f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::DoubleEaseInOutSine60( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseOutQuint50(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint50( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint50( 0.25f ), 0.386797f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint50( 0.5f ), 0.692214f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint50( 0.75f ), 0.905268f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint50( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseOutQuint80(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint80( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint80( 0.25f ), 0.484010f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint80( 0.5f ), 0.796937f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint80( 0.75f ), 0.958765f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseOutQuint80( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInBack(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseInBack( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInBack( 0.25f ), -0.064137f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInBack( 0.5f ), -0.087698f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInBack( 0.75f ), 0.182590f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInBack( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliAlphaFunctionsEaseInOutBack(void)
-{
- TestApplication application;
-
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutBack( 0.0f ), 0.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutBack( 0.25f ), -0.043849f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutBack( 0.5f ), 0.5f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutBack( 0.75f ), 1.043849f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS( AlphaFunctions::EaseInOutBack( 1.0f ), 1.0f, Math::MACHINE_EPSILON_10, TEST_LOCATION);
- END_TEST;
-}
// Start the animation
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.Play();
bool signalReceived(false);
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.SetLooping(true);
DALI_TEST_CHECK(animation.GetEndAction() == Animation::Bake);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BakeFinal);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
animation.SetDisconnectAction( Animation::Bake );
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
animation.SetDisconnectAction( Animation::Discard );
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
Animation animation = Animation::New(1.0f);
AlphaFunction func = animation.GetDefaultAlphaFunction();
- DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
+ DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
- animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
+ animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
AlphaFunction func2 = animation.GetDefaultAlphaFunction();
- DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
+ DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
END_TEST;
}
AlphaFunction func = animation.GetDefaultAlphaFunction();
// Test that the default is linear
- DALI_TEST_EQUALS(func(0.1f), AlphaFunctions::Linear(0.1f), TEST_LOCATION);
+ DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
- animation.SetDefaultAlphaFunction(AlphaFunctions::EaseIn);
+ animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
AlphaFunction func2 = animation.GetDefaultAlphaFunction();
- DALI_TEST_CHECK(func2(0.1f) < AlphaFunctions::Linear(0.1f)); // less progress when easing-in
+ DALI_TEST_EQUALS(func2.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
END_TEST;
}
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
animation.SetCurrentProgress( 0.4f );
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
//Trying to set the current cursor outside the range [0..1] is ignored
animation.SetCurrentProgress( -1.0f);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
animation.SetCurrentProgress( 0.4f );
KeyFrames keyframes = KeyFrames::New();
keyframes.Add( 0.0f, initialPosition);
keyframes.Add( 1.0f, targetPosition );
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunctions::Linear);
+ animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
//Set speed to be x2
animation.SetSpeedFactor(2.0f);
DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunctions::Linear );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
// Start the animation from 40% progress
animation.Play();
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
Animation animation = Animation::New(durationSeconds);
animation.SetDisconnectAction( Animation::Discard );
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
animation.PlayFrom( 0.4f );
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
//PlayFrom with an argument outside the range [0..1] will be ignored
animation.PlayFrom(-1.0f);
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
finishCheck.Reset();
actor.SetPosition(Vector3::ZERO);
Vector3 targetScale(3.0f, 3.0f, 3.0f);
- animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunctions::Linear );
+ animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
animation.Play();
application.SendNotification();
Animation animation = Animation::New(durationSeconds);
bool relativeValue(true);
bool finalValue( false || relativeValue );
- animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseIn);
+ animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
// Start the animation
animation.Play();
// Repeat with relative value "false" - this should be an NOOP
animation = Animation::New(durationSeconds);
bool noOpValue(false);
- animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunctions::EaseIn);
+ animation.AnimateBy(Property(actor, index), noOpValue, AlphaFunction::EASE_IN);
// Start the animation
animation.Play();
float animatorDurationSeconds(durationSeconds * 0.5f);
animation.AnimateBy( Property(actor, index),
relativeValue,
- AlphaFunctions::EaseInOut,
+ AlphaFunction::EASE_IN_OUT,
TimePeriod( animatorDurationSeconds ) );
// Start the animation
Animation animation = Animation::New(durationSeconds);
float targetValue(90.0f);
float relativeValue(targetValue - startValue);
- animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
+ animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
int targetValue(90);
int relativeValue(targetValue - startValue);
- animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
+ animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector2 targetValue(20.0f, 20.0f);
Vector2 relativeValue(targetValue - startValue);
- animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
+ animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector3 targetValue(20.0f, 20.0f, 20.0f);
Vector3 relativeValue(targetValue - startValue);
- animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
+ animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
Vector4 relativeValue(targetValue - startValue);
- animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunctions::EaseOut);
+ animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(20.0f, 20.0f, 20.0f);
Vector3 relativePosition(targetPosition - startPosition);
- animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunctions::EaseOut);
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
float delay = 0.5f;
animation.AnimateBy(Property(actor, Actor::Property::POSITION),
relativePosition,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
Animation animation = Animation::New(durationSeconds);
Degree relativeRotationDegrees(360.0f);
Radian relativeRotationRadians(relativeRotationDegrees);
- animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunctions::EaseIn );
+ animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
// Start the animation
animation.Play();
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
Radian relativeRotationRadians(relativeRotationDegrees);
float delay = 0.3f;
animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
- AlphaFunctions::EaseIn, TimePeriod( delay, durationSeconds - delay ) );
+ AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
// Start the animation
animation.Play();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunctions::EaseIn );
+ animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a delay
float delay = 0.5f;
animation = Animation::New(durationSeconds);
- animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ) );
+ animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
const bool targetValue( !startValue );
- animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunction::EASE_OUT);
// Start the animation
animation.Play();
// Repeat with target value "false"
animation = Animation::New(durationSeconds);
const bool finalValue( !targetValue );
- animation.AnimateTo(Property(actor, index), finalValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
// Start the animation
animation.Play();
float animatorDurationSeconds(durationSeconds * 0.5f);
animation.AnimateTo( Property(actor, index),
finalValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod( animatorDurationSeconds ) );
// Start the animation
Animation animation = Animation::New(durationSeconds);
float targetValue(90.0f);
float relativeValue(targetValue - startValue);
- animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
int targetValue(90);
int relativeValue(targetValue - startValue);
- animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector2 targetValue(9000.0f, 9000.0f);
Vector2 relativeValue(targetValue - startValue);
- animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, "test-property"), targetValue, AlphaFunction::EASE_OUT);
Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
Vector3 relativeValue(targetValue - startValue);
- animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateTo(Property(actor, "test-property"),
targetValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
float delay = 0.5f;
animation.AnimateTo(Property(actor, "test-property", 0),
30.0f,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
animation.AnimateTo(Property(actor, index, 1),
30.0f,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
Animation animation = Animation::New(durationSeconds);
Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
Vector4 relativeValue(targetValue - startValue);
- animation.AnimateTo(Property(actor, index), targetValue, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunctions::EaseIn);
+ animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a delay
float delay = 0.5f;
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
+ animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunctions::EaseIn );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunctions::EaseIn );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a delay
float delay = 0.5f;
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ) );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(200.0f, 200.0f, 200.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::EaseIn);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
float delay = 0.5f;
animation.AnimateTo( Property(actor, Actor::Property::POSITION),
targetPosition,
- AlphaFunctions::Linear,
+ AlphaFunction::LINEAR,
TimePeriod( delay, durationSeconds - delay ) );
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
Animation animation = Animation::New(durationSeconds);
Degree targetRotationDegrees(90.0f);
Radian targetRotationRadians(targetRotationDegrees);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn);
+ animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
// Start the animation
animation.Play();
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.25f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.5f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(0.75f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
Degree targetRotationDegrees(90.0f);
Radian targetRotationRadians(targetRotationDegrees);
float delay(0.1f);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunctions::EaseIn, TimePeriod(delay, durationSeconds - delay));
+ animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * AlphaFunctions::EaseIn(progress), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetCurrentOrientation(), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunctions::EaseIn);
+ animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a delay
float delay = 0.5f;
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunctions::Linear, TimePeriod(delay, durationSeconds - delay));
+ animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunctions::EaseIn);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
// Repeat with a shorter animator duration
float animatorDuration = 0.5f;
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunctions::Linear, TimePeriod(animatorDuration));
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear );
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
// Start the animation
animation.Play();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear, Animation::Cubic );
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::Cubic );
// Start the animation
animation.Play();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ) );
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
// Start the animation
animation.Play();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunctions::Linear, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
+ animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::Cubic );
// Start the animation
animation.Play();
// Build the animation
float durationSeconds( 1.0f );
Animation animation = Animation::New(durationSeconds);
- animation.Animate(actor, path, Vector3::XAXIS, AlphaFunctions::Linear);
+ animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
// Build the animation
float durationSeconds( 1.0f );
Animation animation = Animation::New(durationSeconds);
- animation.Animate(actor, path, Vector3::XAXIS, AlphaFunctions::Linear, TimePeriod(0.0f, 1.0f));
+ animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
// Start the animation
animation.Play();
constraint.Apply();
// Apply animation to actor
- animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunctions::Linear );
+ animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
animation.Play();
animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
// Apply animations to actor
- animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunctions::Linear );
+ animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
animation1.Play();
- animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunctions::Linear );
+ animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
animation2.Play();
DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunctions::Linear);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Set the new duration to be 2 seconds
float newDurationSeconds(2.0f);
// Test the alpha-function itself
AlphaFunction func = constraint.GetAlphaFunction();
- DALI_TEST_EQUALS(func(0.1f), 0.1f, TEST_LOCATION); // Default is Linear
+ DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION); // Default is Linear
// Test that the alpha-function is used correctly
// Change to non-linear alpha and retest
- constraint.SetAlphaFunction(AlphaFunctions::EaseIn);
+ constraint.SetAlphaFunction(AlphaFunction::EASE_IN);
func = constraint.GetAlphaFunction();
- DALI_TEST_CHECK(func(0.1f) < 0.09f);
+ DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
actor.ApplyConstraint( constraint );
Constraint constraint = Constraint::New<Vector4>( Actor::Property::COLOR, TestConstraint() );
AlphaFunction func = constraint.GetAlphaFunction();
- DALI_TEST_EQUALS(func(0.5f), 0.5f, TEST_LOCATION); // Default is Linear
+ DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
END_TEST;
}
try
{
- animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunctions::EaseIn);
+ animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN);
animation.Play();
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds*0100.0f)/* some progress */);
PropertyNotification notification2 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(150.0f) );
notification2.NotifySignal().Connect( &TestCallback2 );
Animation animation = Animation::New( 0.032f ); // finishes in 32 ms
- animation.AnimateTo( Property(actor, Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), AlphaFunctions::Linear );
+ animation.AnimateTo( Property(actor, Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR );
animation.Play();
// flush the queue
Vector2 newPosition3(64.0f, 0.0f);
Animation animation = Animation::New(1.0f);
- animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunctions::Linear );
+ animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunction::LINEAR );
animation.Play();
// Perform 1000ms worth of updates at which point animation should have completed.
Vector2 newSize3(10.0f, 10.0f);
Animation animation = Animation::New(1.0f);
- animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunctions::Linear );
+ animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunction::LINEAR );
animation.Play();
// Perform 1000ms worth of updates at which point animation should have completed.
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
-#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/common/dali-common.h>
#include <dali/public-api/object/type-registry.h>
const Dali::Animation::EndAction DEFAULT_END_ACTION( Dali::Animation::Bake );
const Dali::Animation::EndAction DEFAULT_DISCONNECT_ACTION( Dali::Animation::BakeFinal );
const Dali::Animation::Interpolation DEFAULT_INTERPOLATION( Dali::Animation::Linear );
+const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION( Dali::AlphaFunction::DEFAULT );
} // anon namespace
durationSeconds = 0.0f;
}
- AnimationPtr animation = new Animation( *stage, playlist, durationSeconds, DEFAULT_END_ACTION, DEFAULT_DISCONNECT_ACTION, Dali::AlphaFunctions::Linear );
+ AnimationPtr animation = new Animation( *stage, playlist, durationSeconds, DEFAULT_END_ACTION, DEFAULT_DISCONNECT_ACTION, DEFAULT_ALPHA_FUNCTION );
// Second-phase construction
animation->Initialize();
void Animation::AnimateBy(Property& target, Property::Value& relativeValue)
{
- AnimateBy(target, relativeValue, AlphaFunctions::Default, mDurationSeconds);
+ AnimateBy(target, relativeValue, mDefaultAlpha, TimePeriod(mDurationSeconds));
}
void Animation::AnimateBy(Property& target, Property::Value& relativeValue, AlphaFunction alpha)
{
- AnimateBy(target, relativeValue, alpha, mDurationSeconds);
+ AnimateBy(target, relativeValue, alpha, TimePeriod(mDurationSeconds));
}
void Animation::AnimateBy(Property& target, Property::Value& relativeValue, TimePeriod period)
{
- AnimateBy(target, relativeValue, AlphaFunctions::Default, period);
+ AnimateBy(target, relativeValue, mDefaultAlpha, period);
}
void Animation::AnimateBy(Property& target, Property::Value& relativeValue, AlphaFunction alpha, TimePeriod period)
void Animation::AnimateTo(Property& target, Property::Value& destinationValue)
{
- AnimateTo(target, destinationValue, AlphaFunctions::Default, mDurationSeconds);
+ AnimateTo(target, destinationValue, mDefaultAlpha, TimePeriod(mDurationSeconds));
}
void Animation::AnimateTo(Property& target, Property::Value& destinationValue, AlphaFunction alpha)
{
- AnimateTo(target, destinationValue, alpha, mDurationSeconds);
+ AnimateTo(target, destinationValue, alpha, TimePeriod(mDurationSeconds));
}
void Animation::AnimateTo(Property& target, Property::Value& destinationValue, TimePeriod period)
{
- AnimateTo(target, destinationValue, AlphaFunctions::Default, period);
+ AnimateTo(target, destinationValue, mDefaultAlpha, period);
}
void Animation::AnimateTo(Property& target, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period)
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames)
{
- AnimateBetween(target, keyFrames, mDefaultAlpha, mDurationSeconds, DEFAULT_INTERPOLATION );
+ AnimateBetween(target, keyFrames, mDefaultAlpha, TimePeriod(mDurationSeconds), DEFAULT_INTERPOLATION );
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, Interpolation interpolation )
{
- AnimateBetween(target, keyFrames, mDefaultAlpha, mDurationSeconds, interpolation );
+ AnimateBetween(target, keyFrames, mDefaultAlpha, TimePeriod(mDurationSeconds), interpolation );
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period)
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha)
{
- AnimateBetween(target, keyFrames, alpha, mDurationSeconds, DEFAULT_INTERPOLATION);
+ AnimateBetween(target, keyFrames, alpha, TimePeriod(mDurationSeconds), DEFAULT_INTERPOLATION);
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
{
- AnimateBetween(target, keyFrames, alpha, mDurationSeconds, interpolation);
+ AnimateBetween(target, keyFrames, alpha, TimePeriod(mDurationSeconds), interpolation);
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward )
{
- Animate( actor, path, forward, mDefaultAlpha, TimePeriod(0.0f,GetDuration()) );
+ Animate( actor, path, forward, mDefaultAlpha, TimePeriod(mDurationSeconds) );
}
void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha )
{
- Animate( actor, path, forward, alpha, TimePeriod(0.0f,GetDuration()) );
+ Animate( actor, path, forward, alpha, TimePeriod(mDurationSeconds) );
}
void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward, TimePeriod period )
Dali::Actor::Property::VISIBLE,
Property::INVALID_COMPONENT_INDEX,
new AnimateToBoolean(SHOW_VALUE),
- AlphaFunctions::Default,
+ mDefaultAlpha,
TimePeriod(delaySeconds, 0.0f/*immediate*/) ) );
}
Dali::Actor::Property::VISIBLE,
Property::INVALID_COMPONENT_INDEX,
new AnimateToBoolean(HIDE_VALUE),
- AlphaFunctions::Default,
+ mDefaultAlpha,
TimePeriod(delaySeconds, 0.0f/*immediate*/) ) );
}
// INTERNAL INCLUDES
#include <dali/internal/common/owner-pointer.h>
#include <dali/internal/common/owner-container.h>
-#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/common/dali-common.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/animation/key-frames.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/internal/event/animation/progress-value.h>
#include <dali/internal/event/animation/key-frame-channel.h>
namespace SceneGraph
{
-float DefaultAlphaFunc(float progress)
-{
- return progress; // linear
-}
Animation::Animation( float durationSeconds, float speedFactor, const Vector2& playRange, bool isLooping, Dali::Animation::EndAction endAction, Dali::Animation::EndAction disconnectAction )
: mDurationSeconds(durationSeconds),
#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-functions.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/constants.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/radian.h>
AnimatorBase()
: mDurationSeconds(1.0f),
mInitialDelaySeconds(0.0f),
- mAlphaFunc(AlphaFunctions::Linear),
+ mAlphaFunction(AlphaFunction::DEFAULT),
mDisconnectAction(Dali::Animation::BakeFinal),
mActive(false),
mEnabled(true)
* Set the alpha function for an animator.
* @param [in] alphaFunc The alpha function to apply to the animation progress.
*/
- void SetAlphaFunc(AlphaFunc alphaFunc)
+ void SetAlphaFunction(const AlphaFunction& alphaFunction)
{
- mAlphaFunc = alphaFunc;
+ mAlphaFunction = alphaFunction;
}
/**
* Retrieve the alpha function of an animator.
* @return The function.
*/
- AlphaFunc GetAlphaFunc() const
+ AlphaFunction GetAlphaFunction() const
{
- return mAlphaFunc;
+ return mAlphaFunction;
+ }
+
+ /*
+ * Applies the alpha function to the specified progress
+ * @param[in] Current progress
+ * @return The progress after the alpha function has been aplied
+ */
+ float ApplyAlphaFunction( float progress ) const
+ {
+ float result = progress;
+
+ AlphaFunction::Mode alphaFunctionMode( mAlphaFunction.GetMode() );
+ if( alphaFunctionMode == AlphaFunction::BUILTIN_FUNCTION )
+ {
+ switch(mAlphaFunction.GetBuiltinFunction())
+ {
+ case AlphaFunction::DEFAULT:
+ case AlphaFunction::LINEAR:
+ {
+ break;
+ }
+ case AlphaFunction::REVERSE:
+ {
+ result = 1.0f-progress;
+ break;
+ }
+ case AlphaFunction::EASE_IN_SQUARE:
+ {
+ result = progress * progress;
+ break;
+ }
+ case AlphaFunction::EASE_OUT_SQUARE:
+ {
+ result = 1.0f - (1.0f-progress) * (1.0f-progress);
+ break;
+ }
+ case AlphaFunction::EASE_IN:
+ {
+ result = progress * progress * progress;
+ break;
+ }
+ case AlphaFunction::EASE_OUT:
+ {
+ result = (progress-1.0f) * (progress-1.0f) * (progress-1.0f) + 1.0f;
+ break;
+ }
+ case AlphaFunction::EASE_IN_OUT:
+ {
+ result = progress*progress*(3.0f-2.0f*progress);
+ break;
+ }
+ case AlphaFunction::EASE_IN_SINE:
+ {
+ result = -1.0f * cosf(progress * Math::PI_2) + 1.0f;
+ break;
+ }
+ case AlphaFunction::EASE_OUT_SINE:
+ {
+ result = sinf(progress * Math::PI_2);
+ break;
+ }
+ case AlphaFunction::EASE_IN_OUT_SINE:
+ {
+ result = -0.5f * (cosf(Math::PI * progress) - 1.0f);
+ break;
+ }
+ case AlphaFunction::BOUNCE:
+ {
+ result = sinf(progress * Math::PI);
+ break;
+ }
+ case AlphaFunction::SIN:
+ {
+ result = 0.5f - cosf(progress * 2.0f * Math::PI) * 0.5f;
+ break;
+ }
+ case AlphaFunction::EASE_OUT_BACK:
+ {
+ const float sqrt2 = 1.70158f;
+ progress -= 1.0f;
+ result = 1.0f + progress * progress * ( ( sqrt2 + 1.0f ) * progress + sqrt2 );
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ else if( alphaFunctionMode == AlphaFunction::CUSTOM_FUNCTION )
+ {
+ AlphaFunctionPrototype customFunction = mAlphaFunction.GetCustomFunction();
+ if( customFunction )
+ {
+ result = customFunction(progress);
+ }
+ }
+ else
+ {
+ //If progress is very close to 0 or very close to 1 we don't need to evaluate the curve as the result will
+ //be almost 0 or almost 1 respectively
+ if( ( progress > Math::MACHINE_EPSILON_1 ) && ((1.0f - progress) > Math::MACHINE_EPSILON_1) )
+ {
+ Dali::Vector4 controlPoints = mAlphaFunction.GetBezierControlPoints();
+
+ static const float tolerance = 0.001f; //10 iteration max
+
+ //Perform a binary search on the curve
+ float lowerBound(0.0f);
+ float upperBound(1.0f);
+ float currentT(0.5f);
+ float currentX = EvaluateCubicBezier( controlPoints.x, controlPoints.z, currentT);
+ while( fabs( progress - currentX ) > tolerance )
+ {
+ if( progress > currentX )
+ {
+ lowerBound = currentT;
+ }
+ else
+ {
+ upperBound = currentT;
+ }
+ currentT = (upperBound+lowerBound)*0.5f;
+ currentX = EvaluateCubicBezier( controlPoints.x, controlPoints.z, currentT);
+ }
+ result = EvaluateCubicBezier( controlPoints.y, controlPoints.w, currentT);
+ }
+ }
+
+ return result;
}
/**
protected:
+ /**
+ * Helper function to evaluate a cubic bezier curve assuming first point is at 0.0 and last point is at 1.0
+ * @param[in] p0 First control point of the bezier curve
+ * @param[in] p1 Second control point of the bezier curve
+ * @param[in] t A floating point value between 0.0 and 1.0
+ * @return Value of the curve at progress t
+ */
+ inline float EvaluateCubicBezier( float p0, float p1, float t ) const
+ {
+ float tSquare = t*t;
+ return 3.0f*(1.0f-t)*(1.0f-t)*t*p0 + 3.0f*(1.0f-t)*tSquare*p1 + tSquare*t;
+ }
+
float mDurationSeconds;
float mInitialDelaySeconds;
- AlphaFunc mAlphaFunc;
+ AlphaFunction mAlphaFunction;
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.
const_cast<PropertyBase*>( &property ),
animatorFunction );
- animator->SetAlphaFunc( alphaFunction );
+ animator->SetAlphaFunction( alphaFunction );
animator->SetInitialDelay( timePeriod.delaySeconds );
animator->SetDuration( timePeriod.durationSeconds );
*/
virtual void Update( BufferIndex bufferIndex, float progress, bool bake )
{
- float alpha = mAlphaFunc( progress );
+ float alpha = ApplyAlphaFunction(progress);
+
const PropertyType& current = mPropertyAccessor.Get( bufferIndex );
const PropertyType result = (*mAnimatorFunction)( alpha, current );
*/
// INTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/signals/callback.h>
#include <dali/internal/event/animation/property-constraint-ptr.h>
--- /dev/null
+/*
+ * Copyright (c) 2015 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/alpha-function.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+AlphaFunction::AlphaFunction()
+:mBezierControlPoints(Vector4::ZERO),
+ mCustom(0),
+ mBuiltin(DEFAULT),
+ mMode(BUILTIN_FUNCTION)
+{}
+
+AlphaFunction::AlphaFunction( BuiltinFunction function)
+:mBezierControlPoints(Vector4::ZERO),
+ mCustom(0),
+ mBuiltin(function),
+ mMode(BUILTIN_FUNCTION)
+{}
+
+AlphaFunction::AlphaFunction( AlphaFunctionPrototype function)
+:mBezierControlPoints(Vector4::ZERO),
+ mCustom(function),
+ mBuiltin(DEFAULT),
+ mMode(CUSTOM_FUNCTION)
+{}
+
+AlphaFunction::AlphaFunction( const Vector2& controlPoint0, const Vector2& controlPoint1 )
+:mBezierControlPoints(Vector4(Clamp(controlPoint0.x,0.0f,1.0f),controlPoint0.y,
+ Clamp(controlPoint1.x,0.0f,1.0f),controlPoint1.y)),
+ mCustom(0),
+ mBuiltin(DEFAULT),
+ mMode(BEZIER)
+{
+}
+
+Vector4 AlphaFunction::GetBezierControlPoints() const
+{
+ return mBezierControlPoints;
+}
+
+AlphaFunctionPrototype AlphaFunction::GetCustomFunction() const
+{
+ return mCustom;
+}
+
+AlphaFunction::BuiltinFunction AlphaFunction::GetBuiltinFunction() const
+{
+ return mBuiltin;
+}
+
+AlphaFunction::Mode AlphaFunction::GetMode() const
+{
+ return mMode;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_ALPHA_FUNCTION_H__
+#define __DALI_ALPHA_FUNCTION_H__
+
+/*
+ * Copyright (c) 2015 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/dali-common.h>
+#include <dali/public-api/common/constants.h>
+#include <dali/public-api/math/compile-time-math.h>
+#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector4.h>
+
+namespace Dali
+{
+
+typedef float (*AlphaFunctionPrototype)(float progress); ///< Prototype of an alpha function
+
+ /*
+ * @brief Alpha functions are used in animations to specify the rate of change of the animation parameter over time.
+ * Understanding an animation as a parametric function over time, the alpha function is applied to the parameter of
+ * the animation before computing the final animation value.
+ */
+class DALI_IMPORT_API AlphaFunction
+{
+public:
+
+ /**
+ * Built-in alpha functions
+ */
+ enum BuiltinFunction
+ {
+ DEFAULT, ///< Linear
+ LINEAR, ///< No transformation
+ REVERSE, ///< Reverse linear
+
+ EASE_IN_SQUARE, ///< Speeds up and comes to a sudden stop (Square)
+ EASE_OUT_SQUARE, ///< Sudden start and slows to a gradual stop (Square)
+
+ EASE_IN, ///< Speeds up and comes to a sudden stop (Cubic)
+ EASE_OUT, ///< Sudden start and slows to a gradual stop (Cubic)
+ EASE_IN_OUT, ///< Speeds up and slows to a gradual stop (Cubic)
+
+ EASE_IN_SINE, ///< Speeds up and comes to a sudden stop (sinusoidal)
+ EASE_OUT_SINE, ///< Sudden start and slows to a gradual stop (sinusoidal)
+ EASE_IN_OUT_SINE, ///< Speeds up and slows to a gradual stop (sinusoidal)
+
+ BOUNCE, ///< Sudden start, loses momentum and returns to start position
+ SIN, ///< Single revolution
+ EASE_OUT_BACK, ///< Sudden start, exceed end position and return to a gradual stop
+
+ COUNT
+ };
+
+ /**
+ * All possible functioning modes for the alpha function
+ */
+ enum Mode
+ {
+ BUILTIN_FUNCTION, //< The user has specified a built-in function
+ CUSTOM_FUNCTION, //< The user has provided a custom function
+ BEZIER //< The user has provided the control points of a bezier curve
+ };
+
+ /**
+ * @brief Default constructor.
+ * Creates an alpha function object with the default built-in alpha function
+ * @return The alpha function
+ */
+ AlphaFunction();
+
+ /**
+ * @brief Constructor.
+ * Creates an alpha function object with the built-in alpha function passed as a parameter
+ * to the constructor
+ * @param[in] function One of the built-in alpha functions
+ * @return The alpha function
+ */
+ AlphaFunction( BuiltinFunction function);
+
+ /**
+ * @brief Constructor.
+ * Creates an alpha function object using a pointer to an alpha function passed as a paramter
+ * to the constructor
+ * @param[in] function A pointer to an alpha function
+ * @return The alpha function
+ */
+ AlphaFunction( AlphaFunctionPrototype function);
+
+ /**
+ * @brief Constructor.
+ * Creates a bezier alpha function. The bezier will have the first point at (0,0) and
+ * the end point at (1,1).
+ * @note The x components of the control points will be clamped to the range [0,1] to prevent
+ * non monotonic curves.
+ * @param[in] controlPoint0 A Vector2 which will be used as the first control point of the curve
+ * @param[in] controlPoint1 A Vector2 which will be used as the second control point of the curve
+ * @return The alpha function
+ */
+ AlphaFunction( const Dali::Vector2& controlPoint0, const Dali::Vector2& controlPoint1 );
+
+ /**
+ * @brief Return the control points of the alpha function
+ * @return Vector4 containing the two control points of the curve.
+ * (xy for the first point and zw for the second)
+ */
+ Vector4 GetBezierControlPoints() const;
+
+ /**
+ * @brief Returns the pointer to the custom function
+ * @return A pointer to a custom alpha function or 0 if not defined
+ */
+ AlphaFunctionPrototype GetCustomFunction() const;
+
+ /**
+ * @brief Returns the built0in function used by the alpha function
+ * @return One of the built-in alpha functions. In case no built-in function
+ * has been specified, it will return AlphaFunction::DEfAULT
+ */
+ BuiltinFunction GetBuiltinFunction() const;
+
+ /**
+ * @brief Returns the functioning mode of the alpha function
+ * @return The functioning mode of the alpha function
+ */
+ Mode GetMode() const;
+
+private:
+
+ Vector4 mBezierControlPoints; //< Control points for the bezier alpha function
+ AlphaFunctionPrototype mCustom; //< Pointer to an alpha function
+ BuiltinFunction mBuiltin : Log<COUNT>::value+1; //< Enum indicating the built-in alpha function
+ Mode mMode : 2; //< Enum indicating the functioning mode of the AlphaFunction
+};
+
+} // namespace Dali
+
+#endif // __DALI_ALPHA_FUNCTION_H__
+++ /dev/null
-/*
- * Copyright (c) 2015 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/alpha-functions.h>
-
-// INTERNAL INCLUDES
-
-namespace Dali
-{
-
-namespace AlphaFunctions
-{
-
-
-} // AlphaFunctions
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_ALPHA_FUNCTIONS_H__
-#define __DALI_ALPHA_FUNCTIONS_H__
-
-/*
- * Copyright (c) 2015 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/dali-common.h>
-#include <dali/public-api/common/constants.h>
-
-namespace Dali
-{
-
-typedef float (*AlphaFunction)(float progress); ///< Definition of an alpha function
-
-/**
- * @brief Namespace containing a set of alpha functions.
- */
-namespace AlphaFunctions
-{
-
-inline float Linear( float progress )
-{
- return progress;
-}
-
-inline float Default( float progress )
-{
- return Linear( progress );
-}
-
-inline float Reverse( float progress ) ///< Reverse linear
-{
- return 1.0f - progress;
-}
-
-inline float Square( float progress ) ///< Square (x^2)
-{
- return progress * progress;
-}
-
-inline float EaseIn( float progress ) ///< Speeds up and comes to a sudden stop
-{
- return progress * progress * progress;
-}
-
-inline float EaseOut( float progress ) ///< Sudden start and slows to a gradual stop
-{
- progress -= 1.0f;
-
- return progress * progress * progress + 1.0f;
-}
-
-inline float EaseInOut( float progress ) ///< Speeds up and slows to a gradual stop
-{
- if (progress > 0.5f)
- {
- return EaseOut((progress - 0.5f)*2.0f) * 0.5f + 0.5f;
- }
- else
- {
- return EaseIn(progress * 2.0f) * 0.5f;
- }
-}
-
-inline float EaseInSine( float progress ) ///< Speeds up and comes to a sudden stop
-{
- return -1.0f * cosf(progress * Math::PI_2) + 1.0f;
-}
-
-inline float EaseOutSine( float progress ) ///< Sudden start and slows to a gradual stop
-{
- return sinf(progress * Math::PI_2);
-}
-
-inline float EaseInOutSine( float progress ) ///< Speeds up and slows to a gradual stop
-{
- return -0.5f * (cosf(Math::PI * progress) - 1.0f);
-}
-
-inline float EaseInSine33( float progress ) ///< Speeds up and comes to a sudden stop
-{
- float tmp = cosf(Math::PI_2 * 33.0f / 90.0f);
- return -1.0f * (cosf(progress * Math::PI_2 * 33.0f / 90.0f) - tmp) / (1.0f - tmp) + 1.0f;
-}
-
-inline float EaseOutSine33( float progress ) ///< Sudden start and slows to a gradual stop
-{
- float tmp = cosf(Math::PI_2 * 33.0f / 90.0f);
- return (cosf((1.0f - progress) * Math::PI_2 * 33.0f / 90.0f) - tmp) / (1.0f - tmp);
-}
-
-inline float EaseInOutSine33( float progress ) ///< Speeds up and slows to a gradual stop
-{
- float tmp = sinf(Math::PI_2 * 33.0f / 90.0f);
- return (sinf((progress * Math::PI - Math::PI_2) * 33.0f / 90.0f) + tmp) / (2.0f * tmp);
-}
-
-inline float EaseInOutSine50( float progress ) ///< Speeds up and slows to a gradual stop
-{
- float tmp = sinf(Math::PI_2 * 50.0f / 90.0f);
- return (sinf((progress * Math::PI - Math::PI_2) * 50.0f / 90.0f) + tmp) / (2.0f * tmp);
-}
-
-inline float EaseInOutSine60( float progress ) ///< Speeds up and slows to a gradual stop
-{
- float tmp = sinf(Math::PI_2 * 60.0f / 90.0f);
- return (sinf((progress * Math::PI - Math::PI_2) * 60.0f / 90.0f) + tmp) / (2.0f * tmp);
-}
-
-inline float EaseInOutSine70( float progress ) ///< Speeds up and slows to a gradual stop
-{
- float tmp = sinf(Math::PI_2 * 70.0f / 90.0f);
- return (sinf((progress * Math::PI - Math::PI_2) * 70.0f / 90.0f) + tmp) / (2.0f * tmp);
-}
-
-inline float EaseInOutSine80( float progress ) ///< Speeds up and slows to a gradual stop
-{
- float tmp = sinf(Math::PI_2 * 80.0f / 90.0f);
- return (sinf((progress * Math::PI - Math::PI_2) * 80.0f / 90.0f) + tmp) / (2.0f * tmp);
-}
-
-inline float EaseInOutSine90( float progress ) ///< Speeds up and slows to a gradual stop
-{
- return EaseInOutSine(progress);
-}
-
-inline float DoubleEaseInOutSine60( float progress ) ///< Speeds up and slows to a gradual stop, then speeds up again and slows to a gradual stop
-{
- if (progress < 0.5f)
- {
- return EaseInOutSine60(progress * 2.0f) / 2.0f;
- }
- else
- {
- return EaseInOutSine60((progress - 0.5f) * 2.0f) / 2.0f + 0.5f;
- }
-}
-
-inline float EaseOutQuint50( float progress ) ///< Sudden start and slows to a gradual stop
-{
- return 1.0f - powf(1.0f - progress, 1.7f);
-}
-
-inline float EaseOutQuint80( float progress ) ///< Sudden start and slows to a gradual stop
-{
- return 1.0f - powf(1.0f - progress, 2.3f);
-}
-
-inline float Bounce( float progress ) ///< Sudden start, loses momentum and returns to start position
-{
- return sinf(progress * Math::PI);
-}
-
-inline float BounceBack( float progress ) ///< Sudden start, loses momentum and returns to exceed start position and gradual stop at start position
-{
- if( progress > 0.0f )
- {
- return (sinf(progress * 2.0f * Math::PI) * sinf(progress * Math::PI)) / (progress * Math::PI);
- }
- else
- {
- return 0;
- }
-}
-
-inline float EaseInBack( float progress ) ///< Slow start, exceed start position and quickly reach destination
-{
- const float sqrt2 = 1.70158f;
-
- return progress * progress * ( ( sqrt2 + 1.0f ) * progress - sqrt2 );
-}
-
-inline float EaseOutBack( float progress ) ///< Sudden start, exceed end position and return to a gradual stop
-{
- const float sqrt2 = 1.70158f;
- progress -= 1.0f;
-
- return 1.0f + progress * progress * ( ( sqrt2 + 1.0f ) * progress + sqrt2 );
-}
-
-inline float EaseInOutBack( float progress ) ///< Slow start, exceed start position, fast middle, exceed end position and return to a gradual stop
-{
- if (progress > 0.5f)
- {
- return EaseOutBack((progress - 0.5f)*2.0f) * 0.5f + 0.5f;
- }
- else
- {
- return EaseInBack(progress * 2.0f) * 0.5f;
- }
-}
-
-inline float Sin( float progress ) ///< Single revolution
-{
- return 0.5f - cosf(progress * 2.0f * Math::PI) * 0.5f;
-}
-
-inline float Sin2x( float progress ) ///< Two revolutions
-{
- return 0.5f - cosf(progress * 4.0f * Math::PI) * 0.5f;
-}
-
-} // namespace AlphaFunctions
-
-} // namespace Dali
-
-#endif // __DALI_ALPHA_FUNCTIONS_H__
#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/internal/event/actors/actor-impl.h>
#include <dali/internal/event/animation/animation-impl.h>
*/
// INTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/key-frames.h>
#include <dali/public-api/animation/path.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/animation/key-frames.h>
// INTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/math/degree.h>
#include <dali/public-api/math/radian.h>
#include <dali/internal/event/animation/key-frames-impl.h>
void KeyFrames::Add(float time, Property::Value value)
{
- Add(time, value, AlphaFunctions::Linear);
+ Add(time, value, AlphaFunction::DEFAULT);
}
void KeyFrames::Add(float time, Property::Value value, AlphaFunction alpha)
*/
// INTERNAL INCLUDES
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/property-value.h>
#include <dali/public-api/object/property-types.h>
*
* @param [in] durationSeconds The duration of the time period in seconds.
*/
- TimePeriod(float durationSeconds);
+ explicit TimePeriod(float durationSeconds);
/**
* @brief Create a time period.
#include <dali/public-api/actors/renderable-actor.h>
#include <dali/public-api/actors/sampling.h>
-#include <dali/public-api/animation/alpha-functions.h>
+#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/constraint-source.h>
#include <dali/public-api/animation/constraint.h>
$(public_api_src_dir)/actors/mesh-actor.cpp \
$(public_api_src_dir)/actors/renderable-actor.cpp \
$(public_api_src_dir)/animation/animation.cpp \
- $(public_api_src_dir)/animation/alpha-functions.cpp \
+ $(public_api_src_dir)/animation/alpha-function.cpp \
$(public_api_src_dir)/animation/constraint.cpp \
$(public_api_src_dir)/animation/constraint-source.cpp \
$(public_api_src_dir)/animation/key-frames.cpp \
$(public_api_src_dir)/actors/sampling.h
public_api_core_animation_header_files = \
- $(public_api_src_dir)/animation/alpha-functions.h \
+ $(public_api_src_dir)/animation/alpha-function.h \
$(public_api_src_dir)/animation/animation.h \
$(public_api_src_dir)/animation/constraint.h \
$(public_api_src_dir)/animation/constraints.h \