1 #ifndef DALI_SCENE3D_LOADER_ANIMATION_DEFINITION_H
2 #define DALI_SCENE3D_LOADER_ANIMATION_DEFINITION_H
4 * Copyright (c) 2022 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-scene3d/public-api/api.h"
21 #include "dali-scene3d/public-api/loader/animated-property.h"
22 #include "dali/public-api/common/vector-wrapper.h"
31 * @brief Animation handle + name + definition of properties.
33 class DALI_SCENE3D_API AnimationDefinition
36 // For Animations created in the SDK.
37 static const float DEFAULT_DURATION_SECONDS;
39 // For parsing Animations from dli, when duration was not defined.
40 static const float MIN_DURATION_SECONDS;
43 * @brief Saves the original end action of @a anim, sets the end action to
44 * Discard, then stops the animation and returns the end action.
46 static Animation::EndAction StopForModification(Animation& anim);
49 AnimationDefinition();
51 AnimationDefinition(AnimationDefinition&& other);
54 * @brief Registers the properties against the given @a animation. @a getActor
55 * will be used to obtain the Actors for each AnimatedProperty.
57 void Animate(Animation& animation, AnimatedProperty::GetActor getActor);
60 * @brief Creates a new Animation and Animates() its properties. @a getActor
61 * will be used to obtain the Actors for each AnimatedProperty.
63 Animation ReAnimate(AnimatedProperty::GetActor getActor);
65 AnimationDefinition& operator=(AnimationDefinition&& other);
70 float mDuration = DEFAULT_DURATION_SECONDS;
72 Animation::EndAction mDisconnectAction = Animation::BAKE_FINAL;
73 Animation::EndAction mEndAction = Animation::BAKE;
74 float mSpeedFactor = 1.f;
75 Vector2 mPlayRange = Vector2{0.f, 1.f};
77 std::vector<AnimatedProperty> mProperties;
80 struct AnimationGroupDefinition
83 std::vector<std::string> mAnimations;
87 } // namespace Scene3D
90 #endif //DALI_SCENE3D_LOADER_ANIMATION_DEFINITION_H