Fix FrameAnimator's Form Transition error
authorkhee85.lee <khee85.lee@samsung.com>
Mon, 30 Sep 2013 02:16:27 +0000 (11:16 +0900)
committerkhee85.lee <khee85.lee@samsung.com>
Tue, 1 Oct 2013 06:55:16 +0000 (15:55 +0900)
Change-Id: Ic4d6e4f1d852b84eb3d0819d8d8f9bc17ff66f5e
Signed-off-by: khee85.lee <khee85.lee@samsung.com>
src/ui/animations/FUiAnim_FrameAnimatorImpl.cpp
src/ui/animations/FUiAnim_FrameAnimatorImpl.h

index c3ab54b..86c9bf7 100644 (file)
@@ -354,6 +354,40 @@ _FrameAnimatorImpl::ChangeCurrentForm(Form* pCurrentForm, Form& nextForm)
        __frameAnimatorStatus = ANIMATOR_STATUS_PLAYING;
        return E_SUCCESS;
 }
+float
+_FrameAnimatorImpl::CalculateChangedAngle()
+{
+       float angle = 0.0f;
+       int diff = __pNextForm->GetOrientationStatus() - __pCurrentForm->GetOrientationStatus() ;
+
+       switch(diff)
+       {
+               case 1:
+               case -1:
+               {
+                       angle = 90.0f;
+                       break;
+               }
+               case 2:
+               case -2:
+               {
+                       angle = 180.0f;
+                       break;
+               }
+               case 3:
+               case -3:
+               {
+                       angle = 270.0f;
+                       break;
+               }
+       }
+
+       if(diff > 0)
+       {
+               angle *= -1;
+       }
+       return angle;
+}
 
 result
 _FrameAnimatorImpl::SetAnimations(void)
@@ -363,106 +397,196 @@ _FrameAnimatorImpl::SetAnimations(void)
        String transId = "";
        transId.Append(__transactionId);
 
+       float angle = 0.0f;
+
        switch (__animationEffectType)
        {
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_TRANSLATE_LEFT:
        {
+               angle = CalculateChangedAngle();
+
                Dimension currentSize = __pCurrentForm->GetSize();
                Dimension nextSize = __pNextForm->GetSize();
 
                Point currFormStartPoint = Point(0, 0);
-               Point currFormEndPoint = Point((-1 * (currentSize.width)), 0);
+               Point currFormEndPoint = Point((-1 * (nextSize.width)), 0);
 
-               Point nextFormStartPoint = Point((currentSize.width), 0);
+               Point nextFormStartPoint = Point((nextSize.width), 0);
                Point nextFormEndPoint = Point(0, 0);
 
-               if (currentSize.width > nextSize.width)
+               if (unlikely(angle != 0.0f))
                {
-                       currFormStartPoint = Point((-1 * (currentSize.width - nextSize.width)), 0);
-                       nextFormStartPoint = Point((nextSize.width), 0);
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               currFormStartPoint = Point((currentSize.height - currentSize.width)/2,-(currentSize.height - currentSize.width)/2);
+                               currFormEndPoint = Point((currentSize.height - currentSize.width)/2 -nextSize.width, -(currentSize.height - currentSize.width)/2);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               currFormStartPoint = Point(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2);
+                               currFormEndPoint = Point(-(currentSize.width - currentSize.height)/2 -nextSize.width, (currentSize.width - currentSize.height)/2);
+                       }
                }
 
-               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_POSITION, Variant(currFormStartPoint), Variant(currFormEndPoint), transId + (L"CurrentFormLeftTranslatePosition"));
+               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_POSITION, Variant(currFormStartPoint), Variant(currFormEndPoint), transId + (L"CurrentFormLeftTranslatePosition"), angle);
         SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_POSITION, Variant(nextFormStartPoint), Variant(nextFormEndPoint), transId + (L"NextFormLeftTranslatePosition"));
