#include <dali/internal/common/memory-pool-object-allocator.h>
#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/math/math-utils.h>
-namespace //Unnamed namespace
+namespace // Unnamed namespace
{
-//Memory pool used to allocate new animations. Memory used by this pool will be released when shutting down DALi
+// Memory pool used to allocate new animations. Memory used by this pool will be released when shutting down DALi
Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Animation>& GetAnimationMemoryPool()
{
static Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Animation> gAnimationMemoryPool;
mElapsedSeconds(playRange.x * mDurationSeconds),
mSpeedFactor(speedFactor),
mProgressMarker(0.0f),
+ mBlendPoint(0.0f),
mPlayedCount(0),
mLoopCount(loopCount),
mCurrentLoop(0),
mProgressReachedSignalRequired(false),
mAutoReverseEnabled(false),
mAnimatorSortRequired(false),
- mIsActive{false}
+ mIsActive{false},
+ mIsFirstLoop{true}
{
}
}
}
+void Animation::SetBlendPoint(float blendPoint)
+{
+ mBlendPoint = blendPoint;
+}
+
void Animation::Play()
{
if(mAnimatorSortRequired)
}
else
{
- mElapsedSeconds = mPlayRange.x * mDurationSeconds - Math::MACHINE_EPSILON_1; //Force animation to reach it's beginning
+ mElapsedSeconds = mPlayRange.x * mDurationSeconds - Math::MACHINE_EPSILON_1; // Force animation to reach it's beginning
}
}
mElapsedSeconds = mPlayRange.x * mDurationSeconds;
mState = Stopped;
+ mIsFirstLoop = true;
return animationFinished;
}
// Recalculate elapsedFactor here
elapsedFactor = signSpeedFactor * mElapsedSeconds;
+ mIsFirstLoop = false;
if(mLoopCount != 0)
{
// Check If this animation is finished
// After update animation, mElapsedSeconds must be begin of value
mElapsedSeconds = playRangeStartSeconds + playRangeEndSeconds - edgeRangeSeconds;
mState = Stopped;
+ mIsFirstLoop = true;
}
}
bool cleanup = false;
- //Loop through all animators
+ // Loop through all animators
for(auto& animator : mAnimators)
{
if(animator->Orphan())
{
progress = Clamp((elapsedSecondsClamped - intervalDelay) / animatorDuration, 0.0f, 1.0f);
}
- animator->Update(bufferIndex, progress, bake);
+ animator->Update(bufferIndex, progress, mIsFirstLoop ? mBlendPoint : 0.0f, bake);
if(animatorDuration > 0.0f && (elapsedSecondsClamped - intervalDelay) <= animatorDuration)
{
if(cleanup)
{
- //Remove animators whose PropertyOwner has been destroyed
- mAnimators.EraseIf([](auto& animator) { return animator->Orphan(); });
+ // Remove animators whose PropertyOwner has been destroyed
+ mAnimators.EraseIf([](auto& animator)
+ { return animator->Orphan(); });
// Need to be re-sort if remained animators size is bigger than one.
// Note that if animator contains only zero or one items, It is already sorted case.