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 Constraint Constraint::New( Property::Index target,
85 Property::Type targetType,
87 AnyFunction interpolator )
89 Internal::SourceContainer sources; // empty
91 return Constraint( new Internal::Constraint( target,
98 Constraint Constraint::New( Property::Index target,
99 Property::Type targetType,
100 ConstraintSource source1,
102 AnyFunction interpolator )
104 Internal::SourceContainer sources;
105 sources.push_back( Internal::Source( source1 ) );
107 return Constraint( new Internal::Constraint( target,
114 Constraint Constraint::New( Property::Index target,
115 Property::Type targetType,
116 ConstraintSource source1,
117 ConstraintSource source2,
119 AnyFunction interpolator )
121 Internal::SourceContainer sources;
122 sources.push_back( Internal::Source( source1 ) );
123 sources.push_back( Internal::Source( source2 ) );
125 return Constraint( new Internal::Constraint( target,
132 Constraint Constraint::New( Property::Index target,
133 Property::Type targetType,
134 ConstraintSource source1,
135 ConstraintSource source2,
136 ConstraintSource source3,
138 AnyFunction interpolator )
140 Internal::SourceContainer sources;
141 sources.push_back( Internal::Source( source1 ) );
142 sources.push_back( Internal::Source( source2 ) );
143 sources.push_back( Internal::Source( source3 ) );
145 return Constraint( new Internal::Constraint( target,
152 Constraint Constraint::New( Property::Index target,
153 Property::Type targetType,
154 ConstraintSource source1,
155 ConstraintSource source2,
156 ConstraintSource source3,
157 ConstraintSource source4,
159 AnyFunction interpolator )
161 Internal::SourceContainer sources;
162 sources.push_back( Internal::Source( source1 ) );
163 sources.push_back( Internal::Source( source2 ) );
164 sources.push_back( Internal::Source( source3 ) );
165 sources.push_back( Internal::Source( source4 ) );
167 return Constraint( new Internal::Constraint( target,
174 Constraint Constraint::New( Property::Index target,
175 Property::Type targetType,
176 ConstraintSource source1,
177 ConstraintSource source2,
178 ConstraintSource source3,
179 ConstraintSource source4,
180 ConstraintSource source5,
182 AnyFunction interpolator )
184 Internal::SourceContainer sources;
185 sources.push_back( Internal::Source( source1 ) );
186 sources.push_back( Internal::Source( source2 ) );
187 sources.push_back( Internal::Source( source3 ) );
188 sources.push_back( Internal::Source( source4 ) );
189 sources.push_back( Internal::Source( source5 ) );
191 return Constraint( new Internal::Constraint( target,
198 Constraint Constraint::New( Property::Index target,
199 Property::Type targetType,
200 ConstraintSource source1,
201 ConstraintSource source2,
202 ConstraintSource source3,
203 ConstraintSource source4,
204 ConstraintSource source5,
205 ConstraintSource source6,
207 AnyFunction interpolator )
209 Internal::SourceContainer sources;
210 sources.push_back( Internal::Source( source1 ) );
211 sources.push_back( Internal::Source( source2 ) );
212 sources.push_back( Internal::Source( source3 ) );
213 sources.push_back( Internal::Source( source4 ) );
214 sources.push_back( Internal::Source( source5 ) );
215 sources.push_back( Internal::Source( source6 ) );
217 return Constraint( new Internal::Constraint( target,
224 Constraint Constraint::DownCast( BaseHandle handle )
226 return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );