Functiondojo.anim

<script src="../../js/dojo.js"></script>
defined in dojo/_base/fx.js

dojo.anim is a simpler (but somewhat less powerful) version of dojo.animateProperty. It uses defaults for many basic properties and allows for positional parameters to be used in place of the packed "property bag" which is used for other Dojo animation methods.

The dojo._Animation object returned from dojo.anim will be already playing when it is returned from this function, so calling play() on it again is (usually) a no-op.

Usage

function (/*DOMNode|String*/ node, /*Object*/ properties, /*Integer?*/ duration, /*Function?*/ easing, /*Function?*/ onEnd, /*Integer?*/ delay) (view source)
parametertypedescription
nodeDOMNode|Stringa DOM node or the id of a node to animate CSS properties on
propertiesObject 
durationIntegerOptional. The number of milliseconds over which the animation should run. Defaults to the global animation default duration (350ms).
easingFunctionOptional. An easing function over which to calculate acceleration and deceleration of the animation through its duration. A default easing algorithm is provided, but you may plug in any you wish. A large selection of easing algorithms are available in `dojox.fx.easing`.
onEndFunctionOptional. A function to be called when the animation finishes running.
delayIntegerOptional. The number of milliseconds to delay beginning the animation by. The default is 0.

Examples

Example 1

Fade out a node

dojo.anim("id", { opacity: 0 });

Example 2

Fade out a node over a full second

dojo.anim("id", { opacity: 0 }, 1000);