1 #ifndef DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
2 #define DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
4 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include "dali-scene-loader/public-api/animated-property.h"
21 #include "dali-scene-loader/public-api/api.h"
22 #include "dali/public-api/common/vector-wrapper.h"
29 * @brief Animation handle + name + definition of properties.
31 class DALI_SCENE_LOADER_API AnimationDefinition
34 // For Animations created in the SDK.
35 static const float DEFAULT_DURATION_SECONDS;
37 // For parsing Animations from dli, when duration was not defined.
38 static const float MIN_DURATION_SECONDS;
41 * @brief Saves the original end action of @a anim, sets the end action to
42 * Discard, then stops the animation and returns the end action.
44 static Animation::EndAction StopForModification(Animation& anim);
47 AnimationDefinition();
49 AnimationDefinition(AnimationDefinition&& other);
52 * @brief Registers the properties against the given @a animation. @a getActor
53 * will be used to obtain the Actors for each AnimatedProperty.
55 void Animate(Animation& animation, AnimatedProperty::GetActor getActor);
58 * @brief Creates a new Animation and Animates() its properties. @a getActor
59 * will be used to obtain the Actors for each AnimatedProperty.
61 Animation ReAnimate(AnimatedProperty::GetActor getActor);
63 AnimationDefinition& operator=(AnimationDefinition&& other);
68 float mDuration = DEFAULT_DURATION_SECONDS;
70 Animation::EndAction mDisconnectAction = Animation::BAKE_FINAL;
71 Animation::EndAction mEndAction = Animation::BAKE;
72 float mSpeedFactor = 1.f;
73 Vector2 mPlayRange = Vector2{0.f, 1.f};
75 std::vector<AnimatedProperty> mProperties;
78 struct AnimationGroupDefinition
81 std::vector<std::string> mAnimations;
84 } // namespace SceneLoader
87 #endif //DALI_SCENE_LOADER_ANIMATION_DEFINITION_H