Class YAHOO.ext.Animator
Package: | YAHOO.ext |
Class: | Animator |
Extends: | Object |
Defined In: | Animator.js |
Provides support for syncing animations for multiple
YAHOO.ext.Actors.
This example can be seen in action
here
by clicking on "Click here and I will point it out" at the end of the first paragraph.
var animator = new YAHOO.ext.Animator();
var cursor = new YAHOO.ext.Actor('cursor-img', animator);
var click = new YAHOO.ext.Actor('click-img', animator);
var resize = new YAHOO.ext.Actor('resize-img', animator);
// start capturing
animator.startCapture();
// these animations will be run in sequence
cursor.show();
cursor.moveTo(500,400);
cursor.moveTo(20, getEl('navbar').getY()+10, true, .75);
click.show();
click.alignTo(cursor, 'tl', [-4, -4]);
// Add an async function call, pass callback to argument 1
animator.addAsyncCall(Blog.navbar.undockDelegate, 1);
// pause .5 seconds
animator.pause(.5);
// again, these animations will be run in sequence
click.hide(true, .7);
cursor.alignTo('splitter', 'tr', [0, +100], true, 1);
resize.alignTo('splitter', 'tr', [-12, +100]);
// start sync block: these animations will run at the same time
animator.beginSync();
cursor.hide();
resize.show();
animator.endSync();
// play the captured animation sequences, call myCallback when done
animator.play(myCallback);
Public Properties
This class has no public properties.
Public Methods
|
Animator(String/HTMLElement el , [YAHOO.ext.Animator animator ], [Boolean selfCapture ]) |
Animator |
|
|
addActor(YAHOO.ext.Actor actor ) : void |
Animator |
Add an actor. The actor is also set to capturing = true. |
|
addAsyncCall(Function fcn , Number callbackIndex , [Array args ], [Object scope ]) : void |
Animator |
Add an async function call to the playlist. |
|
addCall(Function fcn , [Array args ], [Object scope ]) : void |
Animator |
Add a function call to the playlist. |
|
beginSync() : void |
Animator |
Start a multi-actor sync block. By default all animations are run in sequence. While in the sync block
each actor's o... |
|
clear() : void |
Animator |
Clear the playlist |
|
endSync() : void |
Animator |
End the multi-actor sync block |
|
isCapturing(YAHOO.ext.Actor actor ) : void |
Animator |
Checks whether this animator is listening to a specific actor. |
|
isPlaying() : void |
Animator |
Check if this animator is currently playing |
|
pause(Number seconds ) : void |
Animator |
Add a pause to the playlist (in seconds) |
|
play([Function oncomplete ]) : void |
Animator |
Starts playback of the playlist, also stops any capturing. To start capturing again call startCapture. |
|
select<static>(String/Array selector ) : void |
Animator |
<static> Static function to build a AnimatorComposite from a css selector (requires YAHOO.ext.Element.selectorF... |
|
startCapture([Boolean clearPlaylist ]) : void |
Animator |
Start capturing actions on the added actors. |
|
stop() : void |
Animator |
Stop at the next available stopping point |
|
stopCapture() : void |
Animator |
Stop capturing on all added actors. |
Public Events
This class has no public events.
Constructor Details
Animator
public function Animator(String/HTMLElement el
, [YAHOO.ext.Animator animator
], [Boolean selfCapture
])
Parameters:
el
: String/HTMLElementThe dom element or element id
animator
: YAHOO.ext.Animator(optional) The Animator that will capture this Actor's actions
selfCapture
: Boolean(optional) Whether this actor should capture it's own actions to support self playback without an animator (defaults to false)
Method Details
addActor
public function addActor(YAHOO.ext.Actor actor
)
Add an actor. The actor is also set to capturing = true.
This method is defined by Animator.
addAsyncCall
public function addAsyncCall(Function fcn
, Number callbackIndex
, [Array args
], [Object scope
])
Add an async function call to the playlist.
Parameters:
fcn
: FunctionThe function to call
callbackIndex
: NumberThe index of the callback parameter on the passed function. A CALLBACK IS REQUIRED.
args
: ArrayThe arguments to call the function with
scope
: Object(optional) The scope of the function
Returns:
This method is defined by Animator.
addCall
public function addCall(Function fcn
, [Array args
], [Object scope
])
Add a function call to the playlist.
This method is defined by Animator.
beginSync
public function beginSync()
Start a multi-actor sync block. By default all animations are run in sequence. While in the sync block
each actor's own animations will still be sequenced, but all actors will animate at the same time.
This method is defined by Animator.
clear
public function clear()
This method is defined by Animator.
endSync
public function endSync()
End the multi-actor sync block
This method is defined by Animator.
isCapturing
public function isCapturing(YAHOO.ext.Actor actor
)
Checks whether this animator is listening to a specific actor.
This method is defined by Animator.
isPlaying
public function isPlaying()
Check if this animator is currently playing
This method is defined by Animator.
pause
public function pause(Number seconds
)
Add a pause to the playlist (in seconds)
This method is defined by Animator.
play
public function play([Function oncomplete
])
Starts playback of the playlist, also stops any capturing. To start capturing again call
startCapture.
This method is defined by Animator.
select<static>
public function select<static>(String/Array selector
)
<static> Static function to build a AnimatorComposite from a css selector (requires YAHOO.ext.Element.selectorFunction be defined)
This method is defined by Animator.
startCapture
public function startCapture([Boolean clearPlaylist
])
Start capturing actions on the added actors.
This method is defined by Animator.
stop
public function stop()
Stop at the next available stopping point
This method is defined by Animator.
stopCapture
public function stopCapture()
Stop capturing on all added actors.
This method is defined by Animator.
yui-ext - Copyright © 2006 Jack Slocum. |
Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.