1 /*! \page animation-example Example and Usage
3 We will start by showing the steps for animating an actors position and opacity so the actor moves whilst the opacity changes.
5 Next more interesting animations methods (effects) with individual timing will be explained.
7 \section simple-anim Simple Animation moving an actor whilst altering opacity.
9 We declare an animation called myAnimation
12 Dali::Animation myAnimation
15 A new animation instance is created with a specified duration. Here the duration of the animation will be 0.5 seconds.
16 Some other settings are incorporated by default and will be explained later.
18 myAnimation = Animation::New(0.5f);
21 Here we add the animators, these are the building blocks (functions) of the animation and define what we want to see
23 myAnimation.OpacityTo(actor, 1.0f);
24 myAnimation.MoveTo(actor, x, y, z);
27 start animation, when this is called we want the animation to start playing so here the actor will move whilst the opacity changes.
31 \section advanced-anims Adding more advanced animators, if simply moving the actor is not enough we have further animations methods.
33 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;
35 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).
37 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.
40 myAnimation.MoveTo(actor, Vector3(x, y, z), AlphaFunctions::Linear, delay, ANIMATOR_DURATION);
41 myAnimation.Resize(actor, actorSize, AlphaFunctions::EaseIn, delay, ANIMATOR_DURATION);
43 \section playback-control Controlling a playing animation
45 The 3 controls we have are start, pause and stop
47 Dali::Animation::Play();
48 Dali::Animation::Stop();
49 Dali::Animation::Pause();
52 \section default-settings Default settings
53 The call Dali::Animation::New provides some default settings but each has a setter function if the defaults are not suitable. (Getters also exist)
55 Dali::Animation::SetEndAction
56 Dali::Animation::SetLooping
57 Dali::Animation::SetDefaultAlphaFunction
60 \section end-signal End Signal
61 The following signal can be connected to if it is required to know when an animation is complete.
62 /code Dali::Animation::SignalFinish(); /endcode