} // anonymous namespace
-
AnimationPtr Animation::New(float durationSeconds)
{
if( durationSeconds < 0.0f )
return animation;
}
-Animation::Animation( EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha )
-: mAnimation( nullptr ),
- mEventThreadServices( eventThreadServices ),
- mPlaylist( playlist ),
- mFinishedSignal(),
- mConnectors(),
- mConnectorTargetValues(),
- mPlayRange( Vector2(0.0f,1.0f)),
- mDurationSeconds( durationSeconds ),
- mSpeedFactor(1.0f),
- mNotificationCount( 0 ),
- mLoopCount(1),
- mCurrentLoop(0),
- mEndAction( endAction ),
- mDisconnectAction( disconnectAction ),
- mDefaultAlpha( defaultAlpha ),
- mState(Dali::Animation::STOPPED),
- mProgressReachedMarker( 0.0f ),
- mDelaySeconds( 0.0f ),
- mAutoReverseEnabled( false )
+Animation::Animation(EventThreadServices& eventThreadServices, AnimationPlaylist& playlist, float durationSeconds, EndAction endAction, EndAction disconnectAction, AlphaFunction defaultAlpha)
+: mEventThreadServices(eventThreadServices),
+ mPlaylist(playlist),
+ mDefaultAlpha(defaultAlpha),
+ mDurationSeconds(durationSeconds),
+ mEndAction(endAction),
+ mDisconnectAction(disconnectAction)
{
}
DALI_ASSERT_DEBUG(mAnimation);
// Only notify the objects with the current values if the end action is set to BAKE
- if( mEndAction == EndAction::BAKE )
+ if(mEndAction == EndAction::BAKE && mState != Dali::Animation::STOPPED)
{
NotifyObjects( Notify::USE_CURRENT_VALUE );
}
mPlaylist.OnClear( *this );
}
-void Animation::AnimateBy( Property& target, Property::Value& relativeValue )
+void Animation::AnimateBy(Property& target, Property::Value relativeValue)
{
- AnimateBy( target, relativeValue, mDefaultAlpha, TimePeriod(mDurationSeconds) );
+ AnimateBy(target, std::move(relativeValue), mDefaultAlpha, TimePeriod(mDurationSeconds));
}
-void Animation::AnimateBy( Property& target, Property::Value& relativeValue, AlphaFunction alpha )
+void Animation::AnimateBy(Property& target, Property::Value relativeValue, AlphaFunction alpha)
{
- AnimateBy( target, relativeValue, alpha, TimePeriod(mDurationSeconds) );
+ AnimateBy(target, std::move(relativeValue), alpha, TimePeriod(mDurationSeconds));
}
-void Animation::AnimateBy( Property& target, Property::Value& relativeValue, TimePeriod period )
+void Animation::AnimateBy(Property& target, Property::Value relativeValue, TimePeriod period)
{
- AnimateBy( target, relativeValue, mDefaultAlpha, period );
+ AnimateBy(target, std::move(relativeValue), mDefaultAlpha, period);
}
-void Animation::AnimateBy( Property& target, Property::Value& relativeValue, AlphaFunction alpha, TimePeriod period )
+void Animation::AnimateBy(Property& target, Property::Value relativeValue, AlphaFunction alpha, TimePeriod period)
{
Object& object = GetImplementation(target.object);
const Property::Type propertyType = object.GetPropertyType( target.propertyIndex );
ExtendDuration(period);
- // Store data to later notify the object that its property is being animated
- ConnectorTargetValues connectorPair;
- connectorPair.targetValue = relativeValue;
- connectorPair.connectorIndex = mConnectors.Count();
- connectorPair.timePeriod = period;
- connectorPair.animatorType = Animation::BY;
- mConnectorTargetValues.push_back( connectorPair );
+ // keep the current count.
+ auto connectorIndex = mConnectors.Count();
// using destination type so component animation gets correct type
switch ( destinationType )
default:
{
- // non animatable types handled already
+ DALI_ASSERT_DEBUG(false && "Property not supported");
}
}
+ // Store data to later notify the object that its property is being animated
+ mConnectorTargetValues.push_back({std::move(relativeValue), period, connectorIndex, Animation::BY});
}
-void Animation::AnimateTo( Property& target, Property::Value& destinationValue )
+void Animation::AnimateTo(Property& target, Property::Value destinationValue)
{
- AnimateTo( target, destinationValue, mDefaultAlpha, TimePeriod(mDurationSeconds) );
+ AnimateTo(target, std::move(destinationValue), mDefaultAlpha, TimePeriod(mDurationSeconds));
}
-void Animation::AnimateTo( Property& target, Property::Value& destinationValue, AlphaFunction alpha )
+void Animation::AnimateTo(Property& target, Property::Value destinationValue, AlphaFunction alpha)
{
- AnimateTo( target, destinationValue, alpha, TimePeriod(mDurationSeconds));
+ AnimateTo(target, std::move(destinationValue), alpha, TimePeriod(mDurationSeconds));
}
-void Animation::AnimateTo( Property& target, Property::Value& destinationValue, TimePeriod period )
+void Animation::AnimateTo(Property& target, Property::Value destinationValue, TimePeriod period)
{
- AnimateTo( target, destinationValue, mDefaultAlpha, period );
+ AnimateTo(target, std::move(destinationValue), mDefaultAlpha, period);
}
-void Animation::AnimateTo( Property& target, Property::Value& destinationValue, AlphaFunction alpha, TimePeriod period )
+void Animation::AnimateTo(Property& target, Property::Value destinationValue, AlphaFunction alpha, TimePeriod period)
{
Object& object = GetImplementation( target.object );
const Property::Type propertyType = object.GetPropertyType( target.propertyIndex );
ExtendDuration( period );
- // Store data to later notify the object that its property is being animated
- ConnectorTargetValues connectorPair;
- connectorPair.targetValue = destinationValue;
- connectorPair.connectorIndex = mConnectors.Count();
- connectorPair.timePeriod = period;
- connectorPair.animatorType = Animation::TO;
- mConnectorTargetValues.push_back( connectorPair );
+ // keep the current count.
+ auto connectorIndex = mConnectors.Count();
// using destination type so component animation gets correct type
switch ( destinationType )
default:
{
- // non animatable types handled already
+ DALI_ASSERT_DEBUG(false && "Property not supported");
}
}
+ // Store data to later notify the object that its property is being animated
+ mConnectorTargetValues.push_back({std::move(destinationValue), period, connectorIndex, Animation::TO});
}
void Animation::AnimateBetween( Property target, const KeyFrames& keyFrames )
ExtendDuration( period );
// Store data to later notify the object that its property is being animated
- ConnectorTargetValues connectorPair;
- connectorPair.targetValue = keyFrames.GetLastKeyFrameValue();
- connectorPair.connectorIndex = mConnectors.Count();
- connectorPair.timePeriod = period;
- connectorPair.animatorType = BETWEEN;
- mConnectorTargetValues.push_back( connectorPair );
+ mConnectorTargetValues.push_back({keyFrames.GetLastKeyFrameValue(), period, mConnectors.Count(), BETWEEN});
// using destination type so component animation gets correct type
switch( destinationType )
default:
{
- // non animatable types handled by keyframes
+ DALI_ASSERT_DEBUG(false && "Property not supported");
}
}
}
AnimatorConnectorBase* connector = mConnectors[ iter->connectorIndex ];
Object* object = connector->GetObject();
- if( object )
+ if(object && object->IsAnimationPossible())
{
const auto propertyIndex = connector->GetPropertyIndex();
object->NotifyPropertyAnimation(