+               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_POSITION, Variant(nextFormStartPoint), Variant(nextFormEndPoint), transId + (L"NextFormLeftTranslatePosition"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
        }
        break;
 
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_TRANSLATE_RIGHT:
        {
+               angle = CalculateChangedAngle();
+
                Dimension currentSize = __pCurrentForm->GetSize();
                Dimension nextSize = __pNextForm->GetSize();
 
                Point currFormStartPoint = Point(0, 0);
-               Point currFormEndPoint = Point((nextSize.width), 0);
+               Point currFormEndPoint = Point(nextSize.width, 0);
 
-               Point nextFormStartPoint = Point((-1 * (nextSize.width)), 0);
+               Point nextFormStartPoint = Point(-1 * (nextSize.width), 0);
                Point nextFormEndPoint = Point(0, 0);
 
-               if (currentSize.width < nextSize.width)
+               if (unlikely(angle != 0.0f))
                {
-                       currFormStartPoint = Point((nextSize.width - currentSize.width), 0);
-                       nextFormStartPoint = Point((-1 * (currentSize.width)), 0);
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               currFormStartPoint = Point((currentSize.height - currentSize.width)/2, -(currentSize.height - currentSize.width)/2);
+                               currFormEndPoint = Point((currentSize.height - currentSize.width)/2 + nextSize.width, -(currentSize.height - currentSize.width)/2);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               currFormStartPoint = Point(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2);//
+                               currFormEndPoint = Point(-(currentSize.width - currentSize.height)/2 + nextSize.width, (currentSize.width - currentSize.height)/2);
+                       }
                }
 
-               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_POSITION, Variant(currFormStartPoint), Variant(currFormEndPoint), transId + (L"CurrentFormRightTranslatePosition"));
+               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_POSITION, Variant(currFormStartPoint), Variant(currFormEndPoint), transId + (L"CurrentFormRightTranslatePosition"), angle);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list");
 
-               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_POSITION, Variant(nextFormStartPoint), Variant(nextFormEndPoint), transId + (L"NextFormRightTranslatePosition"));
+               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_POSITION, Variant(nextFormStartPoint), Variant(nextFormEndPoint), transId + (L"NextFormRightTranslatePosition"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list");
        }
        break;
 
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_FADE_IN_OUT:
        {
+               angle = CalculateChangedAngle();
+
                r = PrepareCapture();
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to capture.");
 
-//             r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormFadeOutAlpha"));
-//             SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Failed to add animation to play list.");
+               Dimension currentSize = __pCurrentForm->GetSize();
+               Dimension nextSize = __pNextForm->GetSize();
+
+               FloatRectangle tempBounds = __pCurrentFormVisualElement->GetBounds();
+
+               if (unlikely(angle != 0.0f))
+               {
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               tempBounds = FloatRectangle((currentSize.height - currentSize.width)/2, -(currentSize.height - currentSize.width)/2, currentSize.width, currentSize.height);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               tempBounds = FloatRectangle(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2, currentSize.width, currentSize.height);//
+                       }
+                       __pCurrentCaptureVisualElement->SetBounds(tempBounds);
+
+                       VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
+                       pAnimation->SetPropertyName(L"transform.rotation.z");
+                       pAnimation->SetStartValue(Variant(angle));
+                       pAnimation->SetEndValue(Variant(angle));
+                       pAnimation->SetDuration(__duration);
+                       pAnimation->SetEndValueApplied(false);
+                       __pCurrentCaptureVisualElement->AddAnimation(L"transform", *pAnimation);
+                       delete pAnimation;
+               }
+
+//             r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormFadeOutAlpha"), angle);
+//             SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormFadeInAlpha"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormFadeInAlpha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
        }
        break;
 
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_ZOOM_IN:
        {
+               angle = CalculateChangedAngle();
+
+               r = PrepareCapture();
+               SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to capture.");
+
                Dimension currentSize = __pCurrentForm->GetSize();
+               Dimension nextSize = __pNextForm->GetSize();
+
+               FloatRectangle tempBounds = __pCurrentFormVisualElement->GetBounds();
 
                Dimension startSize = Dimension((currentSize.width * 80) / 100, (currentSize.height * 80) / 100);
                Dimension endSize = currentSize;
 
-               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormZoomInAlpha"));
+               if (unlikely(angle != 0.0f))
+               {
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               tempBounds = FloatRectangle((currentSize.height - currentSize.width)/2, -(currentSize.height - currentSize.width)/2, currentSize.width, currentSize.height);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               tempBounds = FloatRectangle(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2, currentSize.width, currentSize.height);//
+                       }
+                       __pCurrentCaptureVisualElement->SetBounds(tempBounds);
+               }
+
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormZoomInAlpha"), angle);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormZoomInAlpha"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormZoomInAlpha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_SIZE, Variant(startSize), Variant(endSize), transId + (L"NextFormZoomInSize"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(startSize), Variant(endSize), transId + (L"NextFormZoomInSize"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
        }
        break;
 
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_ZOOM_OUT:
        {
+               angle = CalculateChangedAngle();
+
                r = PrepareCapture();
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to capture.");
 
                Dimension currentSize = __pCurrentForm->GetSize();
+               Dimension nextSize = __pNextForm->GetSize();
+
+               FloatRectangle tempBounds = __pCurrentFormVisualElement->GetBounds();
 
                Dimension startSize = currentSize;
                Dimension endSize = Dimension((currentSize.width * 80) / 100, (currentSize.height * 80) / 100);
 
-               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(startSize), Variant(endSize), transId + (L"CurrentFormZoomOutSize"));
+               if (unlikely(angle != 0.0f))
+               {
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               tempBounds = FloatRectangle((currentSize.height - currentSize.width)/2, -(currentSize.height - currentSize.width)/2, currentSize.width, currentSize.height);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               tempBounds = FloatRectangle(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2, currentSize.width, currentSize.height);//
+                       }
+                       __pCurrentCaptureVisualElement->SetBounds(tempBounds);
+               }
+
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(startSize), Variant(endSize), transId + (L"CurrentFormZoomOutSize"), angle);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormZoomOutAlpha"));
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormZoomOutAlpha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormZoomOutAlpha"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormZoomOutAlpha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
        }
        break;
