Skip to content

@jtopo/core / AnimationSystem

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

aeNodes

aeNodes: WeakSet<AENode>

对象集合


animations

animations: Set<Animation>

当前的动画集合

Methods

addAENode

addAENode(aeNode): void

添加一个对象AENode到动画系统

Parameters

NameType
aeNodeAENode

Returns

void


anim

anim(opt): Animation

生成一个动画实例

Parameters

NameType
optAnimationOption

Returns

Animation


anime

anime(opt): Animation

生成一个动画实例

Deprecated

请使用更剪短anim代替

Parameters

NameType
optAnimationOption

Returns

Animation


cancelAll

cancelAll(): void

取消并移除所有动画

Returns

void


hasAENode

hasAENode(obj): boolean

是否在动画系统中

Parameters

NameType
objAENode

Returns

boolean


removeAENode

removeAENode(aeNode): void

Parameters

NameType
aeNodeAENode

Returns

void