Module: zrender/animation/Animation

zrender/animation/Animation

new require("zrender/animation/Animation")(options)

animation/Animation.js, line 55
Name Type Description
options Object optional
Name Type Description
onframe function optional
stage IZRenderStage optional
Example
var animation = new Animation();
var obj = {
    x: 100,
    y: 100
};
animation.animate(node.position)
    .when(1000, {
        x: 500,
        y: 500
    })
    .when(2000, {
        x: 100,
        y: 100
    })
    .start('spline');

动画主类, 调度和管理所有动画控制器

Author:
  • pissang(https://github.com/pissang)

Classes

Animator

Methods

add(clip)

animation/Animation.js, line 78

添加动画片段

Name Type Description
clip module:zrender/animation/Clip

animate(target, options){module:zrender/animation/Animation~Animator}

animation/Animation.js, line 178

对一个目标创建一个animator对象,可以指定目标中的属性使用动画

Name Type Description
target Object
options Object
Name Type Default Description
loop boolean false optional

是否循环播放动画

getter function null optional

如果指定getter函数,会通过getter函数取属性值

setter function null optional

如果指定setter函数,会通过setter函数设置属性值

clear()

animation/Animation.js, line 164

清除所有动画片段

remove(clip)

animation/Animation.js, line 85

删除动画片段

Name Type Description
clip module:zrender/animation/Clip

start()

animation/Animation.js, line 140

开始运行动画

stop()

animation/Animation.js, line 158

停止运行动画