1 #ifndef DALI_ANIMATION_DATA_H
2 #define DALI_ANIMATION_DATA_H
5 * Copyright (c) 2019 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.
25 #include <dali/public-api/actors/actor.h>
26 #include <dali/public-api/animation/alpha-function.h>
27 #include <dali/public-api/animation/animation.h>
28 #include <dali/public-api/common/dali-vector.h>
29 #include <dali/public-api/object/property-value.h>
35 * @brief This object stores description data that can be used to generate an Animation.
36 * This data can be produced from passing JSON.
38 * This then allows the same description data to be used to repeatedly create an animation multiple times.
40 class DALI_CORE_API AnimationData
49 * @brief AnimationDataElement Describes one part of an animation.
51 struct AnimationDataElement
55 Property::Value value;
56 AlphaFunction::BuiltinFunction alphaFunction;
57 float timePeriodDelay;
58 float timePeriodDuration;
60 AnimationDataElement()
61 : alphaFunction( AlphaFunction::DEFAULT ),
62 timePeriodDelay( 0.0f ),
63 timePeriodDuration( 1.0f )
70 * @brief AnimationData holds the required data required to define an
71 * animation to be performed on an actor or actors.
73 typedef Dali::Vector< AnimationDataElement* > AnimationDataList;
77 * @brief Adds one AnimationDataElement to the list to describe one animation.
78 * @param[in] animationDataElement A pre-populated struct to add
79 * @note This class takes ownership of animationDataElement
81 void Add( AnimationDataElement* animationDataElement );
85 * @brief Creates a Dali::Animation from this AnimationData object.
86 * The AnimationData object can describe multiple individual property animations.
87 * Each one will be added to a created animation.
89 * If there is no animation data defined, an invalid Dali::Animation handle is returned.
90 * @param[in] targetActor The actor to target the property animations to.
91 * @param[in] duration The duration of the animation to create.
92 * @return A ready-to-go Dali::Animation, or an invalid handle if there was no data.
94 Dali::Animation CreateAnimation( Dali::Actor targetActor, float duration );
98 * @brief Empties this AnimationData object (and frees all memory).
104 AnimationDataList mAnimationDataList; ///< A vector of individual property animations from which to generate a Dali::Animation.
111 #endif // DALI_ANIMATION_DATA_H