# Ring组件
使用Ring组件可以为实体添加光环效果。
import { Ring } from '@tx3d/core';
// 创建实体
const entity = engine.createEntity();
// 添加Ring组件
const ring = entity.addComponent( Ring, {
radius: 10.0,
speed: 1.0,
color: '#35bffd'
} );
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
提示
Ring组件初始化参数,详见RingParameters。
# 属性
🌏 sizeAttenuation 是否尺寸衰减
// 获取是否尺寸衰减
const sizeAttenuation = ring.sizeAttenuation;
// 设置是否尺寸衰减
ring.sizeAttenuation = false;
1
2
3
4
5
2
3
4
5
🌏 speed 波动速度
// 获取波动速度
const speed = ring.speed;
// 设置波动速度
ring.speed = 2.5;
1
2
3
4
5
2
3
4
5
🌏 opacity 透明度
// 获取透明度
const opacity = ring.opacity;
// 设置透明度
ring.opacity = 0.75;
1
2
3
4
5
2
3
4
5
🌏 color 颜色
// 获取颜色
const color = ring.color;
// 设置颜色
ring.color = 0.75;
1
2
3
4
5
2
3
4
5