2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiAnim_TransactionNode.cpp
20 * @brief This file contains implementation of _TransactionNode class
22 * This file contains implementation _TransactionNode class.
25 #include <FBaseSysLog.h>
27 #include <FUiAnimIVisualElementAnimationStatusEventListener.h>
28 #include <FUiAnimIVisualElementAnimationTickEventListener.h>
29 #include <FUiAnimIVisualElementAnimationValueInterpolator.h>
30 #include <FUiAnimIAnimationTransactionEventListener.h>
31 #include <FUiAnimVisualElementPropertyAnimation.h>
32 #include <FUiAnimVisualElement.h>
35 #include "FUi_EcoreEvas.h"
36 #include "FUiAnim_VisualElementValueAnimationImpl.h"
37 #include "FUiAnim_VisualElementAnimationKeyFrame.h"
38 #include "FUiAnim_TransactionNode.h"
39 #include "FUiAnim_Debug.h"
41 using namespace Tizen::Base;
42 using namespace Tizen::Base::Collection;
44 //#define VE_DEBUG_ANIMATION
46 namespace Tizen { namespace Ui { namespace Animations
49 #define TN_CAST(_T) static_cast< _TransactionNode* >(_T)
50 #define TN_CONST_CAST(_T) static_cast< _TransactionNode* >(const_cast< Object* >(_T))
52 #define AD_CAST(_AD) static_cast< _AnimationData* >(_AD)
53 #define AD_CONST_CAST(_AD) static_cast< _AnimationData* >(const_cast< Object* >(_AD))
56 _AnimationTime::GetTime(bool loopTime)
58 #ifdef VE_DEBUG_ANIMATION
59 static unsigned int debug_time = 0;
66 return (unsigned int) (ecore_loop_time_get() * 1000.0f); // ecore_loop_time_get() returns a value in seconds.
69 return (unsigned int) (ecore_time_get() * 1000.0f); // ecore_loop_time_get() returns a value in seconds.
73 _AnimationData::_AnimationData(VisualElement& target, const Tizen::Base::String* pName, VisualElementAnimation& animation)
75 , __animation(animation)
80 , __currentRepeatCount(1)
84 , __status(_STATUS_READY)
85 , __pendingMode(_PENDING_MODE_NONE)
92 VisualElementValueAnimation* pValueAnimation = dynamic_cast< VisualElementValueAnimation* >(&__animation);
95 __startValue = pValueAnimation->GetStartValue();
96 __endValue = pValueAnimation->GetEndValue();
99 long repeatCount = __animation.IsAutoReverseEnabled() ? __animation.GetRepeatCount() * 2 : __animation.GetRepeatCount();
101 __totalDuration = __animation.GetDelay() + (__animation.GetDuration() * repeatCount - __animation.GetOffset());
103 #ifdef VE_DEBUG_MODULE
108 _AnimationData::~_AnimationData(void)
113 VisualElementAnimation&
114 _AnimationData::GetAnimation(void) const
120 _AnimationData::GetName(void) const
126 _AnimationData::GetTarget(void) const
132 _AnimationData::IsRemoved(void) const
134 return (__pendingMode == _PENDING_MODE_REMOVING || __pendingMode == _PENDING_MODE_REMOVE);
138 _AnimationData::SetBaseTime(unsigned int baseTime)
140 __baseTime = baseTime;
142 if (__status == _STATUS_END)
144 // reset for group repeat
145 __status = _STATUS_READY;
150 #ifdef VE_DEBUG_MODULE
151 if (_VeDebug::IsDebugEnabled())
161 _AnimationData::FillValueForProperty(void)
163 if (__startValue.IsEmpty() || __endValue.IsEmpty())
165 VisualElementPropertyAnimation* pPropertyAnimation = dynamic_cast< VisualElementPropertyAnimation* >(&__animation);
166 if (pPropertyAnimation)
168 Variant currentValue = __target.GetProperty(pPropertyAnimation->GetPropertyName());
170 if (__startValue.IsEmpty())
172 __startValue = currentValue;
176 __endValue = currentValue;
183 _AnimationData::CalculateValueByTime(unsigned int currentTime)
185 long currentRepeatCount = 0;
186 long oldRepeatCount = 0;
187 long repeatCount = 0;
193 #ifdef VE_DEBUG_MODULE
194 if (_VeDebug::IsDebugEnabled())
196 currentTime = __tick;
201 if (__status == _STATUS_END)
206 if (__status == _STATUS_STOP)
208 __status = _STATUS_END;
210 return CalculateValue();
214 if (__animation.GetScaleRatio() > 0.f)
216 currentTime = (unsigned int) ((currentTime - __baseTime) / __animation.GetScaleRatio()); // Apply time scale value
219 delay = __animation.GetDelay();
221 if (currentTime < (unsigned int)(delay))
224 __currentRepeatCount = 1;
228 return CalculateValue();
231 offset = __animation.GetOffset();
232 repeatCount = __animation.GetRepeatCount();
233 duration = __animation.GetDuration();
240 oldRepeatCount = __currentRepeatCount;
241 currentRepeatCount = ((currentTime - delay + offset) / duration) + 1;
243 if (__animation.IsAutoReverseEnabled())
245 __currentRepeatCount = (currentRepeatCount + 1) >> 1;
247 __progress = static_cast< float >(currentTime - (delay + duration * (currentRepeatCount - 1) - offset)) / static_cast< float >(duration);
249 if (currentRepeatCount & 0x1)
268 __progress = 1.0f - __progress;
275 __currentRepeatCount = currentRepeatCount;
278 __progress = static_cast< float >(currentTime - (delay + duration * (currentRepeatCount - 1) - offset)) / static_cast< float >(duration);
281 if (__status == _STATUS_READY)
283 __status = _STATUS_START;
285 FillValueForProperty();
287 else if (repeatCount > 0 && currentTime >= __totalDuration) // infinite loop if repeatCount == 0
290 __currentRepeatCount = repeatCount;
292 __progress = (__animation.IsAutoReverseEnabled() ? 0.0f : 1.0f);
294 __status = _STATUS_STOP;
296 else if (__currentRepeatCount > oldRepeatCount)
298 __status = _STATUS_REPEAT;
300 __progress = (__animation.IsAutoReverseEnabled() ? 0.0f : 1.0f);
304 __status = _STATUS_RUNNING;
307 return CalculateValue();
311 _AnimationData::CalculateValue(void)
313 float calcProgress = 0.0f;
316 if (__progress < 0.0f || __progress > 1.0f)
321 VisualElementValueAnimation* pValueAnimation = dynamic_cast< VisualElementValueAnimation* >(&__animation);
323 // In case of VisualElementAnimation
324 if (pValueAnimation == null)
329 const IVisualElementAnimationTimingFunction* pTimingFunction = __animation.GetTimingFunction();
330 SysAssertf(pTimingFunction, "Timing function is null.");
332 const IVisualElementAnimationValueInterpolator* pInterpolator = __animation.GetValueInterpolator();
333 SysAssertf(pInterpolator, "Interpolotor is null.");
335 _VisualElementAnimationKeyFrame* pKeyFrame = _VisualElementValueAnimationImpl::GetInstance(*pValueAnimation)->GetKeyFrame();
337 if (pKeyFrame != null)
342 int keyFrameCount = pKeyFrame->GetCount();
343 SysAssertf(keyFrameCount > 0, "The count of key frames is zero.");
347 if (__keyFrameIndex == keyFrameCount) // last section
349 _VisualElementAnimationKeyFrameInfo* pFromInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex - 1);
350 SysAssertf(pFromInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex - 1);
352 start = pFromInfo->GetValueEx();
355 calcProgress = pTimingFunction->CalculateProgress((__progress - pFromInfo->GetTime()) / (1.0f - pFromInfo->GetTime()));
357 if (_FloatCompare(__progress, 1.0f))
364 _VisualElementAnimationKeyFrameInfo* pToInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex);
365 SysAssertf(pToInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex);
367 while (__progress > pToInfo->GetTime())
370 if (__keyFrameIndex == keyFrameCount)
375 pToInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex);
376 SysAssertf(pToInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex);
379 const IVisualElementAnimationTimingFunction* pToTimingFunction = pToInfo->GetTimingFunction();
380 if (pToTimingFunction == null)
382 pToTimingFunction = pTimingFunction;
385 if (__keyFrameIndex == 0) //first section
387 start = __startValue;
388 end = pToInfo->GetValueEx();
390 calcProgress = pToTimingFunction->CalculateProgress(__progress / pToInfo->GetTime());
392 else if (__keyFrameIndex == keyFrameCount) //last section
394 // pToInfo means pFromInfo in last section
395 start = pToInfo->GetValueEx();
398 calcProgress = pTimingFunction->CalculateProgress((__progress - pToInfo->GetTime()) / (1.0f - pToInfo->GetTime()));
402 _VisualElementAnimationKeyFrameInfo* pFromInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex - 1);
403 SysAssertf(pFromInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex - 1);
405 start = pFromInfo->GetValueEx();
406 end = pToInfo->GetValueEx();
408 calcProgress = pToTimingFunction->CalculateProgress((__progress - pFromInfo->GetTime()) / (pToInfo->GetTime() - pFromInfo->GetTime()));
414 if (__keyFrameIndex == 0) //last section in backward (= first section in forward)
416 _VisualElementAnimationKeyFrameInfo* pFromInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex);
417 SysAssertf(pFromInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex);
419 const IVisualElementAnimationTimingFunction* pFromTimingFunction = pFromInfo->GetTimingFunction();
420 if (pFromTimingFunction == null)
422 pFromTimingFunction = pTimingFunction;
425 start = __startValue;
426 end = pFromInfo->GetValueEx();
428 calcProgress = pFromTimingFunction->CalculateProgress(__progress / pFromInfo->GetTime());
432 _VisualElementAnimationKeyFrameInfo* pToInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex - 1);
433 SysAssertf(pToInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex - 1);
435 while (__progress < pToInfo->GetTime())
438 if (__keyFrameIndex == 0)
443 pToInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex - 1);
444 SysAssertf(pToInfo, "Index (%d) of key frame is invalid", __keyFrameIndex - 1);
447 const IVisualElementAnimationTimingFunction* pToTimingFunction = pToInfo->GetTimingFunction();
448 if (pToTimingFunction == null)
450 pToTimingFunction = pTimingFunction;
453 if (__keyFrameIndex == 0) //last section in backward
455 start = __startValue;
456 end = pToInfo->GetValueEx();
458 calcProgress = pToTimingFunction->CalculateProgress(__progress / pToInfo->GetTime());
460 else if (__keyFrameIndex == keyFrameCount) //first section in backward (= last section in forward)
462 start = pToInfo->GetValueEx();
465 calcProgress = pTimingFunction->CalculateProgress((__progress - pToInfo->GetTime()) / (1.0f - pToInfo->GetTime()));
469 _VisualElementAnimationKeyFrameInfo* pFromInfo = pKeyFrame->GetKeyFrameInfoAt(__keyFrameIndex);
470 SysAssertf(pFromInfo, "Index (%d) of key frame is invalid.", __keyFrameIndex);
472 const IVisualElementAnimationTimingFunction* pFromTimingFunction = pFromInfo->GetTimingFunction();
473 if (pFromTimingFunction == null)
475 pFromTimingFunction = pTimingFunction;
478 start = pToInfo->GetValueEx();
479 end = pFromInfo->GetValueEx();
481 calcProgress = pFromTimingFunction->CalculateProgress((__progress - pToInfo->GetTime()) / (pFromInfo->GetTime() - pToInfo->GetTime()));
486 if (pInterpolator->Interpolate(calcProgress, start, end, current) != E_SUCCESS)
493 calcProgress = pTimingFunction->CalculateProgress(__progress);
495 if (pInterpolator->Interpolate(calcProgress, __startValue, __endValue, current) != E_SUCCESS)
505 _AnimationData::NotifyAnimationStatus(bool completed)
507 if (__status == _STATUS_END)
512 IVisualElementAnimationStatusEventListener* pListener = _VisualElementAnimationImpl::GetInstance(__animation)->GetStatusEventListener();
513 if (pListener == null)
518 _VisualElementAnimationImpl* pAnimationImpl = _VisualElementAnimationImpl::GetInstance(__animation);
520 if (completed == false)
522 pListener->OnVisualElementAnimationFinished(__animation, __name, pAnimationImpl->GetEventTarget(), false);
528 case _AnimationData::_STATUS_START:
529 pListener->OnVisualElementAnimationStarted(__animation, __name, pAnimationImpl->GetEventTarget());
532 case _AnimationData::_STATUS_REPEAT:
533 pListener->OnVisualElementAnimationRepeated(__animation, __name, pAnimationImpl->GetEventTarget(), __currentRepeatCount);
536 case _AnimationData::_STATUS_STOP:
537 pListener->OnVisualElementAnimationFinished(__animation, __name, pAnimationImpl->GetEventTarget(), true);
546 _AnimationData::NotifyAnimationFinished(bool completed)
548 if (__status == _STATUS_END)
553 if (__status != _STATUS_STOP)
555 __status = _STATUS_STOP;
558 IVisualElementAnimationStatusEventListener* pListener = _VisualElementAnimationImpl::GetInstance(__animation)->GetStatusEventListener();
559 if (pListener == null)
564 _VisualElementAnimationImpl* pAnimationImpl = _VisualElementAnimationImpl::GetInstance(__animation);
566 pListener->OnVisualElementAnimationFinished(__animation, __name, pAnimationImpl->GetEventTarget(), completed);
570 _AnimationData::OnTickOccurred(VisualElement& target, const Tizen::Ui::Variant& currentValue)
572 if (currentValue.IsEmpty() == true)
577 VisualElementValueAnimation* pValueAnimation = dynamic_cast< VisualElementValueAnimation* >(&__animation);
579 if (pValueAnimation != null)
581 _VisualElementValueAnimationImpl* pValueAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*pValueAnimation);
583 pValueAnimationImpl->OnTickOccurred(target, currentValue);
585 IVisualElementAnimationTickEventListener *pTickListener = pValueAnimationImpl->GetTickEventListener();
587 if (pTickListener != null)
589 pTickListener->OnTickOccurred(*pValueAnimation, __name, pValueAnimationImpl->GetEventTarget(), currentValue);
596 // class _TransactionNode
597 _TransactionNode::_TransactionNode(void)
601 , __pDefaultListener(null)
603 , __isImplicitAnimationEnabled(true)
604 , __isCommitted(false)
605 , __isReservedRemove(false)
606 , __isInAnimationTick(false)
607 , __status(_STATUS_READY)
609 , __adjustedBaseTime(0)
610 , __currentRepeatCount(1)
614 __id = id = (id >= 0xFFFFFF ? 0 : id + 1);
616 result r = __children.Construct();
617 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to construct children list.", GetErrorMessage(r));
619 r = __pendingAnimations.Construct();
620 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to construct pending list.", GetErrorMessage(r));
622 r = __animations.Construct();
623 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to construct animations map.", GetErrorMessage(r));
626 _TransactionNode::_TransactionNode(const _TransactionNode& node)
629 , __pRoot(node.__pRoot)
630 , __pDefaultListener(null)
632 , __isImplicitAnimationEnabled(node.__isImplicitAnimationEnabled)
633 , __isCommitted(false)
634 , __isReservedRemove(false)
635 , __isInAnimationTick(false)
636 , __status(_STATUS_READY)
638 , __adjustedBaseTime(0)
639 , __currentRepeatCount(1)
643 __id = id = (id >= 0xFFFFFF ? 0 : id + 1);
645 result r = __children.Construct();
646 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to construct children list.", GetErrorMessage(r));
648 r = __pendingAnimations.Construct();
649 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to construct pending list.", GetErrorMessage(r));
651 r = __animations.Construct();
652 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to construct animations map.", GetErrorMessage(r));
654 r = CopyAnimationValue(node);
655 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to copy the animation value.", GetErrorMessage(r));
658 _TransactionNode::~_TransactionNode(void)
660 __children.RemoveAll(true);
662 __pendingAnimations.RemoveAll(true);
664 RemoveAllAnimations();
668 _TransactionNode::Equals(const Object& obj) const
679 _TransactionNode::GetId(void) const
685 _TransactionNode::GetParent(void) const
691 _TransactionNode::SetParent(_TransactionNode& parent)
699 _TransactionNode::SetDefaultEventListener(const IAnimationTransactionEventListener* pListener)
701 __pDefaultListener = const_cast< IAnimationTransactionEventListener* >(pListener);
706 IAnimationTransactionEventListener*
707 _TransactionNode::GetEventListener(void) const
713 _TransactionNode::SetEventListener(const IAnimationTransactionEventListener* pListener)
715 __pListener = const_cast< IAnimationTransactionEventListener* >(pListener);
721 _TransactionNode::IsImplicitAnimationEnabled(void) const
723 return __isImplicitAnimationEnabled;
727 _TransactionNode::SetImplicitAnimationEnabled(bool enable)
729 __isImplicitAnimationEnabled = enable;
735 _TransactionNode::GetChildrenCount(void) const
737 return __children.GetCount();
741 _TransactionNode::GetChild(int transactionId) const
743 SysTryReturn(NID_UI_ANIM, transactionId > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(s) is used. transactionId = %d", transactionId);
745 int childrenCount = GetChildrenCount();
747 if (childrenCount <= 0)
752 _TransactionNode* pChild = null;
754 for (int index = 0; index < childrenCount; index++)
756 pChild = TN_CONST_CAST(__children.GetAt(index));
758 if (pChild->GetId() == transactionId)
763 pChild = pChild->GetChild(transactionId);
775 _TransactionNode::GetLastChild(void) const
777 int index = GetChildrenCount() - 1;
779 SysTryReturn(NID_UI_ANIM, index >= 0, null, E_INVALID_OPERATION, "[E_INVALID_OPERATION] This node has no child.");
781 return TN_CONST_CAST(__children.GetAt(index));
785 _TransactionNode::AddChild(_TransactionNode& child)
787 result r = __children.Add(child);
788 SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Propagating.");
790 child.SetParent(*this);
796 _TransactionNode::RemoveChild(int transactionId)
798 SysTryReturnVoidResult(NID_UI_ANIM, transactionId > 0, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(s) is used. transactionId = %d", transactionId);
800 int childrenCount = GetChildrenCount();
802 if (childrenCount <= 0)
807 _TransactionNode* pChild = null;
809 for (int index = 0; index < childrenCount; index++)
811 pChild = TN_CAST(__children.GetAt(index));
813 if (pChild->GetId() == transactionId)
815 if (pChild->IsReservedRemove() == false)
819 pChild->ReservedRemove();
821 pChild->NotifyTransactionStatus(false);
823 RemoveChild(*pChild);
828 pChild->RemoveChild(transactionId);
833 _TransactionNode::RemoveChild(_TransactionNode& child)
835 if (child.IsInAnimationTick())
837 child.ReservedRemove();
841 result r = __children.Remove(child, true);
843 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to remove child.", GetErrorMessage(r));
848 _TransactionNode::RemoveAll(void) //TODO: rename RemoveAll()
850 _TransactionNode* pChild = null;
852 int childrenCount = GetChildrenCount();
854 for (int index = childrenCount-1; index >= 0; index--)
856 pChild = TN_CAST(__children.GetAt(index));
858 if (pChild->IsReservedRemove() == false)
862 pChild->ReservedRemove(true);
864 pChild->NotifyTransactionStatus(false);
866 RemoveChild(*pChild);
870 RemoveAllAnimations();
874 _TransactionNode::GetAnimationCount(void) const
877 return __animations.GetCount();
881 _TransactionNode::GetAnimationDataInPending(VisualElement& target, const String& keyName) const
883 int pendingCount = __pendingAnimations.GetCount();
885 _AnimationData* pAnimationData = null;
887 for (int index = 0; index < pendingCount; index++)
889 pAnimationData = AD_CONST_CAST(__pendingAnimations.GetAt(index));
891 if (&(pAnimationData->GetTarget()) == &target && pAnimationData->IsRemoved() == false)
893 if (pAnimationData->GetName() == keyName)
895 return pAnimationData;
904 _TransactionNode::GetAnimationDataInPendingByProperty(VisualElement& target, const String& property) const
906 int pendingCount = __pendingAnimations.GetCount();
908 _AnimationData* pAnimationData = null;
909 VisualElementPropertyAnimation* pPropertyAnimation = null;
911 for (int index = 0; index < pendingCount; index++)
913 pAnimationData = AD_CONST_CAST(__pendingAnimations.GetAt(index));
915 if (&(pAnimationData->GetTarget()) == &target && pAnimationData->IsRemoved() == false)
917 pPropertyAnimation = dynamic_cast< VisualElementPropertyAnimation* >(&(pAnimationData->GetAnimation()));
919 if(pPropertyAnimation != null && pPropertyAnimation->GetPropertyName() == property)
921 return pAnimationData;
930 _TransactionNode::AddAnimationData(_AnimationData& animationData)
932 result r = E_SUCCESS;
934 ArrayList* pAnimationList = null;
935 VisualElement* pTarget = &(animationData.GetTarget());
937 __animations.GetValue(pTarget, pAnimationList);
939 if (pAnimationList == null)
941 pAnimationList = new (std::nothrow) ArrayList();
942 SysTryReturnResult(NID_UI_ANIM, pAnimationList != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
944 r = pAnimationList->Construct();
945 SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Failed to construct animation list.");
947 __animations.Add(pTarget, pAnimationList);
950 // base time for root
951 animationData.SetBaseTime(_AnimationTime::GetTime());
952 animationData.SetPendingMode(_AnimationData::_PENDING_MODE_NONE);
954 return pAnimationList->Add(animationData);
958 _TransactionNode::RemoveAnimationData(_AnimationData& animationData)
960 ArrayList* pAnimationList = null;
961 VisualElement* pTarget = &(animationData.GetTarget());
963 __animations.GetValue(pTarget, pAnimationList);
965 if (pAnimationList == null)
970 pAnimationList->Remove(animationData, true);
972 if (pAnimationList->GetCount() <= 0)
974 __animations.Remove(pTarget);
976 delete pAnimationList;
981 _TransactionNode::SetAnimationDataAsPending(_AnimationData& animationData, bool remove, bool completed)
983 result r = E_SUCCESS;
987 if (animationData.IsRemoved())
992 if (animationData.GetPendingMode() == _AnimationData::_PENDING_MODE_NONE)
994 r = __pendingAnimations.Add(animationData);
997 animationData.SetPendingMode(_AnimationData::_PENDING_MODE_REMOVING);
999 animationData.NotifyAnimationFinished(completed);
1001 animationData.SetPendingMode(_AnimationData::_PENDING_MODE_REMOVE);
1005 animationData.SetPendingMode(_AnimationData::_PENDING_MODE_ADD);
1007 r = __pendingAnimations.Add(animationData);
1014 _TransactionNode::AddAnimation(VisualElement& target, const String* pKeyName, VisualElementAnimation& animation)
1016 result r = E_SUCCESS;
1018 _AnimationData* pAnimationData = new (std::nothrow) _AnimationData(target, pKeyName, animation);
1019 SysTryReturnResult(NID_UI_ANIM, pAnimationData != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
1021 if (__isInAnimationTick == true)
1023 r = SetAnimationDataAsPending(*pAnimationData, false);
1027 r = AddAnimationData(*pAnimationData);
1032 delete pAnimationData;
1041 _TransactionNode::RemoveAnimation(VisualElement& target, const String& keyName)
1043 if (GetAnimationCount() <= 0)
1045 return E_OBJ_NOT_FOUND;
1048 result r = E_OBJ_NOT_FOUND;
1050 _AnimationData* pAnimationData = GetAnimationDataInPending(target, keyName);
1052 if (pAnimationData != null)
1054 r = SetAnimationDataAsPending(*pAnimationData, true, false);
1055 SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Failed to add to pending list.");
1060 ArrayList* pAnimationList = null;
1062 __animations.GetValue(&target, pAnimationList);
1064 if (pAnimationList == null)
1066 return E_OBJ_NOT_FOUND;
1069 int animationCount = pAnimationList->GetCount();
1071 for (int index = 0; index < animationCount; index++)
1073 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1075 if (pAnimationData->IsRemoved() == false)
1077 if (pAnimationData->GetName() == keyName)
1079 r = SetAnimationDataAsPending(*pAnimationData, true, false);
1080 SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Failed to add to pending list.");
1087 ProcessPendingAnimations();
1093 _TransactionNode::RemoveChildrenAnimation(VisualElement& target, const String& keyName)
1095 SysTryReturnResult(NID_UI_ANIM, keyName.IsEmpty() == false, E_OBJ_NOT_FOUND, "keyName is empty.");
1097 if (RemoveAnimation(target, keyName) == E_SUCCESS)
1102 int childrenCount = GetChildrenCount();
1104 if (childrenCount <= 0)
1106 return E_OBJ_NOT_FOUND;
1109 _TransactionNode* pChild = null;
1110 _AnimationGroupNode* pGroup = null;
1112 for (int index = 0; index < childrenCount; index++)
1114 pChild = TN_CAST(__children.GetAt(index));
1115 pGroup = dynamic_cast< _AnimationGroupNode* >(pChild);
1117 if (pGroup != null && pGroup->IsEqual(target, keyName))
1119 pChild->NotifyTransactionStatus(false);
1121 RemoveChild(*pChild);
1124 else if (pChild->RemoveChildrenAnimation(target, keyName) == E_SUCCESS)
1130 return E_OBJ_NOT_FOUND;
1134 _TransactionNode::RemoveAnimationByProperty(VisualElement& target, const String& property)
1136 if (GetAnimationCount() <= 0)
1141 result r = E_OBJ_NOT_FOUND;
1143 _AnimationData* pAnimationData = GetAnimationDataInPendingByProperty(target, property);
1145 if (pAnimationData != null)
1147 r = SetAnimationDataAsPending(*pAnimationData, true, false);
1148 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to add to pending list.", GetErrorMessage(r));
1153 ArrayList* pAnimationList = null;
1155 __animations.GetValue(&target, pAnimationList);
1157 if (pAnimationList == null)
1162 VisualElementPropertyAnimation* pPropertyAnimation = null;
1164 int animationCount = pAnimationList->GetCount();
1166 for (int index = 0; index < animationCount; index++)
1168 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1170 if (pAnimationData->IsRemoved() == false)
1172 pPropertyAnimation = dynamic_cast< VisualElementPropertyAnimation* >(&(pAnimationData->GetAnimation()));
1174 if (pPropertyAnimation != null && pPropertyAnimation->GetPropertyName() == property)
1176 r = SetAnimationDataAsPending(*pAnimationData, true, false);
1177 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to add to pending list.", GetErrorMessage(r));
1184 ProcessPendingAnimations();
1188 _TransactionNode::RemoveChildrenAnimationByProperty(VisualElement& target, const String& property)
1190 RemoveAnimationByProperty(target, property);
1192 int childrenCount = GetChildrenCount();
1194 if (childrenCount <= 0)
1199 _TransactionNode* pChild = null;
1201 for (int index = 0; index < childrenCount; index++)
1203 pChild = TN_CAST(__children.GetAt(index));
1205 pChild->RemoveChildrenAnimationByProperty(target, property);
1210 _TransactionNode::RemoveAllAnimations(void)
1212 if (GetAnimationCount() <= 0)
1217 // use key list because map item would be removed
1218 IListT<VisualElement*>* pKeyList = __animations.GetKeysN();
1219 SysTryReturnVoidResult(NID_UI_ANIM, pKeyList != null, E_SYSTEM, "[E_SYSTEM] Failed to add to animation.");
1221 VisualElement* pTarget = null;
1223 for (int index = 0; index < pKeyList->GetCount(); index++)
1225 pKeyList->GetAt(index, pTarget);
1227 if (pTarget != null)
1229 RemoveAllAnimations(*pTarget);
1235 __animations.RemoveAll();
1239 _TransactionNode::RemoveAllAnimations(VisualElement& target)
1241 if (GetAnimationCount() <= 0)
1246 ArrayList* pAnimationList = null;
1248 __animations.GetValue(&target, pAnimationList);
1250 if (pAnimationList == null)
1255 result r = E_SUCCESS;
1256 _AnimationData* pAnimationData = null;
1258 int animationCount = pAnimationList->GetCount();
1260 for (int index = 0; index < animationCount; index++)
1262 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1264 r = SetAnimationDataAsPending(*pAnimationData, true, false);
1265 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to add to pending list.", GetErrorMessage(r));
1268 ProcessPendingAnimations();
1272 _TransactionNode::RemoveChildrenAllAnimations(VisualElement& target)
1274 RemoveAllAnimations(target);
1276 int childrenCount = GetChildrenCount();
1278 if (childrenCount <= 0)
1283 _TransactionNode* pChild = null;
1285 for (int index = childrenCount-1; index >= 0; index--)
1287 pChild = TN_CAST(__children.GetAt(index));
1289 pChild->RemoveChildrenAllAnimations(target);
1291 if (pChild->IsReservedRemove() == false && pChild->IsCommitted() == true && pChild->IsEmpty() == true)
1293 pChild->NotifyTransactionStatus(false);
1295 RemoveChild(*pChild);
1300 const VisualElementAnimation*
1301 _TransactionNode::GetAnimation(VisualElement& target, const String& keyName) const
1303 if (GetAnimationCount() <= 0)
1308 _AnimationData* pAnimationData = GetAnimationDataInPending(target, keyName);
1310 if (pAnimationData != null)
1312 return &(pAnimationData->GetAnimation());
1315 ArrayList* pAnimationList = null;
1317 __animations.GetValue(&target, pAnimationList);
1319 if (pAnimationList == null)
1324 int animationCount = pAnimationList->GetCount();
1326 for (int index = 0; index < animationCount; index++)
1328 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1330 if (pAnimationData->IsRemoved() == false)
1332 if (pAnimationData->GetName() == keyName)
1334 return &(pAnimationData->GetAnimation());
1342 const VisualElementAnimation*
1343 _TransactionNode::GetChildrenAnimation(VisualElement& target, const String& keyName) const
1345 SysTryReturn(NID_UI_ANIM, keyName.IsEmpty() == false, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] keyName is empty.");
1347 const VisualElementAnimation* pAnimation = GetAnimation(target, keyName);
1349 if (pAnimation != null)
1354 int childrenCount = GetChildrenCount();
1356 if (childrenCount <= 0)
1361 _TransactionNode* pChild = null;
1362 _AnimationGroupNode* pGroup = null;
1364 for (int index = 0; index < childrenCount; index++)
1366 pChild = TN_CONST_CAST(__children.GetAt(index));
1367 pGroup = dynamic_cast< _AnimationGroupNode* >(pChild);
1369 if (pGroup != null && pGroup->IsEqual(target, keyName))
1371 pAnimation = &(pGroup->GetAnimation());
1375 pAnimation = pChild->GetChildrenAnimation(target, keyName);
1378 if (pAnimation != null)
1387 const VisualElementAnimation*
1388 _TransactionNode::GetAnimationByProperty(VisualElement& target, const String& property) const
1390 if (GetAnimationCount() <= 0)
1395 _AnimationData* pAnimationData = GetAnimationDataInPendingByProperty(target, property);
1397 if (pAnimationData != null)
1399 return &(pAnimationData->GetAnimation());
1402 ArrayList* pAnimationList = null;
1404 __animations.GetValue(&target, pAnimationList);
1406 if (pAnimationList == null)
1411 const VisualElementPropertyAnimation* pPropertyAnimation = null;
1413 int animationCount = pAnimationList->GetCount();
1415 for (int index = 0; index < animationCount; index++)
1417 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1419 if (pAnimationData->IsRemoved() == false)
1421 pPropertyAnimation = dynamic_cast< VisualElementPropertyAnimation* >(&(pAnimationData->GetAnimation()));
1423 if (pPropertyAnimation != null && pPropertyAnimation->GetPropertyName() == property)
1430 return pPropertyAnimation;
1433 const VisualElementAnimation*
1434 _TransactionNode::GetChildrenAnimationByProperty(VisualElement& target, const String& property) const
1436 const VisualElementAnimation* pAnimation = GetAnimationByProperty(target, property);
1438 if (pAnimation != null)
1443 int childrenCount = GetChildrenCount();
1445 if (childrenCount <= 0)
1450 _TransactionNode* pChild = null;
1452 for (int index = 0; index < childrenCount; index++)
1454 pChild = TN_CONST_CAST(__children.GetAt(index));
1456 pAnimation = pChild->GetChildrenAnimationByProperty(target, property);
1458 if (pAnimation != null)
1468 _TransactionNode::SetBaseTime(unsigned int baseTime)
1470 if (GetAnimationCount() <= 0)
1475 IMapEnumeratorT<VisualElement*, ArrayList*>* pMapEnum = __animations.GetMapEnumeratorN();
1477 ArrayList* pAnimationList = null;
1478 _AnimationData* pAnimationData = null;
1480 while (pMapEnum->MoveNext() == E_SUCCESS)
1482 pMapEnum->GetValue(pAnimationList);
1484 if (pAnimationList == null)
1489 int animationCount = pAnimationList->GetCount();
1491 for (int index = 0; index < animationCount; index++)
1493 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1495 pAnimationData->SetBaseTime(baseTime);
1503 _TransactionNode::SetChildrenBaseTime(unsigned int baseTime, bool self)
1507 __baseTime = baseTime;
1508 __adjustedBaseTime = __baseTime;
1510 if (__status == _STATUS_END)
1512 __status = _STATUS_READY;
1516 SetBaseTime(baseTime);
1518 int childrenCount = GetChildrenCount();
1520 if (childrenCount <= 0)
1525 _TransactionNode* pChild = null;
1527 for (int index = 0; index < childrenCount; index++)
1529 pChild = TN_CAST(__children.GetAt(index));
1531 pChild->SetChildrenBaseTime(baseTime, true);
1536 _TransactionNode::Commit(void)
1538 __isCommitted = true;
1542 _TransactionNode::IsCommitted(bool ancestors) const
1544 if (ancestors == true)
1546 if (__isCommitted == false)
1548 return __isCommitted;
1551 bool isCommitted = true;
1553 if (__pParent != null)
1555 isCommitted = __pParent->IsCommitted();
1558 return (isCommitted && __isCommitted);
1561 return __isCommitted;
1565 _TransactionNode::IsEmpty(void) const
1567 return (GetAnimationCount() <= 0 && GetChildrenCount() <= 0);
1571 _TransactionNode::IsRunning(void) const
1573 return (__status > _STATUS_READY && __status < _STATUS_STOP);
1577 _TransactionNode::ReservedRemove(bool remove)
1579 __isReservedRemove = remove;
1583 _TransactionNode::IsReservedRemove(void) const
1585 return __isReservedRemove;
1589 _TransactionNode::IsRemovable(void) const
1595 _TransactionNode::IsInAnimationTick(void)
1597 if (__isInAnimationTick == true)
1602 int childrenCount = GetChildrenCount();
1604 if (childrenCount <= 0)
1609 _TransactionNode* pChild = null;
1611 for (int index = 0; index < childrenCount; index++)
1613 pChild = TN_CAST(__children.GetAt(index));
1615 if (pChild->IsInAnimationTick() == true)
1625 _TransactionNode::CalculateProgress(unsigned int currentTime)
1627 if (__status == _STATUS_READY)
1629 __status = _STATUS_START;
1633 __status = _STATUS_RUNNING;
1638 _TransactionNode::NotifyTransactionStatus(bool completed)
1640 if (__isCommitted == false)
1645 IAnimationTransactionEventListener* pListener = null;
1647 pListener = (__pListener != null) ? __pListener : __pDefaultListener;
1649 // root transaction doesn't has default listener
1650 if (pListener == null)
1655 if (completed == false)
1657 pListener->OnAnimationTransactionStopped(__id);
1664 pListener->OnAnimationTransactionStarted(__id);
1668 pListener->OnAnimationTransactionFinished(__id);
1677 _TransactionNode::RemoveAnimationByDuplicatedProperty(_AnimationData& animationData)
1679 VisualElementPropertyAnimation* pPropertyAnimation = dynamic_cast< VisualElementPropertyAnimation* >(&(animationData.GetAnimation()));
1681 if (pPropertyAnimation == null)
1686 VisualElement* pTarget = &(animationData.GetTarget());
1688 ArrayList* pAnimationList = null;
1690 __animations.GetValue(pTarget, pAnimationList);
1692 if (pAnimationList != null)
1694 _AnimationData* pRemoveAnimationData = null;
1695 VisualElementPropertyAnimation* pRemovePropertyAnimation = null;
1697 int animationCount = pAnimationList->GetCount();
1699 for (int index = 0; index < animationCount; index++)
1701 pRemoveAnimationData = AD_CAST(pAnimationList->GetAt(index));
1703 if (&animationData == pRemoveAnimationData)
1708 pRemovePropertyAnimation = dynamic_cast< VisualElementPropertyAnimation* >(&(pRemoveAnimationData->GetAnimation()));
1710 if (pRemovePropertyAnimation && pRemovePropertyAnimation->GetPropertyName() == pPropertyAnimation->GetPropertyName())
1712 result r = SetAnimationDataAsPending(*pRemoveAnimationData, true, false);
1713 SysTryReturn(NID_UI_ANIM, r == E_SUCCESS, r, false, "[%s] Failed to add to pending list.", GetErrorMessage(r));
1715 //TODO: refactoring for group
1716 if (IsRemovable() == false && pRemoveAnimationData->GetStatus() != _AnimationData::_STATUS_READY)
1718 pRemoveAnimationData->SetStatus(_AnimationData::_STATUS_END);
1719 pRemoveAnimationData->SetPendingMode(_AnimationData::_PENDING_MODE_NONE);
1720 __pendingAnimations.Remove(*pRemoveAnimationData, false);
1726 int childrenCount = GetChildrenCount();
1728 if (childrenCount <= 0)
1733 _TransactionNode* pChild = null;
1735 for (int index = 0; index < childrenCount; index++)
1737 pChild = TN_CAST(__children.GetAt(index));
1739 if (pChild->RemoveAnimationByDuplicatedProperty(animationData))
1749 _TransactionNode::ProcessPendingAnimations(void)
1751 if (__isInAnimationTick == true)
1756 if (__pendingAnimations.GetCount() <= 0)
1761 _AnimationData* pAnimationData = null;
1762 int pendingAnimationCount = __pendingAnimations.GetCount();
1764 for (int index = 0; index < pendingAnimationCount; index++)
1766 pAnimationData = AD_CAST(__pendingAnimations.GetAt(index));
1768 switch(pAnimationData->GetPendingMode())
1770 case _AnimationData::_PENDING_MODE_ADD:
1772 if (AddAnimationData(*pAnimationData) != E_SUCCESS)
1774 delete pAnimationData;
1779 case _AnimationData::_PENDING_MODE_REMOVE:
1781 RemoveAnimationData(*pAnimationData);
1789 __pendingAnimations.RemoveAll(false);
1793 _TransactionNode::ProcessAnimationTick(unsigned int tick)
1795 if (__isCommitted == false)
1800 if (__baseTime > tick) // this node is added in animation tick
1805 CalculateProgress(tick);
1807 if (__status == _STATUS_READY)
1812 if (__status != _STATUS_STOP)
1814 NotifyTransactionStatus(true);
1817 if (IsReservedRemove() == true)
1822 OnAnimationTick(tick);
1824 _TransactionNode* pChild = null;
1826 for (int index = 0; index < GetChildrenCount(); index++)
1828 pChild = TN_CAST(__children.GetAt(index));
1830 if (pChild->IsReservedRemove())
1832 RemoveChild(*pChild);
1838 pChild->ProcessAnimationTick(tick);
1840 if (pChild->__status == _STATUS_STOP)
1842 pChild->ReservedRemove();
1844 pChild->NotifyTransactionStatus(true);
1846 if (pChild->IsRemovable()) // only nested group
1848 RemoveChild(*pChild);
1853 pChild->ReservedRemove(false);
1858 if (IsEmpty() == true)
1860 __status = _STATUS_STOP;
1865 _TransactionNode::OnAnimationTick(unsigned int tick)
1867 if (GetAnimationCount() <= 0)
1872 __isInAnimationTick = true;
1874 IMapEnumeratorT<VisualElement*, Tizen::Base::Collection::ArrayList*>* pMapEnum = __animations.GetMapEnumeratorN();
1875 SysTryReturnVoidResult(NID_UI_ANIM, (pMapEnum != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1877 VisualElement* pTarget = null;
1878 ArrayList* pAnimationList = null;
1879 _AnimationData* pAnimationData = null;
1881 while (pMapEnum->MoveNext() == E_SUCCESS)
1883 pMapEnum->GetKey(pTarget); //TODO: remove
1884 pMapEnum->GetValue(pAnimationList);
1886 if (pTarget == null || pAnimationList == null)
1891 int animationCount = pAnimationList->GetCount();
1893 for (int index = 0; index < animationCount; index++)
1895 pAnimationData = AD_CAST(pAnimationList->GetAt(index));
1897 // Send finish notification
1898 if (pAnimationData->GetStatus() == _AnimationData::_STATUS_STOP)
1900 SetAnimationDataAsPending(*pAnimationData, true, true);
1902 //TODO: refactoring for group
1903 if (IsRemovable() == false)
1905 pAnimationData->SetPendingMode(_AnimationData::_PENDING_MODE_NONE);
1906 __pendingAnimations.Remove(*pAnimationData, false);
1910 if (pAnimationData->IsRemoved())
1915 Variant currentValue = pAnimationData->CalculateValueByTime(tick);
1917 // check same property animation
1918 if (pAnimationData->GetStatus() == _AnimationData::_STATUS_START)
1920 __pRoot->RemoveAnimationByDuplicatedProperty(*pAnimationData);
1923 // Send start, repeat notification
1924 if (pAnimationData->GetStatus() != _AnimationData::_STATUS_STOP)
1926 pAnimationData->NotifyAnimationStatus(true);
1929 pAnimationData->OnTickOccurred(*pTarget, currentValue);
1935 __isInAnimationTick = false;
1937 ProcessPendingAnimations();
1940 _AnimationGroupNode::_AnimationGroupNode(VisualElement& target, const Tizen::Base::String* pName, VisualElementAnimation& animation)
1941 : _TransactionNode()
1943 , __animation(animation)
1944 , __deleteAnimation(false)
1945 , __totalDuration(0)
1953 _VisualElementAnimationImpl* pAnimationImpl = _VisualElementAnimationImpl::GetInstance(animation);
1955 result r = CopyAnimationValue(*pAnimationImpl);
1956 SysTryReturnVoidResult(NID_UI_ANIM, r == E_SUCCESS, r, "[%s] Failed to copy the animation value.", GetErrorMessage(r));
1958 // __pAnimation->GetRepeatCount() == 0 infinite
1959 __totalDuration = __animation.GetDelay() + (__animation.GetDuration() * __animation.GetRepeatCount()) - __animation.GetOffset();
1961 if (GetDuration() == 0)
1967 #ifdef VE_DEBUG_MODULE
1972 _AnimationGroupNode::~_AnimationGroupNode(void)
1974 if (__deleteAnimation == true)
1976 delete &__animation;
1980 VisualElementAnimation&
1981 _AnimationGroupNode::GetAnimation(void) const
1987 _AnimationGroupNode::IsEqual(VisualElement& target, const Tizen::Base::String& keyName) const
1989 return (&__target == &target && __name == keyName);
1993 _AnimationGroupNode::Commit(void)
1995 __isCommitted = true;
1997 if (dynamic_cast< _AnimationGroupNode* > (__pParent) == null)
1999 __deleteAnimation = true;
2004 _AnimationGroupNode::IsRemovable(void) const
2006 return (__pParent->IsRemovable() && __currentRepeatCount == GetRepeatCount());
2010 _AnimationGroupNode::CalculateProgress(unsigned int currentTime)
2012 long oldRepeatCount = 0;
2013 long repeatCount = 0;
2019 #ifdef VE_DEBUG_MODULE
2020 if (_VeDebug::IsDebugEnabled())
2026 if (__status == _STATUS_END)
2031 if (__status == _STATUS_STOP)
2033 __status = _STATUS_END;
2038 if (GetScaleRatio() > 0.f)
2040 currentTime = (unsigned int) ((currentTime - __baseTime) / GetScaleRatio()); // Apply time scale value
2045 if (currentTime < (unsigned int)(delay))
2048 __currentRepeatCount = 1;
2054 offset = __animation.GetOffset();
2055 repeatCount = __animation.GetRepeatCount();
2056 duration = __animation.GetDuration();
2063 oldRepeatCount = __currentRepeatCount;
2064 __currentRepeatCount = ((currentTime - delay + offset) / duration) + 1;
2066 __progress = static_cast< float >(currentTime - (delay + duration * (__currentRepeatCount - 1) - offset)) / static_cast< float >(duration);
2068 if (__status == _STATUS_READY)
2070 __status = _STATUS_START;
2071 __adjustedBaseTime = delay - offset; // __currentRepeatCount is always 1
2073 SetChildrenBaseTime(__baseTime + __adjustedBaseTime, false);
2075 else if (repeatCount > 0 && currentTime >= __totalDuration) // infinite loop if repeatCount == 0
2077 __currentRepeatCount = repeatCount;
2080 __status = _STATUS_STOP;
2082 else if (__currentRepeatCount > oldRepeatCount)
2084 __status = _STATUS_REPEAT;
2085 __adjustedBaseTime = delay + duration * (__currentRepeatCount - 1) - offset;
2087 SetChildrenBaseTime(__baseTime + __adjustedBaseTime, false);
2091 __status = _STATUS_RUNNING;
2096 _AnimationGroupNode::NotifyTransactionStatus(bool completed)
2098 if (__status == _STATUS_END)
2102 if (__isCommitted == false)
2107 _VisualElementAnimationImpl* pAnimationImpl = _VisualElementAnimationImpl::GetInstance(__animation);
2109 IVisualElementAnimationStatusEventListener* pListener = pAnimationImpl->GetStatusEventListener();
2111 if (pListener == null)
2116 if (completed == false)
2118 pListener->OnVisualElementAnimationFinished(__animation, __name, pAnimationImpl->GetEventTarget(), false);
2125 pListener->OnVisualElementAnimationStarted(__animation, __name, pAnimationImpl->GetEventTarget());
2128 case _STATUS_REPEAT:
2129 pListener->OnVisualElementAnimationRepeated(__animation, __name, pAnimationImpl->GetEventTarget(), __currentRepeatCount);
2133 pListener->OnVisualElementAnimationFinished(__animation, __name, pAnimationImpl->GetEventTarget(), true);
2142 }}} // Tizen::Ui::Animations