dojo.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
parameter | type | description |
---|---|---|
node | DOMNode|String | a DOM node or the id of a node to animate CSS properties on |
properties | Object | |
duration | Integer | Optional. The number of milliseconds over which the animation should run. Defaults to the global animation default duration (350ms). |
easing | Function | Optional. 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`. |
onEnd | Function | Optional. A function to be called when the animation finishes running. |
delay | Integer | Optional. 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);