X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftransition-effects%2Fcube-transition-cross-effect-impl.cpp;h=b1b15b7e96435b8e3019b4ee099edf9a06f9cb4c;hp=b1df2b9b1762bfbd9d43b51c6a3f7a41a14b74ba;hb=f2039d47f9bed8104575da80a2ecf0bb6e37ff8d;hpb=f3e45e41c5f16ccc2538b283897ed6efb07e4ea9 diff --git a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp index b1df2b9..b1b15b7 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp @@ -20,26 +20,23 @@ namespace Dali { - namespace Toolkit { - namespace Internal { - -CubeTransitionCrossEffect::CubeTransitionCrossEffect( unsigned int numRows, unsigned int numColumns ) -: CubeTransitionEffect( numRows, numColumns ), - mDisplacementSpreadFactor( 0.008f ) +CubeTransitionCrossEffect::CubeTransitionCrossEffect(unsigned int numRows, unsigned int numColumns) +: CubeTransitionEffect(numRows, numColumns), + mDisplacementSpreadFactor(0.008f) { } -Toolkit::CubeTransitionCrossEffect CubeTransitionCrossEffect::New(unsigned int numRows, unsigned int numColumns ) +Toolkit::CubeTransitionCrossEffect CubeTransitionCrossEffect::New(unsigned int numRows, unsigned int numColumns) { // Create the implementation - IntrusivePtr< CubeTransitionCrossEffect > internalCubeTransEffect = new CubeTransitionCrossEffect( numRows, numColumns ); + IntrusivePtr internalCubeTransEffect = new CubeTransitionCrossEffect(numRows, numColumns); // Pass ownership to CustomActor handle - Toolkit::CubeTransitionCrossEffect cubeTransEffect( *internalCubeTransEffect ); + Toolkit::CubeTransitionCrossEffect cubeTransEffect(*internalCubeTransEffect); //Initialization internalCubeTransEffect->Initialize(); @@ -50,39 +47,39 @@ Toolkit::CubeTransitionCrossEffect CubeTransitionCrossEffect::New(unsigned int n void CubeTransitionCrossEffect::OnInitialize() { unsigned int idx; - for( unsigned int y = 0; y < mRows; y++ ) + for(unsigned int y = 0; y < mRows; y++) { - for( unsigned int x = y % 2; x < mColumns; x += 2 ) + for(unsigned int x = y % 2; x < mColumns; x += 2) { idx = y * mColumns + x; - SetTargetTop( idx ); + SetTargetTop(idx); } - for( unsigned int x = ( y + 1 ) % 2; x < mColumns; x += 2 ) + for(unsigned int x = (y + 1) % 2; x < mColumns; x += 2) { idx = y * mColumns + x; - SetTargetRight( idx ); + SetTargetRight(idx); } } } -void CubeTransitionCrossEffect::OnStartTransition( Vector2 panPosition, Vector2 panDisplacement ) +void CubeTransitionCrossEffect::OnStartTransition(Vector2 panPosition, Vector2 panDisplacement) { - float angle = Math::PI_2; + float angle = Math::PI_2; unsigned int idx; - if( panDisplacement.x < 0 ) + if(panDisplacement.x < 0) { - for( unsigned int y = 0; y < mRows; y++ ) + for(unsigned int y = 0; y < mRows; y++) { - for( unsigned int x = y % 2; x < mColumns; x += 2 ) + for(unsigned int x = y % 2; x < mColumns; x += 2) { idx = y * mColumns + x; - SetTargetTop( idx ); + SetTargetTop(idx); } - for( unsigned int x = ( y + 1 ) % 2; x < mColumns; x += 2 ) + for(unsigned int x = (y + 1) % 2; x < mColumns; x += 2) { idx = y * mColumns + x; - SetTargetRight( idx ); + SetTargetRight(idx); } } } @@ -90,36 +87,36 @@ void CubeTransitionCrossEffect::OnStartTransition( Vector2 panPosition, Vector2 { angle = -angle; - for( unsigned int y = 0; y < mRows; y++ ) + for(unsigned int y = 0; y < mRows; y++) { - for( unsigned int x = y % 2; x < mColumns; x += 2 ) + for(unsigned int x = y % 2; x < mColumns; x += 2) { idx = y * mColumns + x; - SetTargetBottom( idx ); + SetTargetBottom(idx); } - for( unsigned int x = ( y + 1 ) % 2; x < mColumns; x += 2 ) + for(unsigned int x = (y + 1) % 2; x < mColumns; x += 2) { idx = y * mColumns + x; - SetTargetLeft( idx ); + SetTargetLeft(idx); } } } - const Vector2 halfSize = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY() * 0.5f; + const Vector2 halfSize = Self().GetCurrentProperty(Actor::Property::SIZE).GetVectorXY() * 0.5f; //the centre to "explode" the tiles outwards from - Vector3 centre( halfSize.x, halfSize.y, -1.0f / mDisplacementSpreadFactor ); + Vector3 centre(halfSize.x, halfSize.y, -1.0f / mDisplacementSpreadFactor); - for( unsigned int y = 0; y < mRows; y++ ) + for(unsigned int y = 0; y < mRows; y++) { - for( unsigned int x = y%2; x < mColumns; x=x+2) // rotate vertically + for(unsigned int x = y % 2; x < mColumns; x = x + 2) // rotate vertically { - idx = y*mColumns + x; - SetupAnimation( idx, x, y, -angle, Vector3::XAXIS, centre ); + idx = y * mColumns + x; + SetupAnimation(idx, x, y, -angle, Vector3::XAXIS, centre); } - for( unsigned int x = (y+1)%2; x < mColumns; x=x+2) // rotate horizontally + for(unsigned int x = (y + 1) % 2; x < mColumns; x = x + 2) // rotate horizontally { - idx = y*mColumns + x; - SetupAnimation( idx, x, y, angle, Vector3::YAXIS, centre ); + idx = y * mColumns + x; + SetupAnimation(idx, x, y, angle, Vector3::YAXIS, centre); } } @@ -127,28 +124,28 @@ void CubeTransitionCrossEffect::OnStartTransition( Vector2 panPosition, Vector2 mIsAnimating = true; } -void CubeTransitionCrossEffect::SetupAnimation( unsigned int actorIndex, unsigned int x, unsigned int y, float angle, const Vector3 axis, const Vector3& displacementCentre ) +void CubeTransitionCrossEffect::SetupAnimation(unsigned int actorIndex, unsigned int x, unsigned int y, float angle, const Vector3 axis, const Vector3& displacementCentre) { - const Vector2 size = Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).GetVectorXY(); - Vector2 halfSize = size * 0.5f; + const Vector2 size = Self().GetCurrentProperty(Actor::Property::SIZE).GetVectorXY(); + Vector2 halfSize = size * 0.5f; //the position of the centre of the front face tile - Vector3 position( halfSize.x * (2.0f * x + 1.0f) / mColumns, halfSize.y * (2.0f * y + 1.0f ) / mRows, 0.0f ); + Vector3 position(halfSize.x * (2.0f * x + 1.0f) / mColumns, halfSize.y * (2.0f * y + 1.0f) / mRows, 0.0f); Vector3 direction = position - displacementCentre; - float length = direction.Length(); + float length = direction.Length(); direction.Normalize(); float deltaLength = mCubeDisplacement / direction.z; //the length along the direction vector such that the projected direction onto the z axis is equal to mCubeDisplacement - Vector3 newPosition = ( direction * (length + deltaLength ) ) + displacementCentre; + Vector3 newPosition = (direction * (length + deltaLength)) + displacementCentre; Vector3 newLocalPosition = newPosition - position; - mAnimation.AnimateTo( Property( mBoxes[ actorIndex ], Actor::Property::ORIENTATION ), Quaternion( Radian( -angle ), axis ), AlphaFunction::EASE_IN_OUT_SINE ); - mAnimation.AnimateTo( Property( mBoxes[ actorIndex ], Actor::Property::POSITION ), newLocalPosition, AlphaFunction::BOUNCE ); + mAnimation.AnimateTo(Property(mBoxes[actorIndex], Actor::Property::ORIENTATION), Quaternion(Radian(-angle), axis), AlphaFunction::EASE_IN_OUT_SINE); + mAnimation.AnimateTo(Property(mBoxes[actorIndex], Actor::Property::POSITION), newLocalPosition, AlphaFunction::BOUNCE); - mAnimation.AnimateTo( Property( mCurrentTiles[ actorIndex ], Actor::Property::COLOR ), HALF_BRIGHTNESS, AlphaFunction::EASE_OUT ); - mAnimation.AnimateTo( Property( mTargetTiles[ actorIndex ], Actor::Property::COLOR ), FULL_BRIGHTNESS, AlphaFunction::EASE_IN ); + mAnimation.AnimateTo(Property(mCurrentTiles[actorIndex], Actor::Property::COLOR), HALF_BRIGHTNESS, AlphaFunction::EASE_OUT); + mAnimation.AnimateTo(Property(mTargetTiles[actorIndex], Actor::Property::COLOR), FULL_BRIGHTNESS, AlphaFunction::EASE_IN); } } // namespace Internal