2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 #include <dali/public-api/animation/constraint.h>
21 #include <dali/public-api/animation/time-period.h>
22 #include <dali/internal/event/animation/constraint-impl.h>
23 #include <dali/internal/event/animation/constraint-source-impl.h>
28 const AlphaFunction Constraint::DEFAULT_ALPHA_FUNCTION = AlphaFunctions::Linear;
29 const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION = Constraint::Bake;
31 Constraint::Constraint()
35 Constraint::Constraint(Internal::Constraint* constraint)
36 : BaseHandle(constraint)
40 Constraint::~Constraint()
44 void Constraint::SetApplyTime( TimePeriod timePeriod )
46 GetImplementation(*this).SetApplyTime( timePeriod );
49 TimePeriod Constraint::GetApplyTime() const
51 return GetImplementation(*this).GetApplyTime();
54 void Constraint::SetRemoveTime( TimePeriod timePeriod )
56 GetImplementation(*this).SetRemoveTime( timePeriod );
59 TimePeriod Constraint::GetRemoveTime() const
61 return GetImplementation(*this).GetRemoveTime();
64 void Constraint::SetAlphaFunction( AlphaFunction func )
66 GetImplementation(*this).SetAlphaFunction( func );
69 AlphaFunction Constraint::GetAlphaFunction()
71 return GetImplementation(*this).GetAlphaFunction();
74 void Constraint::SetRemoveAction(Constraint::RemoveAction action)
76 GetImplementation(*this).SetRemoveAction(action);
79 Constraint::RemoveAction Constraint::GetRemoveAction() const
81 return GetImplementation(*this).GetRemoveAction();
84 void Constraint::SetTag( const unsigned int tag )
86 GetImplementation(*this).SetTag( tag );
89 unsigned int Constraint::GetTag() const
91 return GetImplementation(*this).GetTag();
98 Constraint Constraint::New( Property::Index target,
99 Property::Type targetType,
101 AnyFunction interpolator )
103 Internal::SourceContainer sources; // empty
105 return Constraint( new Internal::Constraint( target,
112 Constraint Constraint::New( Property::Index target,
113 Property::Type targetType,
114 ConstraintSource source1,
116 AnyFunction interpolator )
118 Internal::SourceContainer sources;
119 sources.push_back( Internal::Source( source1 ) );
121 return Constraint( new Internal::Constraint( target,
128 Constraint Constraint::New( Property::Index target,
129 Property::Type targetType,
130 ConstraintSource source1,
131 ConstraintSource source2,
133 AnyFunction interpolator )
135 Internal::SourceContainer sources;
136 sources.push_back( Internal::Source( source1 ) );
137 sources.push_back( Internal::Source( source2 ) );
139 return Constraint( new Internal::Constraint( target,
146 Constraint Constraint::New( Property::Index target,
147 Property::Type targetType,
148 ConstraintSource source1,
149 ConstraintSource source2,
150 ConstraintSource source3,
152 AnyFunction interpolator )
154 Internal::SourceContainer sources;
155 sources.push_back( Internal::Source( source1 ) );
156 sources.push_back( Internal::Source( source2 ) );
157 sources.push_back( Internal::Source( source3 ) );
159 return Constraint( new Internal::Constraint( target,
166 Constraint Constraint::New( Property::Index target,
167 Property::Type targetType,
168 ConstraintSource source1,
169 ConstraintSource source2,
170 ConstraintSource source3,
171 ConstraintSource source4,
173 AnyFunction interpolator )
175 Internal::SourceContainer sources;
176 sources.push_back( Internal::Source( source1 ) );
177 sources.push_back( Internal::Source( source2 ) );
178 sources.push_back( Internal::Source( source3 ) );
179 sources.push_back( Internal::Source( source4 ) );
181 return Constraint( new Internal::Constraint( target,
188 Constraint Constraint::New( Property::Index target,
189 Property::Type targetType,
190 ConstraintSource source1,
191 ConstraintSource source2,
192 ConstraintSource source3,
193 ConstraintSource source4,
194 ConstraintSource source5,
196 AnyFunction interpolator )
198 Internal::SourceContainer sources;
199 sources.push_back( Internal::Source( source1 ) );
200 sources.push_back( Internal::Source( source2 ) );
201 sources.push_back( Internal::Source( source3 ) );
202 sources.push_back( Internal::Source( source4 ) );
203 sources.push_back( Internal::Source( source5 ) );
205 return Constraint( new Internal::Constraint( target,
212 Constraint Constraint::New( Property::Index target,
213 Property::Type targetType,
214 ConstraintSource source1,
215 ConstraintSource source2,
216 ConstraintSource source3,
217 ConstraintSource source4,
218 ConstraintSource source5,
219 ConstraintSource source6,
221 AnyFunction interpolator )
223 Internal::SourceContainer sources;
224 sources.push_back( Internal::Source( source1 ) );
225 sources.push_back( Internal::Source( source2 ) );
226 sources.push_back( Internal::Source( source3 ) );
227 sources.push_back( Internal::Source( source4 ) );
228 sources.push_back( Internal::Source( source5 ) );
229 sources.push_back( Internal::Source( source6 ) );
231 return Constraint( new Internal::Constraint( target,
238 Constraint Constraint::DownCast( BaseHandle handle )
240 return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );