1 #ifndef __DALI_CONSTRAINT_FUNCTIONS_H__
2 #define __DALI_CONSTRAINT_FUNCTIONS_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_ANIMATION_MODULE
26 #include <boost/function.hpp>
36 * @brief Constraints can be used to adjust an Actor property, after animations have been applied.
38 * A local-constraint function is based on local properties of the Actor.
40 namespace LocalConstraint DALI_IMPORT_API
44 * @brief A function which constrains a Vector3 property, based on the local properties of an Actor.
46 * @param[in] size The actor's current size.
47 * @param[in] position The actor's current position.
48 * @param[in] scale The actor's current rotation.
49 * @param[in] rotation The actor's current scale.
50 * @param[in] color The actor's current color.
51 * @return The constrained property value.
53 typedef boost::function<Vector3 (const Vector3& size,
54 const Vector3& position,
55 const Quaternion& rotation,
57 const Vector4& color)> Vector3Function;
60 * @brief A function which constrains a Vector4 property, based on the local properties of an Actor.
62 * @param[in] size The actor's current size.
63 * @param[in] position The actor's current position.
64 * @param[in] scale The actor's current rotation.
65 * @param[in] rotation The actor's current scale.
66 * @param[in] color The actor's current color.
67 * @return The constrained property value.
69 typedef boost::function<Vector4 (const Vector3& size,
70 const Vector3& position,
71 const Quaternion& rotation,
73 const Vector4& color)> Vector4Function;
76 * @brief A function which constrains a Quaternion property, based on the local properties of an Actor.
78 * @param[in] size The actor's current size.
79 * @param[in] position The actor's current position.
80 * @param[in] scale The actor's current rotation.
81 * @param[in] rotation The actor's current scale.
82 * @param[in] color The actor's current color.
83 * @return The constrained property value.
85 typedef boost::function<Quaternion (const Vector3& size,
86 const Vector3& position,
87 const Quaternion& rotation,
89 const Vector4& color)> QuaternionFunction;
92 * @brief A function which constrains a boolean property, based on the local properties of an Actor.
94 * @param[in] size The actor's current size.
95 * @param[in] position The actor's current position.
96 * @param[in] scale The actor's current rotation.
97 * @param[in] rotation The actor's current scale.
98 * @param[in] color The actor's current color.
99 * @return The constrained property value.
101 typedef boost::function<bool (const Vector3& size,
102 const Vector3& position,
103 const Quaternion& rotation,
104 const Vector3& scale,
105 const Vector4& color)> BoolFunction;
110 * @brief A parent-constraint function is based on properties related to the Actor's parent.
112 namespace ParentConstraint DALI_IMPORT_API
116 * @brief A function which constrains a Vector3 property, based on properties related to the Actor's parent.
118 * @param[in] current The current value of the property to be constrained.
119 * @param[in] parentOrigin The actor's current parent-origin.
120 * @param[in] anchorPoint The actor's current anchor-point.
121 * @param[in] parentSize The parent's current size.
122 * @param[in] parentPosition The parent's current position.
123 * @param[in] parentRotation The parent's current rotation.
124 * @param[in] parentScale The parent's current scale.
125 * @return The constrained property value.
127 typedef boost::function<Vector3 (const Vector3& current,
128 const Vector3& parentOrigin,
129 const Vector3& anchorPoint,
130 const Vector3& parentSize,
131 const Vector3& parentPosition,
132 const Quaternion& parentRotation,
133 const Vector3& parentScale)> Vector3Function;
136 * @brief A function which constrains a Vector4 property, based on properties related to the Actor's parent.
138 * @param[in] current The current value of the property to be constrained.
139 * @param[in] parentOrigin The actor's current parent-origin.
140 * @param[in] anchorPoint The actor's current anchor-point.
141 * @param[in] parentSize The parent's current size.
142 * @param[in] parentPosition The parent's current position.
143 * @param[in] parentRotation The parent's current rotation.
144 * @param[in] parentScale The parent's current scale.
145 * @return The constrained property value.
147 typedef boost::function<Vector4 (const Vector4& current,
148 const Vector3& parentOrigin,
149 const Vector3& anchorPoint,
150 const Vector3& parentSize,
151 const Vector3& parentPosition,
152 const Quaternion& parentRotation,
153 const Vector3& parentScale)> Vector4Function;
156 * @brief A function which constrains a Quaternion property, based on properties related to the Actor's parent.
158 * @param[in] parentOrigin The actor's current parent-origin.
159 * @param[in] anchorPoint The actor's current anchor-point.
160 * @param[in] parentSize The parent's current size.
161 * @param[in] parentPosition The parent's current position.
162 * @param[in] parentRotation The parent's current rotation.
163 * @param[in] parentScale The parent's current scale.
164 * @return The constrained property value.
166 typedef boost::function<Quaternion (const Quaternion& current,
167 const Vector3& parentOrigin,
168 const Vector3& anchorPoint,
169 const Vector3& parentSize,
170 const Vector3& parentPosition,
171 const Quaternion& parentRotation,
172 const Vector3& parentScale)> QuaternionFunction;
175 * @brief A function which constrains a boolean property, based on properties related to the Actor's parent.
177 * @param[in] progress A progress value in the range 0->1, where 1 means that the constraint is fully applied.
178 * @param[in] parentOrigin The actor's current parent-origin.
179 * @param[in] anchorPoint The actor's current anchor-point.
180 * @param[in] parentSize The parent's current size.
181 * @param[in] parentPosition The parent's current position.
182 * @param[in] parentRotation The parent's current rotation.
183 * @param[in] parentScale The parent's current scale.
184 * @return The constrained property value.
186 typedef boost::function<bool (const bool& current,
187 const Vector3& parentOrigin,
188 const Vector3& anchorPoint,
189 const Vector3& parentSize,
190 const Vector3& parentPosition,
191 const Quaternion& parentRotation,
192 const Vector3& parentScale)> BoolFunction;
194 } // ParentConstraint
201 #endif // __DALI_CONSTRAINT_FUNCTIONS_H__