# Yahoo! UI Library

### anim 3.3.0

Yahoo! UI Library > anim > Anim
Search:
Filters Show Private Show Protected Show Deprecated

## Class Anim - extends Base

A class for constructing animation instances.

### Constructor

Anim `( )`

### Properties

#### behaviors - `static object`

Bucket for custom getters and setters

#### DEFAULT_GETTER - `static object`

The default getter to use when getting object properties.

#### DEFAULT_SETTER - `static object`

The default setter to use when setting object properties.

#### DEFAULT_UNIT - `static object`

The default unit to use with properties that pass the RE_DEFAULT_UNIT test.

#### intervalTime - `static object`

Time in milliseconds passed to setInterval for frame processing
Default Value: 20

#### RE_DEFAULT_UNIT - `static object`

Regex of properties that should use the default unit.

#### Properties inherited from Plugin.Host:

`PluginHost`

#### Properties inherited from Attribute:

``

#### Properties inherited from Base:

`name`

### Methods

#### _runFrame

`private static void _runFrame ( )`
Called per Interval to handle each animation frame.

#### getBezier

`static Array getBezier ( points , t )`
Get the current position of the animated element based on t. Each point is an array of "x" and "y" values (0 = x, 1 = y) At least 2 points are required (start and end). First point is start. Last point is end. Additional control points are optional.

Parameters:
  `points <Array>` An array containing Bezier points
  `t <Number>` A number between 0 and 1 which is the basis for determining current position

Returns: `Array`
  An array containing int x and y member data

#### pause

`static void pause ( )`
Pauses all animation instances.
Chainable: This method is chainable.

#### run

`static void run ( )`
Runs all animation instances.
Chainable: This method is chainable.

#### stop

`static void stop ( )`
Stops all animation instances.
Chainable: This method is chainable.

#### Methods inherited from EventTarget:

`_getType, _monitor, _parseType, addTarget, after, before, bubble, detach, detachAll, fire, getEvent, getTargets, on, once, parseType, publish, removeTarget, subscribe, unsubscribe, unsubscribeAll`

#### Methods inherited from Attribute:

`_addAttrs, _addLazyAttr, _defAttrChangeFn, _fireAttrChange, _getAttr, _getAttrCfg, _getAttrInitVal, _getAttrs, _getStateVal, _isLazyAttr, _normAttrVals, _protectAttrs, _set, _setAttr, _setAttrs, _setAttrVal, _setStateVal, addAttr, addAttrs, attrAdded, get, getAttrs, modifyAttr, removeAttr, reset, set, setAttrs`

#### Methods inherited from Plugin.Host:

`_destroyPlugins, _initPlugins, hasPlugin, plug, unplug`

#### Methods inherited from Base:

`_aggregateAttrs, _defDestroyFn, _defInitFn, _destroyHierarchy, _filterAttrCfs, _getAttrCfgs, _getClasses, _initHierarchy, _initHierarchyData, _preInitEventCfg, destroy, init, toString`

### Events

#### directionChange

`directionChange ( event )`
Fires when the value for the configuration attribute 'direction' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### durationChange

`durationChange ( event )`
Fires when the value for the configuration attribute 'duration' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### easingChange

`easingChange ( event )`
Fires when the value for the configuration attribute 'easing' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### elapsedTimeChange

`elapsedTimeChange ( event )`
Fires when the value for the configuration attribute 'elapsedTime' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### end

`end ( ev )`
fires after the animation completes.

Parameters:
  `ev <Event>` The end event.

#### fromChange

`fromChange ( event )`
Fires when the value for the configuration attribute 'from' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### iteration

`iteration ( ev )`
fires when an animation begins an iteration.

Parameters:
  `ev <Event>` The iteration event.

#### iterationCountChange

`iterationCountChange ( event )`
Fires when the value for the configuration attribute 'iterationCount' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### iterationsChange

`iterationsChange ( event )`
Fires when the value for the configuration attribute 'iterations' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### nodeChange

`nodeChange ( event )`
Fires when the value for the configuration attribute 'node' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### pause

`pause ( ev )`
fires when an animation is paused.

Parameters:
  `ev <Event>` The pause event.

#### pausedChange

`pausedChange ( event )`
Fires when the value for the configuration attribute 'paused' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### resume

`resume ( ev )`
fires when an animation is resumed (run from pause).

Parameters:
  `ev <Event>` The pause event.

#### reverseChange

`reverseChange ( event )`
Fires when the value for the configuration attribute 'reverse' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### runningChange

`runningChange ( event )`
Fires when the value for the configuration attribute 'running' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### start

`start ( ev )`
fires when an animation begins.

Parameters:
  `ev <Event>` The start event.

#### startTimeChange

`startTimeChange ( event )`
Fires when the value for the configuration attribute 'startTime' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### toChange

`toChange ( event )`
Fires when the value for the configuration attribute 'to' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### tween

`tween ( ev )`
fires every frame of the animation.

Parameters:
  `ev <Event>` The tween event.

#### Events inherited from Base:

`destroy, destroyedChange, init, initializedChange,`

### Configuration Attributes

#### direction `- String`

How iterations of the animation should behave. Possible values are "normal" and "alternate". Normal will repeat the animation, alternate will reverse on every other pass.
Default Value: "normal"

#### duration `- NUM`

The length of the animation. Defaults to "1" (second).

#### easing `- Function`

The method that will provide values to the attribute(s) during the animation. Defaults to "Easing.easeNone".

#### elapsedTime `- Int`

Current time the animation has been running.
Default Value: 0

#### from `- Object supports any unit, provided it matches the "to" (or default) unit (e.g. "{width: 10em', color: 'rgb(0, 0 0)', borderColor: '#ccc'}". If using the default ('px' for length-based units), the unit may be omitted ( (e.g. "{width: 100}, borderColor: 'ccc'}", which defaults to pixels and hex, respectively).`

The starting values for the animated properties. Fields may be strings, numbers, or functions. If a function is used, the return value becomes the from value. If no from value is specified, the DEFAULT_GETTER will be used.

#### iterationCount `- Int`

The number of iterations that have occurred. Resets when an animation ends (reaches iteration count or stop() called).
Default Value: 0

#### iterations `- Int`

The number of times the animation should run
Default Value: 1

#### node `- Node`

The object to be animated.

#### paused `- Boolean`

Whether or not the animation is currently paused.
Default Value: false

#### reverse `- Boolean`

If true, animation begins from last frame
Default Value: false

#### running `- Boolean`

Whether or not the animation is currently running.
Default Value: false

#### startTime `- Int`

Date stamp for the first frame of the animation.
Default Value: 0

#### to `- Object supports any unit, provided it matches the "from" (or default) unit (e.g. "{width: '50%', color: 'red', borderColor: '#ccc'}". If using the default ('px' for length-based units), the unit may be omitted ( (e.g. "{width: 100}, borderColor: 'ccc'}", which defaults to pixels and hex, respectively).`

The ending values for the animated properties. Fields may be strings, numbers, or functions.

#### Configuration attributes inherited from Base:

`destroyed initialized`

Copyright © 2011 Yahoo! Inc. All rights reserved.