Skip to content

Class: EffectSystem

特效系统

js

// stage.effectSystem.特效(对象, 特效参数:{参数n:参数值})
// 例如:
stage.effectSystem.flash(node, {times: 5, duration:500}).play();

一个特效源码实现:

ts
   
// 生成一个线条流动的特效动画实例
flow(nodeOrLink: Node | Link, opt: { lineDash?: Array<number>, direction?: 'clockwise'|'anticlockwise' } = {}) {
   let lineDash = opt.lineDash || [3, 2];
   let direction = opt.direction || 'clockwise';

   let dir  = direction == 'clockwise' ? 1 : -1;

   let animationSystem = this.animationSystem;

   nodeOrLink.css({
       lineDash: lineDash
   });

   let animation = animationSystem.anime({
       from: [0],
       to: [300],
       update: (arr) => {
           nodeOrLink.css({
               lineDashOffset: -arr[0] * dir
           });
       },
       times: 20,
       duration: 10000
   });
   return animation;
}

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EffectSystem(stage, animationSystem)

Parameters

NameType
stageStage
animationSystemAnimationSystem

Properties

animationSystem

animationSystem: AnimationSystem


stage

stage: Stage

Methods

expandScale

expandScale(node, opt?): Animation

节点展开, 节点的宽高从指定尺寸(默认从0)逐渐变为当前尺寸

Parameters

NameType
nodeNode
optExpandScaleOpt

Returns

Animation


flash

flash(nodeOrLink, opt?): Animation

生成一个闪烁的特效动画实例

Parameters

NameType
nodeOrLinkNode | Link
optFlashOpt

Returns

Animation

一个闪动动画


flow

flow(nodeOrLink, opt?): Animation

生成一个线条流动的特效动画实例

Parameters

NameType
nodeOrLinkNode | Link
optFlowOpt

Returns

Animation


linkMark

linkMark(link, opt?): Node

在连线的中间位置放置一个文本符号(默认是emoji符号:❌)

可以用来表示:断开、告警、状态等

类似的其他emoji符号:🚫 ❗ ️💢️ ❓ ✅

Parameters

NameType
linkLink
optObject
opt.color?string
opt.font?string
opt.text?string

Returns

Node


rippling

rippling(opt?): AENode

生成一个’涟漪‘(圆形扩散)的特效节点对象

Parameters

NameType
optRipplingOpt

Returns

AENode


unexpandScale

unexpandScale(node, opt?): Animation

节点逐渐收起来的效果

Parameters

NameType
nodeNode
optUnexpandScaleOpt

Returns

Animation