@@ -470,49 +594,88 @@ _FrameAnimatorImpl::SetAnimations(void)
 
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_DEPTH_IN:
        {
+               angle = CalculateChangedAngle();
+
                r = PrepareCapture();
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to capture.");
 
                Dimension currentSize = __pCurrentForm->GetSize();
+               Dimension nextSize = __pNextForm->GetSize();
+
+               FloatRectangle tempBounds = __pCurrentFormVisualElement->GetBounds();
 
                Dimension currFormStartSize = currentSize;
                Dimension currFormEndSize = Dimension((currentSize.width * 80) / 100, (currentSize.height * 80) / 100);
                Dimension nextFormStartSize = Dimension((currentSize.width * 120) / 100, (currentSize.height * 120) / 100);
                Dimension nextFormEndSize = currentSize;
 
-               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormDepthInAplha"));
+               if (unlikely(angle != 0.0f))
+               {
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               tempBounds = FloatRectangle((currentSize.height - currentSize.width)/2, -(currentSize.height - currentSize.width)/2, currentSize.width, currentSize.height);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               tempBounds = FloatRectangle(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2, currentSize.width, currentSize.height);//
+                       }
+                       __pCurrentCaptureVisualElement->SetBounds(tempBounds);
+               }
+
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormDepthInAplha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(currFormStartSize), Variant(currFormEndSize), transId + (L"CurrentFormDepthInSize"));
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(currFormStartSize), Variant(currFormEndSize), transId + (L"CurrentFormDepthInSize"), angle);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormDepthInAplha"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormDepthInAplha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(nextFormStartSize), Variant(nextFormEndSize), transId + (L"NextFormDepthInSize"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(nextFormStartSize), Variant(nextFormEndSize), transId + (L"NextFormDepthInSize"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
        }
        break;
 
        case FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_DEPTH_OUT:
        {
+               angle = CalculateChangedAngle();
+
+               r = PrepareCapture();
+               SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to capture.");
+
                Dimension currentSize = __pCurrentForm->GetSize();
+               Dimension nextSize = __pNextForm->GetSize();
+
+               FloatRectangle tempBounds = __pCurrentFormVisualElement->GetBounds();
 
                Dimension currFormStartSize = currentSize;
                Dimension currFormEndSize = Dimension((currentSize.width * 120) / 100, (currentSize.height * 120) / 100);
                Dimension nextFormStartSize = Dimension((currentSize.width * 80) / 100, (currentSize.height * 80) / 100);
                Dimension nextFormEndSize = currentSize;
 
-               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormDepthOutAlpha"));
+               if (unlikely(angle != 0.0f))
+               {
+                       if(unlikely(currentSize.width < nextSize.width)) // to goward.
+                       {
+                               tempBounds = FloatRectangle((currentSize.height - currentSize.width)/2, -(currentSize.height - currentSize.width)/2, currentSize.width, currentSize.height);
+                       }
+                       else if(unlikely(currentSize.width > nextSize.width)) // to backward.
+                       {
+                               tempBounds = FloatRectangle(-(currentSize.width - currentSize.height)/2, (currentSize.width - currentSize.height)/2, currentSize.width, currentSize.height);//
+                       }
+                       __pCurrentCaptureVisualElement->SetBounds(tempBounds);
+               }
+
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(1.0f), Variant(0.0f), transId + (L"CurrentFormDepthOutAlpha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormDepthOutAlpha"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_ALPHA, Variant(0.0f), Variant(1.0f), transId + (L"NextFormDepthOutAlpha"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pCurrentFormVisualElement, ANIMATION_TARGET_SIZE, Variant(currFormStartSize), Variant(currFormEndSize), transId + (L"CurrentFormDepthOutSize"));
+               r = StartLayerAnimation(__pCurrentCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(currFormStartSize), Variant(currFormEndSize), transId + (L"CurrentFormDepthOutSize"), angle);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
 
-               r = StartLayerAnimation(__pNextFormVisualElement, ANIMATION_TARGET_SIZE, Variant(nextFormStartSize), Variant(nextFormEndSize), transId + (L"NextFormDepthOutSize"));
+               r = StartLayerAnimation(__pNextCaptureVisualElement, ANIMATION_TARGET_SIZE, Variant(nextFormStartSize), Variant(nextFormEndSize), transId + (L"NextFormDepthOutSize"), 0.0f);
                SysTryReturnResult(NID_UI_ANIM, (r == E_SUCCESS), E_SYSTEM, "A system error has been occurred. Failed to add animation to play list.");
        }
        break;
@@ -528,10 +691,20 @@ _FrameAnimatorImpl::SetAnimations(void)
 result
 _FrameAnimatorImpl::PrepareCapture(void)
 {
+       float bgsize = 0.0f;
        VisualElement* pParentVisualElement = __pNextFormVisualElement->GetParent();
        SysTryReturnResult(NID_UI_ANIM, (pParentVisualElement), E_SYSTEM, "A system error has been occurred. Failed to get visual element's parent.");
 
        pParentVisualElement->InsertChild(*__pBgElement, __pNextFormVisualElement, true);
+       if(__pCurrentFormVisualElement->GetBounds().width > __pCurrentFormVisualElement->GetBounds().height)
+       {
+               bgsize = __pCurrentFormVisualElement->GetBounds().width;
+       }
+       else
+       {
+               bgsize = __pCurrentFormVisualElement->GetBounds().height;
+       }
+       __pBgElement->SetBounds(FloatRectangle(0.0f, 0.0f, bgsize, bgsize));
 
        // remove dummy surface
        __pCurrentCaptureVisualElement->SetSurface(null);
@@ -576,14 +749,14 @@ _FrameAnimatorImpl::PrepareCapture(void)
        return E_SUCCESS;
 }
 
-
 result
-_FrameAnimatorImpl::StartLayerAnimation(VisualElement* pLayer, AnimationTargetType animTarget, Variant startValue, Variant endValue, String animName)
+_FrameAnimatorImpl::StartLayerAnimation(VisualElement* pLayer, AnimationTargetType animTarget, Variant startValue, Variant endValue, String animName, float angle)
 {
        result r = E_SUCCESS;
 
        Dimension startSize, endSize;
        Point startPoint, endPoint;
+       FloatRectangle tempBounds;
 
        VisualElementPropertyAnimation* propAnimation = null;
        propAnimation = new (std::nothrow) VisualElementPropertyAnimation();
@@ -668,15 +841,20 @@ _FrameAnimatorImpl::StartLayerAnimation(VisualElement* pLayer, AnimationTargetTy
                        scaleY = (float) startSize.height / (float) rect.height;
 
                        Tizen::Graphics::FloatMatrix4 startMatrix = Tizen::Graphics::FloatMatrix4();
-                       //startMatrix.SetAsIdentity(); // default value is identity matrix
+                       Tizen::Graphics::FloatMatrix4 endMatrix = Tizen::Graphics::FloatMatrix4();
+
+                       if(unlikely(angle != 0.0f))             // There is a defferece between currentform and nextform.
+                       {
+                               _MatrixUtilRotate(startMatrix, angle, 0.0f, 0.0f, 1.0f);
+                               _MatrixUtilRotate(endMatrix, angle, 0.0f, 0.0f, 1.0f);
+                       }
+
                        _MatrixUtilScale(startMatrix, scaleX, scaleY, scaleZ);
                        _MatrixUtilAtAnchor(startMatrix, anchorX, anchorY, anchorZ);
 
                        scaleX = (float) endSize.width / (float) rect.width;
                        scaleY = (float) endSize.height / (float) rect.height;
 
-                       Tizen::Graphics::FloatMatrix4 endMatrix = Tizen::Graphics::FloatMatrix4();
-                       //endMatrix.SetAsIdentity(); // default value is identity matrix
                        _MatrixUtilScale(endMatrix, scaleX, scaleY, scaleZ);
                        _MatrixUtilAtAnchor(endMatrix, anchorX, anchorY, anchorZ);
 
@@ -687,6 +865,18 @@ _FrameAnimatorImpl::StartLayerAnimation(VisualElement* pLayer, AnimationTargetTy
 
                case ANIMATION_TARGET_POSITION:
                {
+                       if(angle != 0.0f)
+                       {
+                               VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
+                               pAnimation->SetPropertyName(L"transform.rotation.z");
+                               pAnimation->SetStartValue(Variant(angle));
+                               pAnimation->SetEndValue(Variant(angle));
+                               pAnimation->SetDuration(__duration);
+                               pAnimation->SetEndValueApplied(false);
+                               pLayer->AddAnimation(L"transform", *pAnimation);
+                               delete pAnimation;
+                       }
+
                        pVePropType = VePropBounds;
 
                        FloatRectangle rect;
@@ -704,6 +894,17 @@ _FrameAnimatorImpl::StartLayerAnimation(VisualElement* pLayer, AnimationTargetTy
 
                case ANIMATION_TARGET_ALPHA:
                {
+                       if(angle != 0.0f)
+                       {
+                                       VisualElementPropertyAnimation* pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
+                                       pAnimation->SetPropertyName(L"transform.rotation.z");
+                                       pAnimation->SetStartValue(Variant(angle));
+                                       pAnimation->SetEndValue(Variant(angle));
+                                       pAnimation->SetDuration(__duration);
+                                       pAnimation->SetEndValueApplied(false);
+                                       pLayer->AddAnimation(L"transform", *pAnimation);
+                                       delete pAnimation;
+                       }
                        pVePropType = VePropOpacity;
                        propAnimation->SetStartValue(startValue);
                        propAnimation->SetEndValue(endValue);
index 43f156f..5909cbd 100644 (file)
@@ -132,7 +132,7 @@ private:
 
        result Dispose(void);
 
-       result StartLayerAnimation(VisualElement* pLayer, AnimationTargetType animTarget, Variant startValue, Variant endValue, Tizen::Base::String animName);
+       result StartLayerAnimation(VisualElement* pLayer, AnimationTargetType animTarget, Variant startValue, Variant endValue, Tizen::Base::String animName, float angle);
        result AddFrameActiveAnimation(VisualElement* _pVisualElement, FrameAnimatorFormTransitionAnimation _formAnimation,
                        VisualElementPropertyAnimation* _pPropertyAnimation, IVisualElementAnimationTimingFunction* _pTimingFunction, Tizen::Base::String _animName);
 
@@ -144,6 +144,7 @@ private:
 
        result ChangeCurrentForm(Tizen::Ui::Controls::Form* pCurrentForm, Tizen::Ui::Controls::Form& nextForm);
 
+       float CalculateChangedAngle(void);
        result SetAnimations(void);
 
        result PrepareCapture(void);