# Radar组件

使用Radar组件可以为实体添加雷达效果。

import { Radar } from '@tx3d/core';

// 创建实体
const entity = engine.createEntity();

// 添加Radar组件
const radar = entity.addComponent( Radar, {

    radius: 20.0,
    opacity: 1.0,
    map: 'assets/textures/岩层.jpg',
    color: '#00ffff'

} );
1
2
3
4
5
6
7
8
9
10
11
12
13
14

提示

Radar组件初始化参数,详见RadarParameters

# 属性

🌏 sizeAttenuation 是否尺寸衰减

// 获取是否尺寸衰减
const sizeAttenuation = radar.sizeAttenuation;

// 设置是否尺寸衰减
radar.sizeAttenuation = false;
1
2
3
4
5

🌏 speed 扫描速度

// 获取扫描速度
const speed = radar.speed;

// 设置扫描速度
radar.speed = 2.0;
1
2
3
4
5

🌏 opacity 透明度

// 获取透明度
const opacity = radar.opacity;

// 设置透明度
radar.opacity = 0.75;
1
2
3
4
5

🌏 color 颜色

// 获取颜色
const color = radar.color;

// 设置颜色
radar.color = '#de98de';
1
2
3
4
5
Last Updated: 8/16/2022, 5:51:37 PM