Animatorgroup(LzAnimatorGroup)

出自OpenFace

跳转到: 导航, 搜索

目录

<animatorgroup>

Coordinates the behavior of several animators. JavaScript: LzAnimatorGroup


Extends Node An LzAnimatorGroup wraps several LzAnimators, and runs them in sequence or simultaneously . As an example, the code below animates a view first along the x-axis and then the y.

<canvas>
 <view bgcolor="red" width="100" height="100">
   <animatorgroup process="sequential">
     <animator attribute="x" to="100" duration="1000"/>
     <animator attribute="y" to="100" duration="1000"/>
   </animatorgroup>
 </view>
</canvas>

Any attribute that is legal in <animator> is legal in <animatorgroup>. These attributes are then cascaded to the animators contained within.

Events (such as onstart, onstop, etc.) and the name and id attributes, however, are not cascaded. Also, start defined at the group level is effectively cascaded to the animators, meaning that the start attribute is ignored in the animators themselves.

See Also:

<animator>

Attributes

Name    Usage    Type(Tag)    Type(JS)    Default    Category

attribute Tag & JS   token      String             setter

    The name of the attribute whose value is animated. This attribute is required on an animator, unless the animator is inside an animatorgroup that specifies an attribute.



duration  Tag & JS  any                       setter

    The duration of the animation, in milliseconds (1000 = 1 second).



ease    JS only  undocumented                    setter

    The motion for the animator.


from    Tag & JS   number     Number                setter

    The start value for the animation. Defaults to the targeted attribute's current value.



indirect   Tag & JS   boolean    Boolean      false        setter


motion    Tag & JS linear | easein | easeout | easeboth any easeboth   setter


onfinish   JS only   undocumented                   readonly

     Use of 'onfinish' event is deprecated. Use 'onstop' event instead.


onrepeat   JS only     LzEvent                      readonly

     Event sent at the beginning of each new repeat.


onstart   Tag only script  LzEvent                  eventhandler

     Sent when the animator starts. This event is sent multiple times if the animator repeats.


onstop   Tag only     script     LzEvent             eventhandler

     Event sent when the animator finishes.


paused   Tag & JS     boolean    Boolean      false        setter

     If true, the running animator will pause. If false it will resume


process  Tag & JS sequential | simultaneous String sequential       readonly

    "simultaneous" or none means process animators simultaneously "sequential" means process animators sequentially;


relative  Tag & JS     boolean     Boolean     false        setter

    Whether the to value is relative to the initial value of the attribute (true), or is absolute (false).



repeat    Tag & JS     expression   any                setter

    The number of times to repeat the animation. This should be a positive integer, or 'Infinity'. Changes to the repeat value take effect, after the animation is finished and then restarted.



start     Tag & JS     boolean     Boolean    true        setter

       If true, the animator will call start.

       注:只能通过方法isStart()取得值,不能通过".start"方式取得值  


started    JS only     Boolean                     readonly

     Value of the animator's start attribute.


target    Tag & JS      reference     reference           setter

     the object to animate


to      Tag & JS      number     Number               setter

     The final value for the targeted attribute.



Attributes inherited from Node

id, name, parent, subnodes



Methods

doStart()

LzAnimatorGroup.doStart() called to set starting flags and values, send onstart event, and register animator for processing on the main idle loop.




pause()

LzAnimatorGroup.pause(dop) Temporarily pauses or restarts the animator

Parameters Name Type Desc dop Boolean If true, pauses the animator. If false, unpauses the animator. If null, toggles the paused state of the animator.



setTarget()

LzAnimatorGroup.setTarget(new_target) setter for the target attribute

Parameters Name Type Desc new_target None



stop()

LzAnimatorGroup.stop() Stop is called when the animation is complete, or when the animator is destroyed. It can also be called to halt a running animation.




Methods inherited from LzNode

getAttribute, setAttribute,applyConstraint



Events

Events inherited from LzNode

ondata, oninit