Print Friendly

# Class YAHOO.util.ColorAnim

Package: | YAHOO.util
Class: | ColorAnim
Extends: | YAHOO.util.Anim
Defined In: | animation.js

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)

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| ColorAnim(`HTMLElement |`, `Object attributes`, `Number duration`, `Function method`) | ColorAnim
| parseColor(`String s`) : Array | ColorAnim
Attempts to parse the given string and return a 3-tuple.

## Public Events

This class has no public events.

## Constructor Details

### ColorAnim

`public function ColorAnim(`HTMLElement |`, `Object attributes`, `Number duration`, `Function method`)`
Parameters:

- `|` : HTMLElement
  String} el 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)

## Method Details

### parseColor

`public function parseColor(`String 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.

This method is defined by ColorAnim.

Copyright © 2006 Jack Slocum. All rights reserved.