1 #ifndef __DALI_KEY_FRAMES_H__
2 #define __DALI_KEY_FRAMES_H__
5 * Copyright (c) 2015 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/animation/alpha-function.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/object/property-value.h>
25 #include <dali/public-api/object/property-types.h>
30 * @addtogroup dali_core_animation
34 namespace Internal DALI_INTERNAL
40 * @brief A set of key frames for a property that can be animated using Dali::Animation::AnimateBetween().
42 * This allows the generation of key frame objects from individual
43 * Property::Values. The type of the key frame is specified by the
44 * type of the first value to be added. Adding key frames with a
45 * different Property::Value type will result in a run time assert.
48 class DALI_IMPORT_API KeyFrames : public BaseHandle
52 * @brief Create an initialized KeyFrames handle.
55 * @return A handle to a newly allocated Dali resource.
57 static KeyFrames New();
60 * @brief Downcast a handle to KeyFrames handle.
62 * If handle points to a KeyFrames object the downcast produces
63 * valid handle. If not the returned handle is left uninitialized.
65 * @param[in] handle Handle to an object
66 * @return Handle to a KeyFrames object or an uninitialized handle
68 static KeyFrames DownCast( BaseHandle handle );
71 * @brief Create an uninitialized KeyFrame handle.
73 * This can be initialized with KeyFrame::New().
74 * Calling member functions with an uninitialized KeyFrames handle is not allowed.
82 * This is non-virtual since derived Handle types must not contain data or virtual methods.
88 * @brief This copy constructor is required for (smart) pointer semantics.
91 * @param [in] handle A reference to the copied handle
93 KeyFrames(const KeyFrames& handle);
96 * @brief This assignment operator is required for (smart) pointer semantics.
99 * @param [in] rhs A reference to the copied handle
100 * @return A reference to this
102 KeyFrames& operator=(const KeyFrames& rhs);
105 * @brief Gets the type of the key frame.
107 * If no key frames have been added, this returns Property::NONE.
109 * @return The key frame property type.
111 Property::Type GetType() const;
114 * @brief Add a key frame.
116 * The key frames should be added in time order.
118 * @param[in] progress A progress value between 0.0 and 1.0.
119 * @param[in] value A value.
121 void Add(float progress, Property::Value value);
124 * @brief Add a key frame.
126 * The key frames should be added in time order.
128 * @param[in] progress A progress value between 0.0 and 1.0.
129 * @param[in] value A value.
130 * @param[in] alpha The alpha function used to blend to the next keyframe
132 void Add(float progress, Property::Value value, AlphaFunction alpha);
135 public: // Not intended for application developers
137 * @brief This constructor is used by KeyFrames::New() methods.
140 * @param[in] keyFrames A pointer to an internal KeyFrame resource
142 explicit DALI_INTERNAL KeyFrames(Internal::KeyFrames* keyFrames);
150 #endif // __DALI_KEY_FRAMES_H__