Class YAHOO.util.Anim
- Known Subclasses:
- YAHOO.util.ColorAnim
Base animation class that provides the interface for building animated effects.Usage: var myAnim = new YAHOO.util.Anim(el, { width: { from: 10, to: 100 } }, 1, YAHOO.util.Easing.easeOut);
Constructor
YAHOO.util.Anim ( el , attributes , duration , method )
- Parameters:
-
el <String | HTMLElement>Reference to the element that will be animated -
attributes <Object>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 <Number>(optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based -
method <Function>(optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
Properties
attributes – Object
currentFrame – Int
method – Function
totalFrames – Int
Methods
animate
void animate ( )
- Returns:
void
doMethod
Number doMethod ( attr , start , end )
- Parameters:
-
attr <String>The name of the attribute. -
start <Number>The value this attribute should start from for this animation. -
end <Number>The value this attribute should end at for this animation.
- Returns:
Number - The Value to be applied to the attribute.
getAttribute
Number getAttribute ( attr )
- Parameters:
-
attr <String>The name of the attribute.
- Returns:
Number - val The current value of the attribute.
getDefaultUnit
String getDefaultUnit ( attr )
- Parameters:
-
attr <attr>The name of the attribute.
- Returns:
String - The default unit to be used.
getStartTime
Date getStartTime ( )
- Returns:
Date - current value of startTime.
init
void init ( el , attributes , duration , method )
- Parameters:
-
el <String | HTMLElement>Reference to the element that will be animated -
attributes <Object>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 <Number>(optional, defaults to 1 second) Length of animation (frames or seconds), defaults to time-based -
method <Function>(optional, defaults to YAHOO.util.Easing.easeNone) Computes the values that are applied to the attributes per frame (generally a YAHOO.util.Easing method)
- Returns:
void
isAnimated
Boolean isAnimated ( )
- Returns:
Boolean - current value of isAnimated.
onTween
private void onTween ( )
- Returns:
void
setAttribute
void setAttribute ( attr , val , unit )
- Parameters:
-
attr <String>The name of the attribute. -
val <Number>The value to be applied to the attribute. -
unit <String>The unit (‘px’, ‘%’, etc.) of the value.
- Returns:
void
setRuntimeAttribute
private void setRuntimeAttribute ( attr )
- Parameters:
-
attr <Object>The attribute object
- Returns:
void
stop
void stop ( finish )
- Parameters:
-
finish <Boolean>(optional) If true, animation will jump to final frame.
- Returns:
void
Events
onComplete
onComplete ( )
onStart
onStart ( )
onTween
onTween ( )
