Class YAHOO.util.Motion

Object
   |
   +--YAHOO.util.Anim
         |
         +--YAHOO.util.Motion

class YAHOO.util.Motion
extends YAHOO.util.Anim
Requires:
YAHOO.util.Anim
YAHOO.util.AnimMgr
YAHOO.util.Easing
YAHOO.util.Bezier
YAHOO.util.Dom
YAHOO.util.Event

Anim subclass for moving elements along a path defined by the "points" member of "attributes". All "points" are arrays with x, y coordinates.

Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);

Constructor Summary [top]

YAHOO.util.Motion
Anim subclass for moving elements along a path defined by the "points" member of "attributes". 

Method Summary [top]

Number doMethod (<String> attribute, <Number> start, <Number> end)
Returns the value computed by the animation's "method". 
Number getAttribute (<String> attribute)
Returns current value of the attribute. 
void initMotion (el, <Object> attributes, <Number> duration, <Function> method)
 
void setAttribute (<String> attribute, <Number> val, <String> unit)
Applies a value to an attribute 

Constructor Detail [top]

YAHOO.util.Motion

YAHOO.util.Motion ()
Anim subclass for moving elements along a path defined by the "points" member of "attributes". All "points" are arrays with x, y coordinates.

Usage: var myAnim = new YAHOO.util.Motion(el, { points: { to: [800, 800] } }, 1, YAHOO.util.Easing.easeOut);

Parameters:
HTMLElement - | String} el Reference to the element that will be animated
attributes - The attribute(s) to be animated. Each attribute is an object with at minimum a "to" or "by" member defined. Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). All attribute names use camelCase.
duration - (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
method - (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)

Method Detail [top]

doMethod

Number doMethod (<String> attribute, <Number> start, <Number> end)
Returns the value computed by the animation's "method".
Parameters:
attribute - The name of the attribute.
start - The value this attribute should start from for this animation.
end - The value this attribute should end at for this animation.
Returns:
The Value to be applied to the attribute.

getAttribute

Number getAttribute (<String> attribute)
Returns current value of the attribute.
Parameters:
attribute - The name of the attribute.
Returns:
val The current value of the attribute.

initMotion

void initMotion (el, <Object> attributes, <Number> duration, <Function> method)
Parameters:
attributes - The attribute(s) to be animated. Each attribute is an object with at minimum a "to" or "by" member defined. Additional optional members are "from" (defaults to current value), "units" (defaults to "px"). All attribute names use camelCase.
duration - (optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based
method - (optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
HTMLElement - | String} el Reference to the element that will be animated

setAttribute

void setAttribute (<String> attribute, <Number> val, <String> unit)
Applies a value to an attribute
Parameters:
attribute - The name of the attribute.
val - The value to be applied to the attribute.
unit - The unit ('px', '%', etc.) of the value.