# new Timeline()
- Source:
Animation is global timeline that schedule all clips. each frame animation will set the time of clips to current and update the states of clips
Example
var animation = new clay.Timeline();
var node = new clay.Node();
animation.animate(node.position)
.when(1000, {
x: 500,
y: 500
})
.when(2000, {
x: 100,
y: 100
})
.when(3000, {
z: 10
})
.start('spline');
Extends
Members
# __uid__ :number
- Source:
- Inherited From:
Type:
- number
# stage :Object
- Source:
stage is an object with render method, each frame if there exists any animating clips, stage.render will be called
Type:
- Object
Methods
# addAnimator(animator)
- Source:
Add animator
Parameters:
Name | Type | Description |
---|---|---|
animator |
clay.animate.Animator |
# addClip(clip)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
clip |
clay.animation.Clip |
# after(name, action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Alias of once('after' + name)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | ||
action |
function | ||
context |
Object |
<optional> |
# animate(target, optionsopt) → {clay.animation.Animator}
- Source:
Create an animator
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
target |
Object | ||||||||||||||||||||||
options |
Object |
<optional> |
Properties
|
Returns:
# before(name, action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Alias of once('before' + name)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | ||
action |
function | ||
context |
Object |
<optional> |
# error(action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Alias of on('error')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
action |
function | ||
context |
Object |
<optional> |
# has(name, action) → {boolean}
- Source:
- Inherited From:
- Mixes In:
If registered the event handler
Parameters:
Name | Type | Description |
---|---|---|
name |
string | |
action |
function |
Returns:
- Type
- boolean
# off(action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Remove event listener
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
action |
function | ||
context |
Object |
<optional> |
# on(name, action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Register event handler
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | ||
action |
function | ||
context |
Object |
<optional> |
# once(name, action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Register event, event will only be triggered once and then removed
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | ||
action |
function | ||
context |
Object |
<optional> |
# pause()
- Source:
Pause
# removeAnimator(animator)
- Source:
Remove animator
Parameters:
Name | Type | Description |
---|---|---|
animator |
clay.animate.Animator |
# removeClip(clip)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
clip |
clay.animation.Clip |
# removeClipsAll()
- Source:
Remove all clips
# resume()
- Source:
Resume
# start()
- Source:
Start running animation
# stop()
- Source:
Stop running animation
# success(action, contextopt)
- Source:
- Inherited From:
- Mixes In:
Alias of on('success')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
action |
function | ||
context |
Object |
<optional> |
# trigger(name)
- Source:
- Inherited From:
- Mixes In:
Trigger event
Parameters:
Name | Type | Description |
---|---|---|
name |
string |