# Pulse组件
使用Pulse组件可以为实体添加脉冲效果。
import { Pulse } from '@tx3d/core';
// 创建实体
const entity = engine.createEntity();
// 添加Pulse组件
const pulse = entity.addComponent( Pulse, {
radius: 20.0,
speed: 1.0,
color: '#3db266'
} );
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
提示
Pulse组件初始化参数,详见PulseParameters。
# 属性
🌏 sizeAttenuation 是否尺寸衰减
// 获取是否尺寸衰减
const sizeAttenuation = pulse.sizeAttenuation;
// 设置是否尺寸衰减
pulse.sizeAttenuation = false;
1
2
3
4
5
2
3
4
5
🌏 speed 脉冲速度
// 获取脉冲速度
const speed = pulse.speed;
// 设置脉冲速度
pulse.speed = 2.0;
1
2
3
4
5
2
3
4
5
🌏 cycles 脉冲扩散圈数
// 获取脉冲扩散圈数
const cycles = pulse.cycles;
// 设置脉冲扩散圈数
pulse.cycles = 3.0;
1
2
3
4
5
2
3
4
5
🌏 opacity 透明度
// 获取透明度
const opacity = pulse.opacity;
// 设置透明度
pulse.opacity = 0.75;
1
2
3
4
5
2
3
4
5
🌏 color 颜色
// 获取颜色
const color = pulse.color;
// 设置颜色
pulse.color = '#de98d3';
1
2
3
4
5
2
3
4
5
← PoolWater组件 Pyramid组件 →