Skip to content

Class: AnimationSystem

动画系统

js

// 使用动画系统
let animationSystem = stage.animationSystem;

// 创建一个动画实例:模拟掉落 (节点从当前高度往下掉落200个像素)
let animation = animationSystem.anime({
   // node的当前高度
   from: node.y,

   // node当前高度向下 200像素
   to: node.y + 200,

   // 动画动作
   update: (n) => {
       node.y = n;
   },

   // 动画效果-缓动(有弹性的感觉)
   effect: 'easeOutBounce',

   // 动画时间
   duration: 2000,
});

// 播放
animation.play();

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new AnimationSystem()

Properties

animations

animations: Animation[] = []

当前的动画列表

Methods

anime

anime(opt): Animation

生成一个动画实例

Parameters

NameType
optAnimationOption

Returns

Animation


cancelAll

cancelAll(): void

取消所有动画

Returns

void