1 #ifndef __DALI_ANIMATOR_FUNCTIONS_H__
2 #define __DALI_ANIMATOR_FUNCTIONS_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/constants.h>
23 #include <dali/public-api/math/quaternion.h>
26 namespace Dali DALI_IMPORT_API
29 namespace AnimatorFunctions
33 * @brief Function object that interpolates using a bounce shape.
40 BounceFunc(float x, float y, float z);
45 Vector3 operator()(float alpha, const Vector3& current);
47 Vector3 mDistance; ///< Distance to bounce
51 * @brief Function object that rotates about a random axis twice.
56 * @brief Factory method to create a functor with a random axis.
58 static TumbleFunc GetRandom();
61 * @brief Class method to return a random float in the given range
63 static float Randomize(float f0, float f1);
68 * @param[in] x The x component of the axis
69 * @param[in] y The y component of the axis
70 * @param[in] z The z component of the axis
72 TumbleFunc(float x, float y, float z);
75 * @brief Functor to get the current rotation.
76 * @param[in] alpha The alpha value (the output of an alpha function)
77 * @param[in] current The current property value
78 * @return The output rotation
80 Quaternion operator()(float alpha, const Quaternion& current);
82 Vector4 tumbleAxis; ///< The axis about which to rotate
86 * @brief Animator functor that allows provide a timer as input to an animation.
88 * The functor returns: scale * ( numberOfLoops + progress )
95 * @param[in] scale Factor by which to multiply progress.
100 * @brief Functor to return the time.
101 * @param[in] progress The animation progress (0-1)
102 * @param[in] current The current property value.
103 * @return Time since start of animation
105 float operator()(float progress, const float& current);
108 unsigned int mLoopCounter; ///< Number of times this functor has seen looping progress
109 float mPrevious; ///< The last progress value
110 float mScale; ///< factor by which to multiply progress.
113 } // namespace AnimatorFunctions
118 #endif // __DALI_ANIMATOR_FUNCTIONS_H__