Merge "Merge branch 'tizen' into devel/new_mesh" into devel/new_mesh
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / transition-effects / cube-transition-cross-effect-impl.cpp
index 227812f..6196d91 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include "cube-transition-cross-effect-impl.h"
 
 // CLASS HEADER
 #include "cube-transition-cross-effect-impl.h"
@@ -27,7 +28,8 @@ namespace Internal
 {
 
 CubeTransitionCrossEffect::CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
 {
 
 CubeTransitionCrossEffect::CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns, Size viewAreaSize )
-: CubeTransitionEffect( numRows, numColumns, viewAreaSize)
+: CubeTransitionEffect( numRows, numColumns, viewAreaSize),
+  mDisplacementRatio( 1.f )
 {
 }
 
 {
 }
 
@@ -103,12 +105,12 @@ void CubeTransitionCrossEffect::OnStopTransition()
     for( unsigned int x = y%2; x < mNumColumns; x=x+2)
     {
       idx = y*mNumColumns + x;
     for( unsigned int x = y%2; x < mNumColumns; x=x+2)
     {
       idx = y*mNumColumns + x;
-      mBoxes[idx].SetRotation( Radian(angle), Vector3::XAXIS );
+      mBoxes[idx].SetOrientation( Radian(angle), Vector3::XAXIS );
     }
     for( unsigned int x = (y+1)%2; x < mNumColumns; x=x+2)
     {
       idx = y*mNumColumns + x;
     }
     for( unsigned int x = (y+1)%2; x < mNumColumns; x=x+2)
     {
       idx = y*mNumColumns + x;
-      mBoxes[idx].SetRotation( Radian(-angle), Vector3::YAXIS );
+      mBoxes[idx].SetOrientation( Radian(-angle), Vector3::YAXIS );
     }
   }
 }
     }
   }
 }
@@ -118,18 +120,18 @@ void CubeTransitionCrossEffect::SetupAnimation(unsigned int actorIndex, float an
 {
   if ( mFirstTransition && (!mIsToNextImage) ) // for the first transition and it is going to previous image
   {
 {
   if ( mFirstTransition && (!mIsToNextImage) ) // for the first transition and it is going to previous image
   {
-    mTiles[mContainerIndex][actorIndex].SetRotation( Radian( angle),  axis );
+    mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle),  axis );
   }
   else if( !mChangeTurningDirection )   // reset rotation, translation and color
   {
   }
   else if( !mChangeTurningDirection )   // reset rotation, translation and color
   {
-    mTiles[mContainerIndex][actorIndex].MoveBy( resetTranslation );
-    mTiles[mContainerIndex][actorIndex].SetRotation( Radian( angle),  axis );
+    mTiles[mContainerIndex][actorIndex].TranslateBy( resetTranslation );
+    mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle),  axis );
   }
   }
-  mAnimation.RotateTo( mBoxes[actorIndex], Radian( -angle ), axis, AlphaFunctions::EaseInOutSine );
+  mAnimation.AnimateTo( Property( mBoxes[actorIndex], Actor::Property::ORIENTATION ), Quaternion( Radian( -angle ), axis ), AlphaFunction::EASE_IN_OUT_SINE );
   Vector3 position(mBoxes[actorIndex].GetCurrentPosition());
   Vector3 position(mBoxes[actorIndex].GetCurrentPosition());
-  mAnimation.MoveTo(mBoxes[actorIndex], position*mDisplacementRatio+Vector3(0.f,0.f,mCubeDisplacement), AlphaFunctions::Bounce);
-  mAnimation.ColorTo( mTiles[mContainerIndex^1][actorIndex], HALF_BRIGHTNESS, AlphaFunctions::EaseOut );
-  mAnimation.ColorTo( mTiles[mContainerIndex][actorIndex], FULL_BRIGHTNESS, AlphaFunctions::EaseIn );
+  mAnimation.AnimateTo( Property( mBoxes[actorIndex], Actor::Property::POSITION ), position * mDisplacementRatio + Vector3( 0.f, 0.f, mCubeDisplacement ), AlphaFunction::BOUNCE );
+  mAnimation.AnimateTo( Property( mTiles[mContainerIndex^1][actorIndex], Actor::Property::COLOR ), HALF_BRIGHTNESS, AlphaFunction::EASE_OUT );
+  mAnimation.AnimateTo( Property( mTiles[mContainerIndex][actorIndex], Actor::Property::COLOR ), FULL_BRIGHTNESS, AlphaFunction::EASE_IN );
 }
 
 } // namespace Internal
 }
 
 } // namespace Internal