Stage::GetCurrent().Add(alignment);
Animation animation = Animation::New(100.0f);
- animation.Resize(alignment, Vector3(100.0f, 150.0f, 200.0f));
+ animation.AnimateTo( Property( alignment, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) );
animation.Play();
application.Render();
DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION );
Animation animation = Animation::New(1.0f);
- animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
+ animation.AnimateTo( Property( dummy, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) );
animation.Play();
application.Render();
Stage::GetCurrent().Add(dummy);
Animation animation = Animation::New(1.0f);
- animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f));
+ animation.AnimateTo( Property( dummy, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) );
animation.Play();
application.Render();
return mFadeOutBackgroundContent;
}
-void PushButton::AddToFadeInAnimation( const Actor& actor )
+void PushButton::AddToFadeInAnimation( Actor& actor )
{
if( !mFadeInAnimation )
{
mFadeInAnimation = Dali::Animation::New( GetAnimationTime() );
}
- mFadeInAnimation.OpacityTo( actor, 1.f );
+ mFadeInAnimation.AnimateTo( Property( actor, Actor::Property::COLOR_ALPHA ), 1.f );
}
void PushButton::StartFadeInAnimation()
}
}
-void PushButton::AddToFadeOutAnimation( const Actor& actor )
+void PushButton::AddToFadeOutAnimation( Actor& actor )
{
if( !mFadeOutAnimation )
{
mFadeOutAnimation = Dali::Animation::New( GetAnimationTime() );
}
- mFadeOutAnimation.OpacityTo( actor, 0.f );
+ mFadeOutAnimation.AnimateTo( Property( actor, Actor::Property::COLOR_ALPHA ), 0.f );
}
void PushButton::StartFadeOutAnimation()
* Adds the actor to the fade in animation. It creates a fade in animation if needed.
* @param[in] actor The actor.
*/
- void AddToFadeInAnimation( const Actor& actor );
+ void AddToFadeInAnimation( Actor& actor );
/**
* Starts the fade in animation.
/**
* Adds the actor to the fade out animation. It creates a fade out animation if needed.
*/
- void AddToFadeOutAnimation( const Actor& actor );
+ void AddToFadeOutAnimation( Actor& actor );
/**
* Starts the fade out animation.
if( animationDuration > 0.f )
{
Animation animation = Animation::New(animationDuration);
- animation.MoveTo( actor, position, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds );
- animation.Resize( actor, size, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
animation.Play();
}
else
if( animationDuration > 0.f )
{
Animation animation = Animation::New(animationDuration);
- animation.MoveTo( actor, position, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds );
- animation.Resize( actor, size, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds );
- animation.RotateTo( actor, rotation, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds );
- animation.ScaleTo( actor, scale, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+ animation.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), rotation, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) );
animation.Play();
}
else
}
}
+ Actor self = Self();
Animation animation = Animation::New( mOrientationAnimationDuration );
- animation.RotateTo( Self(), Degree( -angle ), Vector3::ZAXIS, mOrientationAnimationAlphaFunc );
+ animation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -angle ) ), Vector3::ZAXIS ), mOrientationAnimationAlphaFunc );
animation.Play();
- Self().SetSize( targetSize );
+ self.SetSize( targetSize );
RelayoutRequest();
}
void ScrollBar::Show()
{
+ Actor self = Self();
+
// Cancel any animation
if(mAnimation)
{
if(mIndicatorShowDuration > 0.0f)
{
mAnimation = Animation::New( mIndicatorShowDuration );
- mAnimation.OpacityTo( Self(), 1.0f, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( self, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn );
mAnimation.Play();
}
else
{
- Self().SetOpacity(1.0f);
+ self.SetOpacity(1.0f);
}
}
void ScrollBar::Hide()
{
+ Actor self = Self();
+
// Cancel any animation
if(mAnimation)
{
if(mIndicatorHideDuration > 0.0f)
{
mAnimation = Animation::New( mIndicatorHideDuration );
- mAnimation.OpacityTo( Self(), 0.0f, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( self, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn );
mAnimation.Play();
}
else
{
- Self().SetOpacity(0.0f);
+ self.SetOpacity(0.0f);
}
}
}
mAnimation = Animation::New( BAR_SHOW_TIME );
- mAnimation.OpacityTo( mSlider, 1.0f, AlphaFunctions::EaseIn );
- mAnimation.OpacityTo( mSliderWrap, 1.0f, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( mSlider, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( mSliderWrap, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn );
mAnimation.Play();
DestructTimer();
}
mAnimation = Animation::New( BAR_HIDE_TIME );
- mAnimation.OpacityTo( mSlider, 0.0f, AlphaFunctions::EaseIn );
- mAnimation.OpacityTo( mSliderWrap, 0.0f, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( mSlider, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( mSliderWrap, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn );
mAnimation.Play();
}
void View::OrientationChanged( Dali::Orientation orientation )
{
+ Actor self = Self();
+
// Nothing to do if orientation doesn't really change.
if ( orientation.GetDegrees() == mOrientation || !mAutoRotateEnabled )
{
// has parent so we expect it to be on stage
mRotateAnimation = Animation::New( ROTATION_ANIMATION_DURATION );
- mRotateAnimation.RotateTo( Self(), Degree( -orientation.GetDegrees() ), Vector3::ZAXIS, AlphaFunctions::EaseOut );
+ mRotateAnimation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( -orientation.GetRadians(), Vector3::ZAXIS ), AlphaFunctions::EaseOut );
// Resize the view
if( mFullScreen )
{
const Vector2& stageSize( Stage::GetCurrent().GetSize() );
- const Vector3& currentSize( Self().GetCurrentSize() );
+ const Vector3& currentSize( self.GetCurrentSize() );
float minSize = std::min( stageSize.width, stageSize.height );
float maxSize = std::max( stageSize.width, stageSize.height );
{
// width grows, shrink height faster
Vector3 shrink( currentSize );shrink.height = targetSize.height;
- mRotateAnimation.Resize( Self(), shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f );
- mRotateAnimation.Resize( Self(), targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION );
+ mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ) );
+ mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseIn, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION ) );
}
else
{
// height grows, shrink width faster
Vector3 shrink( currentSize );shrink.width = targetSize.width;
- mRotateAnimation.Resize( Self(), shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f );
- mRotateAnimation.Resize( Self(), targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION );
+ mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ) );
+ mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseIn, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION ) );
}
}
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 ), AlphaFunctions::EaseInOutSine );
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 ), AlphaFunctions::Bounce );
+ mAnimation.AnimateTo( Property( mTiles[mContainerIndex^1][actorIndex], Actor::Property::COLOR ), HALF_BRIGHTNESS, AlphaFunctions::EaseOut );
+ mAnimation.AnimateTo( Property( mTiles[mContainerIndex][actorIndex], Actor::Property::COLOR ), FULL_BRIGHTNESS, AlphaFunctions::EaseIn );
}
} // namespace Internal
sideTile.TranslateBy( resetTranslation );
sideTile.SetOrientation( Radian( angle), Vector3::YAXIS );
}
- mAnimation.RotateTo( currentCube, Radian( -angle ), Vector3::YAXIS, AlphaFunctions::Linear );
+ mAnimation.AnimateTo( Property( currentCube, Actor::Property::ORIENTATION ), Quaternion( Radian( -angle ), Vector3::YAXIS ), AlphaFunctions::Linear );
Vector3 position(currentCube.GetCurrentPosition());
- mAnimation.MoveTo(currentCube, Vector3( position.x*mDisplacementRatio, position.y, position.z ), AlphaFunctions::Bounce);
- mAnimation.ColorTo( frontTile, HALF_BRIGHTNESS, AlphaFunctions::EaseOut );
- mAnimation.ColorTo( sideTile, FULL_BRIGHTNESS, AlphaFunctions::EaseIn );
+ mAnimation.AnimateTo( Property( currentCube, Actor::Property::POSITION ), Vector3( position.x*mDisplacementRatio, position.y, position.z ), AlphaFunctions::Bounce );
+ mAnimation.AnimateTo( Property( frontTile, Actor::Property::COLOR ), HALF_BRIGHTNESS, AlphaFunctions::EaseOut );
+ mAnimation.AnimateTo( Property( sideTile, Actor::Property::COLOR ), FULL_BRIGHTNESS, AlphaFunctions::EaseIn );
}
} // namespace Internal
// the delay value is within 0.f ~ 2.f*thirdAnimationDuration
float delay = thirdAnimationDuration * CalculateDelay(x*mTileSize.width,y*mTileSize.height);
- mAnimation.RotateTo( mBoxes[idx], Degree( -angle ), Vector3::YAXIS,
- AlphaFunctions::EaseOutSine, delay, thirdAnimationDuration );
- mAnimation.MoveBy( mBoxes[idx], Vector3(0.f,0.f,-mCubeDisplacement),
- AlphaFunctions::Bounce, delay, thirdAnimationDuration );
- mAnimation.ColorTo( mTiles[anotherIndex][idx], HALF_BRIGHTNESS,
- AlphaFunctions::EaseOut, delay, thirdAnimationDuration );
- mAnimation.ColorTo( mTiles[mContainerIndex][idx], FULL_BRIGHTNESS,
- AlphaFunctions::EaseIn, delay, thirdAnimationDuration );
+ mAnimation.AnimateTo( Property( mBoxes[idx], Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -angle ) ), Vector3::YAXIS ),
+ AlphaFunctions::EaseOutSine, TimePeriod( delay, thirdAnimationDuration ) );
+ mAnimation.AnimateBy( Property( mBoxes[idx], Actor::Property::POSITION ), Vector3( 0.f, 0.f, -mCubeDisplacement ),
+ AlphaFunctions::Bounce, TimePeriod( delay, thirdAnimationDuration ) );
+ mAnimation.AnimateTo( Property( mTiles[anotherIndex][idx], Actor::Property::COLOR ), HALF_BRIGHTNESS,
+ AlphaFunctions::EaseOut, TimePeriod( delay, thirdAnimationDuration ) );
+ mAnimation.AnimateTo( Property( mTiles[mContainerIndex][idx], Actor::Property::COLOR ), FULL_BRIGHTNESS,
+ AlphaFunctions::EaseIn, TimePeriod( delay, thirdAnimationDuration ) );
}
}
{
if(animation)
{
- animation.Resize(actor, size);
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size );
}
}
// Do a nonlinear size animation to shrink the actor first when the actor size changes,
// so that we can avoid the actors overlapping during orientation change.
- animation.Resize( actor, shrink, AlphaFunctions::EaseOut, 0.0f, durationSeconds * 0.5f );
- animation.Resize( actor, size, AlphaFunctions::EaseIn, 0.0f, durationSeconds );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, durationSeconds * 0.5f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, AlphaFunctions::EaseIn, TimePeriod( 0.0f, durationSeconds ) );
}
}
{
if(animation)
{
- animation.Resize(actor, size);
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size );
}
}
Here we add the animators, these are the building blocks (functions) of the animation and define what we want to see
@code
- myAnimation.OpacityTo(actor, 1.0f);
- myAnimation.MoveTo(actor, x, y, z);
+ myAnimation.AnimateTo(Property(actor, Actor::Property::OPACITY), 1.0f);
+ myAnimation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(x, y, z));
@endcode
start animation, when this is called we want the animation to start playing so here the actor will move whilst the opacity changes.
@endcode
\section advanced-anims Adding more advanced animators, if simply moving the actor is not enough we have further animations methods.
- For actor there exists a range of methods ranging from Move, Rotate, Scale, Opacity, Color to Resize. The API explains in detail what each does and the parameters to these methods but there are some points worth noting;
-
- xxxxBy and xxxxTo, method names are appended by 'By' or 'To' either animate to a supplied value or animate by a supplied value. For example an actor at (10,10,10) calling MoveBy(actor, 50,0,0) would mean its location is (60,0,0) whilst MoveTo(actor, 50,0,0) would result in a location (50,0,0).
+ AnimateBy and AnimateTo, method names are appended by 'By' or 'To' either animate to a supplied value or animate by a supplied value. For example an actor at (10,10,10) calling AnimateBy(Property(actor, Actor::Property::POSITION), 50,0,0) would mean its location is (60,0,0) whilst AnimateTo(Property(actor, Actor::Property::POSITION), 50,0,0) would result in a location (50,0,0).
Dali::AlphaFunctions can be used to give interesting effects to the animation, for example the MOVEment of an actor on screen can speed up and slow down following a sine curve by using the Dali::AlphaFunctions::EaseInOutSine instead of AlphaFunctions::Linear.
@code
- myAnimation.MoveTo(actor, Vector3(x, y, z), AlphaFunctions::Linear, delay, ANIMATOR_DURATION);
- myAnimation.Resize(actor, actorSize, AlphaFunctions::EaseIn, delay, ANIMATOR_DURATION);
+ myAnimation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(x, y, z), AlphaFunctions::Linear, delay, ANIMATOR_DURATION);
+ myAnimation.AnimateTo(Property(actor, Actor::Property::SIZE), actorSize, AlphaFunctions::EaseIn, delay, ANIMATOR_DURATION);
@endcode
\section playback-control Controlling a playing animation
* actor.RotateBy(q);
* @endcode
*
- * The Dali::Animation class provides several RotateTo methods that
- * use \ref Dali::Quaternion "Quaternions" directly. The other
- * RotateTo methods are specified using Axis+Angle, and these convert
- * to Quaternion internally. You will only need to use the quaternion
- * based methods when you are doing something more complex than
- * initialising with Axis+Angle, such as applying several rotations
- * together.
+ * The Dali::Animation class provides several AnimateTo methods that
+ * use \ref Dali::Quaternion "Quaternions" directly to change the orientation.
+ *
* @code
* mAnimation = Animation::New(5.0f); // 5 seconds
* Quaternion q(Radian(Degree(45.0f)).value, Vector3::YAXIS);
* Quaternion r(Radian(Degree(30.0f)).value, Vector3::ZAXIS);
* q *= r;
- * mAnimation.RotateTo(mActor, q, AlphaFunctions::EaseInOut);
+ * mAnimation.AnimateTo(Property(mActor, Actor::Property::ORIENTATION), q, AlphaFunctions::EaseInOut);
* mAnimation.Play();
* @endcode
*/
* body.SetKinematic( true );
* // create a second animation to move the actor 100 units to the right
* Animation animation( Animation::New( 1 ) );
- * animation.MoveBy( actor, Vector3( 100, 0, 0 ), AlphaFunctions::Linear );
+ * animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( 100, 0, 0 ), AlphaFunctions::Linear );
* animation.Play();
* \endcode
* <hr>