-void Animation::Animate( Property& target, Property::Type targetType, AnyFunction& func )
-{
- Animate( target, targetType, func, mDefaultAlpha, mDurationSeconds );
-}
-
-void Animation::Animate( Property& target, Property::Type targetType, AnyFunction& func, AlphaFunction& alpha )
-{
- Animate( target, targetType, func, alpha, mDurationSeconds );
-}
-
-void Animation::Animate( Property& target, Property::Type targetType, AnyFunction& func, TimePeriod period )
-{
- Animate( target, targetType, func, mDefaultAlpha, period );
-}
-
-void Animation::Animate( Property& target, Property::Type targetType, AnyFunction& func, AlphaFunction& alpha, TimePeriod period )
-{
- Property::Type type = target.object.GetPropertyType(target.propertyIndex);
- if(target.componentIndex != Property::INVALID_COMPONENT_INDEX)
- {
- if( type == Property::VECTOR2
- || type == Property::VECTOR3
- || type == Property::VECTOR4 )
- {
- type = Property::FLOAT;
- }
- }
- DALI_ASSERT_ALWAYS( type == targetType && "Animation function must match target property type" );
-
- ProxyObject& proxy = dynamic_cast<ProxyObject&>( GetImplementation(target.object) );
-
- ExtendDuration( period );
-
- switch ( targetType )
- {
- case Property::BOOLEAN:
- {
- AddAnimatorConnector( AnimatorConnector<bool>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionBool >( func ),
- alpha,
- period) );
- break;
- }
-
- case Property::FLOAT:
- {
- AddAnimatorConnector( AnimatorConnector<float>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionFloat >( func ),
- alpha,
- period) );
- break;
- }
-
- case Property::INTEGER:
- {
- AddAnimatorConnector( AnimatorConnector<int>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionInteger >( func ),
- alpha,
- period) );
- break;
- }
-
- case Property::VECTOR2:
- {
- AddAnimatorConnector( AnimatorConnector<Vector2>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionVector2 >( func ),
- alpha,
- period) );
- break;
- }
-
- case Property::VECTOR3:
- {
- AddAnimatorConnector( AnimatorConnector<Vector3>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionVector3 >( func ),
- alpha,
- period) );
- break;
- }
-
- case Property::VECTOR4:
- {
- AddAnimatorConnector( AnimatorConnector<Vector4>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionVector4 >( func ),
- alpha,
- period) );
- break;
- }
-
- case Property::ROTATION:
- {
- AddAnimatorConnector( AnimatorConnector<Quaternion>::New(proxy,
- target.propertyIndex,
- target.componentIndex,
- AnyCast< AnimatorFunctionQuaternion >( func ),
- alpha,
- period) );
- break;
- }
-
- default:
- DALI_ASSERT_ALWAYS(false && "Property type enumeration out of bounds" ); // should never come here
- break;
- }
-}
-