From: Yoonsang Lee Date: Sun, 19 Jul 2015 23:29:19 +0000 (+0900) Subject: [DALi][DOC-213] Move "Basic Framework" into animation main page X-Git-Tag: tizen_3.0/TD_SYNC/20161201~691^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=855706504e3f047dc528c840cb077f4adf2babbc;p=sdk%2Fonline-doc.git [DALi][DOC-213] Move "Basic Framework" into animation main page Signed-off-by: Yoonsang Lee Change-Id: I633df5b86f0ce5e950de6b1e6dfeb52b1d3036f5 --- diff --git a/org.tizen.ui.guides/html/index.htm b/org.tizen.ui.guides/html/index.htm index af6a555..3a7c148 100755 --- a/org.tizen.ui.guides/html/index.htm +++ b/org.tizen.ui.guides/html/index.htm @@ -214,10 +214,9 @@
  • TextLabel
  • -
  • Animation +
  • Animations diff --git a/org.tizen.ui.guides/html/native/dali/animation_n.htm b/org.tizen.ui.guides/html/native/dali/animation_n.htm index ac66a46..60910ab 100755 --- a/org.tizen.ui.guides/html/native/dali/animation_n.htm +++ b/org.tizen.ui.guides/html/native/dali/animation_n.htm @@ -11,7 +11,7 @@ - Animation: Making Your Actors Alive + Animations: Making Your Actors Alive @@ -21,16 +21,29 @@

    Mobile native Wearable native

    -

    Animation: Making Your Actors Alive

    +

    Animations: Making Your Actors Alive

    Animation is an effect that shows sequential frames in quick succession to give the illusion of movement.

    @@ -41,6 +54,103 @@

    DALi animations occur in a dedicated thread. This allows animations to run smoothly, regardless of the time taken to process inputs events and other factors in the application code.

    +

    Creating a Basic Animation

    + +

    Create an animation object that takes place over 3 seconds:

    +
    +Dali::Animation animation = Animation::New(3.0f);
    +
    + +

    Animating Properties

    + +

    There are two distinct methods to animate the properties within DALi:

    +
      +
    • AnimateTo(): The property animates TO the value in the given time.
    • +
    • AnimateBy(): The property animates BY the value in the given time.
    • +
    + +

    In the following example, it is assumed that actor1 and actor2 are at position 10.0f, 10.0f, 0.0f at the start of the animation.

    +
    +// Animate the position of actor1 TO 10.0f, 50.0f, 0.0f
    +animation.AnimateTo(Property(actor1, Dali::Actor::Property::POSITION), Vector3(10.0f, 50.0f, 0.0f)); 
    +// End Position: 10.0f, 50.0f, 0.0f
    +
    +// Animate the position of actor2 BY 10.0f, 50.0f, 0.0f
    +animation.AnimateBy(Property(actor2, Dali::Actor::Property::POSITION), Vector3(10.0f, 50.0f, 0.0f)); 
    +// End Position: 20.0f, 60.0f, 0.0f
    +
    + +

    Playback Control

    + +

    When an animation is created, it can be played using the Play() method.

    +
    +animation.Play();
    +
    +

    This is not a synchronous method. The Play() method returns after sending a message. After the message is processed in a separate thread, the animation starts. Blocking the application thread does not stop the animation from playing.

    +

    Stop() and Pause() methods are also supported.

    +
    +animation.Stop();
    +animation.Pause();
    +
    + +

    Notifications

    +

    Using DALi's signal framework applications can be notified when the animation finishes. The Dali::Animation API supports "fire and forget" behavior, which means that an animation continues to play if the handle is discarded. Note that in the following example, the "Finish" signal is emitted.

    +
    +void ExampleCallback(Animation& source)
    +{
    +   std::cout << "Animation has finished" << std::endl;
    +}
    +
    +void ExampleAnimation(Actor actor)
    +{
    +   Animation animation = Animation::New(2.0f); // Duration 2 seconds
    +   animation.AnimateTo(Property(actor, Actor::Property::POSITION), 10.0f, 50.0f, 0.0f);
    +   animation.FinishedSignal().Connect(ExampleCallback);
    +   animation.Play();
    +} // At this point the animation handle has gone out of scope
    +
    +Actor actor = Actor::New();
    +Stage::GetCurrent().Add(actor);
    +
    +// Fire the animation and forget about it
    +ExampleAnimation(actor);
    +
    +// The animation continues, and "Animation has finished" is printed after 2 seconds
    +
    + +

    Alpha Functions

    + +

    Alpha functions are used in animations to specify the rate of change of the animation parameter over time. This allows the animation to be, for example, accelerated, decelerated, repeated, or bounced. The built-in supported functions can be viewed in the Dali::AlphaFunction::BuiltinFunction class (in mobile and wearable applications).

    +
    +animation.SetDefaultAlphaFunction(Dali::AlphaFunction::EASE_IN);
    +
    +

    You can also create your own alpha function:

    +
    +float MyAlphaFunction(float progress)
    +{
    +   return progress;
    +}
    +
    +AlphaFunction alphaFunction(&MyAlphaFunction);
    +animation.SetDefaultAlphaFunction(alphaFunction);
    +
    +

    It is possible to specify a different alpha function for each animator in an Animation object.

    +
    +animation.AnimateTo(Property(actor1, Dali::Actor::Property::POSITION), Vector3(10.0f, 50.0f, 0.0f), Dali::AlphaFunction::EASE_IN);
    +
    + +

    Other Actions

    + +

    An animation can be looped:

    +
    +animation.SetLooping(true);
    +
    +

    By default, when an animation ends, the properties that it was animating are baked (saved). Using the following function, the property changes can be discarded when the animation ends or is stopped:

    +
    +animation.SetEndAction(Animation::Discard);
    +
    + +
    diff --git a/org.tizen.ui.guides/html/native/dali/advanced_animation_n.htm b/org.tizen.ui.guides/html/native/dali/animation_types_n.htm similarity index 96% rename from org.tizen.ui.guides/html/native/dali/advanced_animation_n.htm rename to org.tizen.ui.guides/html/native/dali/animation_types_n.htm index 065525e..df7b332 100755 --- a/org.tizen.ui.guides/html/native/dali/advanced_animation_n.htm +++ b/org.tizen.ui.guides/html/native/dali/animation_types_n.htm @@ -11,7 +11,7 @@ - Types of Animations: Various Animations Realizable with DALi + Types of Animations: Various Animations Supported by DALi @@ -40,7 +40,7 @@
    -

    Types of Animations: Various Animations Realizable with DALi

    +

    Types of Animations: Various Animations Supported by DALi

    Frame Animation

    diff --git a/org.tizen.ui.guides/html/native/dali/basic_framework_n.htm b/org.tizen.ui.guides/html/native/dali/basic_framework_n.htm deleted file mode 100755 index bb026fb..0000000 --- a/org.tizen.ui.guides/html/native/dali/basic_framework_n.htm +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - Basic Framework - - - - - - -
    -

    Basic Framework

    - -

    Creating a Basic Animation

    - -

    Create an animation object that takes place over 3 seconds:

    -
    -Dali::Animation animation = Animation::New(3.0f);
    -
    - -

    Animating Properties

    - -

    There are two distinct methods to animate the properties within DALi:

    -
      -
    • AnimateTo(): The property animates TO the value in the given time.
    • -
    • AnimateBy(): The property animates BY the value in the given time.
    • -
    - -

    In the following example, it is assumed that actor1 and actor2 are at position 10.0f, 10.0f, 0.0f at the start of the animation.

    -
    -// Animate the position of actor1 TO 10.0f, 50.0f, 0.0f
    -animation.AnimateTo(Property(actor1, Dali::Actor::Property::POSITION), Vector3(10.0f, 50.0f, 0.0f)); 
    -// End Position: 10.0f, 50.0f, 0.0f
    -
    -// Animate the position of actor2 BY 10.0f, 50.0f, 0.0f
    -animation.AnimateBy(Property(actor2, Dali::Actor::Property::POSITION), Vector3(10.0f, 50.0f, 0.0f)); 
    -// End Position: 20.0f, 60.0f, 0.0f
    -
    - -

    Playback Control

    - -

    When an animation is created, it can be played using the Play() method.

    -
    -animation.Play();
    -
    -

    This is not a synchronous method. The Play() method returns after sending a message. After the message is processed in a separate thread, the animation starts. Blocking the application thread does not stop the animation from playing.

    -

    Stop() and Pause() methods are also supported.

    -
    -animation.Stop();
    -animation.Pause();
    -
    - -

    Notifications

    -

    Using DALi's signal framework applications can be notified when the animation finishes. The Dali::Animation API supports "fire and forget" behavior, which means that an animation continues to play if the handle is discarded. Note that in the following example, the "Finish" signal is emitted.

    -
    -void ExampleCallback(Animation& source)
    -{
    -   std::cout << "Animation has finished" << std::endl;
    -}
    -
    -void ExampleAnimation(Actor actor)
    -{
    -   Animation animation = Animation::New(2.0f); // Duration 2 seconds
    -   animation.AnimateTo(Property(actor, Actor::Property::POSITION), 10.0f, 50.0f, 0.0f);
    -   animation.FinishedSignal().Connect(ExampleCallback);
    -   animation.Play();
    -} // At this point the animation handle has gone out of scope
    -
    -Actor actor = Actor::New();
    -Stage::GetCurrent().Add(actor);
    -
    -// Fire the animation and forget about it
    -ExampleAnimation(actor);
    -
    -// The animation continues, and "Animation has finished" is printed after 2 seconds
    -
    - -

    Alpha Functions

    - -

    Alpha functions are used in animations to specify the rate of change of the animation parameter over time. This allows the animation to be, for example, accelerated, decelerated, repeated, or bounced. The built-in supported functions can be viewed in the Dali::AlphaFunction::BuiltinFunction class (in mobile and wearable applications).

    -
    -animation.SetDefaultAlphaFunction(Dali::AlphaFunction::EASE_IN);
    -
    -

    You can also create your own alpha function:

    -
    -float MyAlphaFunction(float progress)
    -{
    -   return progress;
    -}
    -
    -AlphaFunction alphaFunction(&MyAlphaFunction);
    -animation.SetDefaultAlphaFunction(alphaFunction);
    -
    -

    It is possible to specify a different alpha function for each animator in an Animation object.

    -
    -animation.AnimateTo(Property(actor1, Dali::Actor::Property::POSITION), Vector3(10.0f, 50.0f, 0.0f), Dali::AlphaFunction::EASE_IN);
    -
    - -

    Other Actions

    - -

    An animation can be looped:

    -
    -animation.SetLooping(true);
    -
    -

    By default, when an animation ends, the properties that it was animating are baked (saved). Using the following function, the property changes can be discarded when the animation ends or is stopped:

    -
    -animation.SetEndAction(Animation::Discard);
    -
    - - - - -
    - -Go to top - - - - - - - - diff --git a/org.tizen.ui.guides/html/native/dali/guides_dali_n.htm b/org.tizen.ui.guides/html/native/dali/guides_dali_n.htm index d77f593..b3baf86 100755 --- a/org.tizen.ui.guides/html/native/dali/guides_dali_n.htm +++ b/org.tizen.ui.guides/html/native/dali/guides_dali_n.htm @@ -57,10 +57,10 @@
  • TextField: Typing Your Text
  • TextLabel: Displaying Text Labels
  • -
  • Animation: Making Your Actors Alive +
  • Animations: Making Your Actors Alive

    Enables you to create animated effects.