|
|
@@ -2223,9 +2223,9 @@ Using the Profiler is treated as a no-op when called from outside the main threa
|
|
|
|
|
|
\page AttributeAnimation Attribute animation
|
|
|
|
|
|
-Attribute animation is mechanism to apply animation to an object's attribute. All objects derived from Animatable can use attribute animation, currently these classes include Node, Component and UIElement.
|
|
|
+Attribute animation is a mechanism to animate the values of an object's attribute. Objects derived from Animatable can use attribute animation, this includes the Node class and all Component and UIElement subclasses.
|
|
|
|
|
|
-These are two way to use use attribute animation. First user can create attribute animation with code, and then apply it to object's attribute. Here is a simple code for light color animation:
|
|
|
+These are two ways to use attribute animation. Either the user can create attribute animation with code, and then apply it to object's attribute. Here is a simple code for light color animation:
|
|
|
\code
|
|
|
SharedPtr<ValueAnimation> colorAnimation(new ValueAnimation(context_));
|
|
|
colorAnimation->SetKeyFrame(0.0f, Color::WHITE);
|
|
|
@@ -2235,22 +2235,22 @@ colorAnimation->SetKeyFrame(4.0f, Color::WHITE);
|
|
|
light->SetAttributeAnimation("Color", colorAnimation, WM_LOOP);
|
|
|
\endcode
|
|
|
|
|
|
-On above code, we first create an ValueAnimation object call colorAnimation, and set its key frame value, then apply it to light's color attribute. (Note here: in order to make animation look correct, the last key frame must equal to the first key frame for loop mode).
|
|
|
+In the above code, we first create an ValueAnimation object call colorAnimation, and set three key frame values to it, then assign it to light's color attribute. (Note here: in order to make animation look correct, the last key frame must equal to the first key frame for loop mode).
|
|
|
|
|
|
-Another way is load attribute animation from resource, here is a simple sample:
|
|
|
+Another way is to load an attribute animation resource, here is a simple example:
|
|
|
\code
|
|
|
ValueAnimation* colorAnimation = cache->GetResource<ValueAnimation>("Scene/LightColorAnimation.xml");
|
|
|
light->SetAttributeAnimation("Color", colorAnimation, WM_LOOP);
|
|
|
\endcode
|
|
|
|
|
|
-These are three kind of wrap mode for attribute animation:
|
|
|
-- WM_LOOP: Loop mode, when the animation arrived to end, it will loop from begin.
|
|
|
-- WM_ONCE: Play once mode, when the animation finished, it will be removed from the object.
|
|
|
-- WM_CLAMP: Clamp mode, then the animation finished, it will keep the last key frame's value.
|
|
|
+Attribute animation supports three different wrap modes:
|
|
|
+- WM_LOOP: Loop mode, when the animation arrives to end, it will loop from beginning.
|
|
|
+- WM_ONCE: Play once mode, when the animation is finished, it will be removed from the object.
|
|
|
+- WM_CLAMP: Clamp mode, when the animation is finished, it will keep the last key frame's value.
|
|
|
|
|
|
-These is another argument call speed the animation play speed, the default value is 1.0f, user can change the value to control the animation play speed. User can also change animation’s wrap mode and speed on fly.
|
|
|
+The playback speed (default 1.0f or "original speed") of an animation, as well as the animation's wrap mode can be adjusted on the fly.
|
|
|
|
|
|
-When user want to apply multi-attribute animation to an object, ObjectAnimation is for it. For example when user want to apply position and color animation for light, can use following code:
|
|
|
+The ObjectAnimation class can be used to group together multiple value animations that affect different attributes. For example when the user wants to apply position and color animation for light, the following code can be used:
|
|
|
\code
|
|
|
// Create object animation.
|
|
|
SharedPtr<ObjectAnimation> lightAnimation(new ObjectAnimation(context_));
|
|
|
@@ -2275,22 +2275,20 @@ lightAnimation->AddAttributeAnimation("Color", colorAnimation, WM_LOOP);
|
|
|
light->SetObjectAnimation(lightAnimation);
|
|
|
\endcode
|
|
|
|
|
|
-Also user can load object animation from file, like:
|
|
|
+%Object animations can also be loaded from file, like:
|
|
|
\code
|
|
|
ObjectAnimation * lightAnimation = cache->GetResource<ObjectAnimation>("Scene/LightAnimation.xml");
|
|
|
light-> SetObjectAnimation (lightAnimation);
|
|
|
\endcode
|
|
|
|
|
|
-Current attribute animation use linear interpolation for numeric value type (like float, Vector2, Vector3 etc), and these is no interpolation for non-numeric type (like int, bool).
|
|
|
+Attribute animation uses linear interpolation for floating point types (like float, Vector2, Vector3 etc), and no interpolation for integer and non-numeric types (like int, bool).
|
|
|
|
|
|
-Attribute animation and object animation can be save to scene file, Someday if our editor support edit animation, we can create animation in editor and save it to scene file.
|
|
|
+\section AttributeAnimation_Classes Attribute animation classes
|
|
|
|
|
|
-\section AttributeAnimation_Classes Classes of attribute animation:
|
|
|
-- Animatable: Base class for animatable object, an animatable object can be set animation on it's attributes, or can be set an object animation to it.
|
|
|
-- ValueAnimation: Animation class, include some key frame in it.
|
|
|
-- ObjectAnimation: Object animation class, an object animation include one or more attribute animations and theirs wrap mode and speed for an Animatable object.
|
|
|
-- ValueAnimationInfo: Animation info, it include attribute animation, wrap mode and animation speed.
|
|
|
-- AttributeAnimationInstance: Attribute animation instance, it is derived from ValueAnimationInfo. and include animation runtime information, when animation playing it will update the object's attribute value automatically.
|
|
|
+- Animatable: Base class for animatable objects, which can assign animations on its individual attributes (ValueAnimation), or an animation which affects several attributes (ObjectAnimation).
|
|
|
+- ValueAnimation: Includes key frame values for a single attribute
|
|
|
+- ObjectAnimation: Includes one or more attribute animations and their wrap modes and speeds for an Animatable object.
|
|
|
+- ValueAnimationInfo: Base class for runtime instances of an attribute animation, which includes the referred animation, wrap mode, speed and time position.
|
|
|
|
|
|
\page Tools Tools
|
|
|
|