API: animation YAHOO.util.ColorAnim (YUI Library)

# Yahoo! UI Library

### animation 2.9.0

Yahoo! UI Library > animation > YAHOO.util.ColorAnim
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.util.ColorAnim - extends YAHOO.util.Anim

Known Subclasses:
  YAHOO.util.Motion YAHOO.util.Scroll

Anim subclass for color transitions.

Usage: `var myAnim = new Y.ColorAnim(el, { backgroundColor: { from: '#FF0000', to: '#FFFFFF' } }, 1, Y.Easing.easeOut);` Color values can be specified with either 112233, #112233, [255,255,255], or rgb(255,255,255)

### Constructor

YAHOO.util.ColorAnim `( el , attributes , duration , method )`

Parameters:
  `el <HTMLElement | String>` 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 inherited from YAHOO.util.Anim:

`_onComplete, _onStart, _onTween, actualFrames, attributes, currentFrame, duration, el, isAnimated, method, startTime, totalFrames, useSeconds`

### Methods

#### parseColor

`Array parseColor ( s )`
Attempts to parse the given string and return a 3-tuple.

Parameters:
  `s <String>` The string to parse.

Returns: `Array`
  The 3-tuple of rgb values.

#### Methods inherited from YAHOO.util.Anim:

`_handleTween, animate, doMethod, getAttribute, getDefaultUnit, getEl, getStartTime, init, isAnimated, setAttribute, setEl, setRuntimeAttribute, stop, toString`

#### Events inherited from YAHOO.util.Anim:

`afterTween, onComplete, onStart, onTween,`

Copyright © 2011 Yahoo! Inc. All rights reserved.