/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mDisconnectAction(disconnectAction),
mState(Stopped),
mProgressReachedSignalRequired( false ),
- mAutoReverseEnabled( false )
+ mAutoReverseEnabled( false ),
+ mIsActive{ false }
{
}
-Animation::~Animation()
-{
-}
+Animation::~Animation() = default;
void Animation::operator delete( void* ptr )
{
{
mDisconnectAction = action;
- for ( AnimatorIter iter = mAnimators.Begin(), endIter = mAnimators.End(); iter != endIter; ++iter )
+ for ( auto&& item : mAnimators )
{
- (*iter)->SetDisconnectAction( action );
+ item->SetDisconnectAction( action );
}
}
}
mState = Playing;
SetAnimatorsActive( true );
+
+ mCurrentLoop = 0;
}
}
void Animation::Bake(BufferIndex bufferIndex, EndAction action)
{
- if( action == Dali::Animation::BakeFinal )
+ if( action == Dali::Animation::BAKE_FINAL )
{
if( mSpeedFactor > 0.0f )
{
void Animation::SetAnimatorsActive( bool active )
{
- for ( AnimatorIter iter = mAnimators.Begin(), endIter = mAnimators.End(); iter != endIter; ++iter )
+ for ( auto&& item : mAnimators )
{
- (*iter)->SetActive( active );
+ item->SetActive( active );
}
}
{
animationFinished = true; // The actor-thread should be notified of this
- if( mEndAction != Dali::Animation::Discard )
+ if( mEndAction != Dali::Animation::DISCARD )
{
Bake( bufferIndex, mEndAction );
{
if (mState == Playing || mState == Paused)
{
- if (mEndAction != Dali::Animation::Discard)
+ if (mEndAction != Dali::Animation::DISCARD)
{
Bake( bufferIndex, mEndAction );
{
mAutoReverseEnabled = loopingMode;
- for ( AnimatorIter iter = mAnimators.Begin(), endIter = mAnimators.End(); iter != endIter; ++iter )
+ for ( auto&& item : mAnimators )
{
// Send some variables together to figure out the Animation status
- (*iter)->SetSpeedFactor( mSpeedFactor );
- (*iter)->SetLoopCount( mLoopCount );
-
- (*iter)->SetLoopingMode( loopingMode );
+ item->SetSpeedFactor( mSpeedFactor );
+ item->SetLoopCount( mLoopCount );
+ item->SetLoopingMode( loopingMode );
}
}
mAnimators.PushBack( animator.Release() );
}
-void Animation::Update(BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished, bool& progressReached )
+void Animation::Update( BufferIndex bufferIndex, float elapsedSeconds, bool& looped, bool& finished, bool& progressReached )
{
looped = false;
finished = false;
// Make elapsed second as edge of range forcely.
mElapsedSeconds = edgeRangeSeconds + signSpeedFactor * Math::MACHINE_EPSILON_10;
- UpdateAnimators(bufferIndex, finished && (mEndAction != Dali::Animation::Discard), finished );
+ UpdateAnimators(bufferIndex, finished && (mEndAction != Dali::Animation::DISCARD), finished );
// After update animation, mElapsedSeconds must be begin of value
mElapsedSeconds = playRangeStartSeconds + playRangeEndSeconds - edgeRangeSeconds;
void Animation::UpdateAnimators( BufferIndex bufferIndex, bool bake, bool animationFinished )
{
+ mIsActive[bufferIndex] = false;
+
const Vector2 playRange( mPlayRange * mDurationSeconds );
float elapsedSecondsClamped = Clamp( mElapsedSeconds, playRange.x, playRange.y );
//Loop through all animators
bool applied(true);
- for ( AnimatorIter iter = mAnimators.Begin(); iter != mAnimators.End(); )
+ for ( auto&& iter = mAnimators.Begin(); iter != mAnimators.End(); )
{
AnimatorBase *animator = *iter;
progress = Clamp((elapsedSecondsClamped - intervalDelay) / animatorDuration, 0.0f , 1.0f );
}
animator->Update(bufferIndex, progress, bake);
+
+ if (animatorDuration > 0.0f && (elapsedSecondsClamped - intervalDelay) <= animatorDuration)
+ {
+ mIsActive[bufferIndex] = true;
+ }
}
applied = true;
}