# ESParticleSystemPrimitive（粒子）

> 分类：**单点对象** | 引擎：Cesium/UE | 基类：否
> 继承链：`Destroyable -> ESSceneObject -> ESVisualObject -> ESObjectWithLocation -> ESParticleSystemPrimitive`

ESParticleSystemPrimitive 是用于在场景中指定位置生成和播放粒子特效（基于 Primitive API）的对象。

## JSON 示例

```json
{
            "id": "particlesystemprimitive_xxx",
            "type": "ESParticleSystemPrimitive",
            "name": "粒子",
            "position": [116.39, 39.9, 0],
            "speed": 5
        }
```

## 属性

| 属性 | 类型 | 默认值 | 说明 | 来源 |
| --- | --- | --- | --- | --- |
| `allowPicking` | boolean | false | 是否允许拾取 默认false | ESVisualObject |
| `bursts` | [time?: number, minimum?: number, maximum?: number] \| undefined | reactArrayCollectionWithUndefined<[time?: number, minimum?: number, maximum?: nu | 粒子爆发配置数组（每个元素为 [时间, 最小数量, 最大数量]） | ESParticleSystemPrimitive |
| `collision` | boolean | true | 是否开启碰撞监测 默认true ,主要是UE使用 | ESVisualObject |
| `color` | ESJColor \| undefined | undefined | 粒子生命周期内的颜色（RGBA 格式） | ESParticleSystemPrimitive |
| `currentTime` | number \| undefined | 0 as number \| undefined | 播放器当前时间（单位：毫秒） | ESParticleSystemPrimitive |
| `devTags` | string[] \| undefined | undefined | 对象类型名称相关的开发标签数组，使用 reactArrayWithUndefined 进行响应式处理，默认为 undefined。 | ESSceneObject |
| `duration` | number \| undefined | 6000 as number \| undefined | 播放器过渡时间（动画切换时长，单位：毫秒） | ESParticleSystemPrimitive |
| `emissionRate` | number \| undefined | undefined | 粒子发射率（每秒发射数量） | ESParticleSystemPrimitive |
| `emitter` | ESJParticleEmitterJsonType \| undefined | {             type: 'CircleEmitter',             radius: 0.5         } | 粒子发射器配置（JSON 格式） | ESParticleSystemPrimitive |
| `endColor` | ESJColor \| undefined | undefined | 粒子结束颜色（生命周期结束时的 RGBA 格式） | ESParticleSystemPrimitive |
| `endScale` | number \| undefined | 4 as number \| undefined | 粒子结束缩放等级（生命周期结束时） | ESParticleSystemPrimitive |
| `execOnceFuncStr` | string \| undefined | undefined | 一次性执行函数的字符串表示，默认为 undefined。 | ESSceneObject |
| `extras` | JsonValue | undefined | 扩展属性 JSON，必须整体赋值，使用 reactJson 进行响应式处理，默认为 undefined。 | ESSceneObject |
| `flyInParam` | ESJFlyInParam \| undefined | undefined | 飞入参数 | ESVisualObject |
| `flyToParam` | ESJFlyToParam \| undefined | undefined | 飞向参数 | ESVisualObject |
| `image` | string \| undefined | ESSceneObject.context.getStrFromEnv('${earthsdk3-assets-script-dir}/assets/img/s | 粒子贴图地址（URI 或字符串） | ESParticleSystemPrimitive |
| `imageSize` | ESJVector2D | [20, 20] | 粒子图片尺寸（宽, 高） | ESParticleSystemPrimitive |
| `lifetime` | number \| undefined | undefined | 粒子系统生命周期（总发射时间，单位：秒） | ESParticleSystemPrimitive |
| `loop` | boolean \| undefined | undefined | 是否循环播放粒子系统 | ESParticleSystemPrimitive |
| `mass` | number \| undefined | undefined | 粒子质量（固定值，覆盖最小/最大质量，单位：千克） | ESParticleSystemPrimitive |
| `maximumImageSize` | ESJVector2D | undefined | 粒子图片最大尺寸（宽, 高） | ESParticleSystemPrimitive |
| `maximumMass` | number \| undefined | undefined | 粒子最大质量（随机质量范围上限，单位：千克） | ESParticleSystemPrimitive |
| `maximumParticleLife` | number \| undefined | undefined | 粒子最大生命周期（随机生命周期范围上限，单位：秒） | ESParticleSystemPrimitive |
| `maximumSpeed` | number \| undefined | undefined | 粒子最大速度（随机速度范围上限，单位：米/秒） | ESParticleSystemPrimitive |
| `maxVisibleDistance` | number | 0 | 最大可视距离 | ESObjectWithLocation |
| `minimumImageSize` | ESJVector2D | undefined | 粒子图片最小尺寸（宽, 高） | ESParticleSystemPrimitive |
| `minimumMass` | number \| undefined | undefined | 粒子最小质量（随机质量范围下限，单位：千克） | ESParticleSystemPrimitive |
| `minimumParticleLife` | number \| undefined | undefined | 粒子最小生命周期（随机生命周期范围下限，单位：秒） | ESParticleSystemPrimitive |
| `minimumSpeed` | number \| undefined | undefined | 粒子最小速度（随机速度范围下限，单位：米/秒） | ESParticleSystemPrimitive |
| `minVisibleDistance` | number | 0 | 最小可视距离 | ESObjectWithLocation |
| `name` | string | "未命名场景对象" | 对象名称，默认为 '未命名场景对象'。 | ESSceneObject |
| `particleLife` | number \| undefined | 0.5 as number \| undefined | 粒子生命周期（固定值，覆盖最小/最大生命周期，单位：秒） | ESParticleSystemPrimitive |
| `particleScale` | number \| undefined | undefined | 粒子整体缩放等级 | ESParticleSystemPrimitive |
| `playing` | boolean \| undefined | true as boolean \| undefined | 播放器是否正在播放 | ESParticleSystemPrimitive |
| `playingLoop` | boolean \| undefined | true as boolean \| undefined | 播放器是否循环播放 | ESParticleSystemPrimitive |
| `playingSpeed` | number \| undefined | 1 as number \| undefined | 播放器播放速度（1 为正常速度） | ESParticleSystemPrimitive |
| `pointed` | boolean | false | 点样式是否启用，默认false | ESObjectWithLocation |
| `pointStyle` | ESJPointStyle | {             size: 1,             sizeType: 'screen',             color: [1, 1, 1, 1],             material: '',             materialParams: {},             outlineColor: [1, 0, 0, 1],             outlineWidth: 2,         } | 点样式 | ESObjectWithLocation |
| `position` | ESJVector3D | [0, 0, 0] | 位置点 [经,纬,高] | ESObjectWithLocation |
| `positionOffset` | ESJVector3D | [0, 0, 0] | 偏移属性 [x,y,z] | ESObjectWithLocation |
| `ref` | string \| undefined | undefined | 对象引用，设置后可通过对象管理器 objm.$refs.xxx 快速获取到对象，默认为 undefined。 | ESSceneObject |
| `rotation` | ESJVector3D | [0, 0, 0] | 姿态 [h,p,r] | ESObjectWithLocation |
| `scale` | ESJVector3D | [1, 1, 1] | 缩放 [x,y,z] | ESObjectWithLocation |
| `show` | boolean | true | 是否显示 默认true | ESVisualObject |
| `sizeInMeters` | boolean \| undefined | undefined | 尺寸单位是否为米（`true` 为米，`false` 为像素） | ESParticleSystemPrimitive |
| `speed` | number \| undefined | undefined | 粒子速度（覆盖最小/最大速度，单位：米/秒） | ESParticleSystemPrimitive |
| `startColor` | ESJColor \| undefined | undefined | 粒子初始颜色（生命周期开始时的 RGBA 格式） | ESParticleSystemPrimitive |
| `startScale` | number \| undefined | undefined | 粒子初始缩放等级（生命周期开始时） | ESParticleSystemPrimitive |
| `toDestroyFuncStr` | string \| undefined | undefined | 销毁函数的字符串表示，默认为 undefined。 | ESSceneObject |
| `translation` | ESJVector3D \| undefined | undefined | 三维空间偏移量（x, y, z） | ESParticleSystemPrimitive |
| `updateCallback` | string \| undefined | undefined | 粒子更新回调函数字符串（每帧执行） | ESParticleSystemPrimitive |
| `updateFuncStr` | string \| undefined | undefined | 更新函数的字符串表示，默认为 undefined。 | ESSceneObject |

## 方法

| 方法 | 参数 | 返回 | 说明 | 来源 |
| --- | --- | --- | --- | --- |
| `addToViewer(viewer: ESViewer)` | viewer: ESViewer | - | 将对象添加到指定视口中。<br>**参数**：viewer - 要添加对象的视口。 | ESSceneObject |
| `automaticLanding()` | - | - | 自动落地。 先禁用碰撞检测，一段时间后触发自动落地事件并恢复碰撞检测状态。 | ESObjectWithLocation |
| `calcFlyInParam()` | - | - | 触发计算飞入参数事件 | ESVisualObject |
| `calcFlyToParam()` | - | - | 触发计算飞向参数事件 | ESVisualObject |
| `createAttachedObject(createViewerPropSceneObject: (viewer: ESViewer) => Destroyable | undefined)` | createViewerPropSceneObject: (viewer: ESViewer) => Destroyable \| undefined | - | 创建与视口关联的对象，并返回一个销毁函数，用于手动销毁关联对象。<br>**参数**：createViewerPropSceneObject - 一个函数，用于创建与视口关联的对象。<br>**返回**：一个销毁函数，调用该函数可以销毁所有关联对象。 | ESSceneObject |
| `emptyFlyInParam()` | - | - | 清空飞入参数 | ESVisualObject |
| `emptyFlyToParam()` | - | - | 清空飞向参数 | ESVisualObject |
| `flush()` | - | - | 刷新对象，触发刷新事件。 | ESSceneObject |
| `flyIn(duration: number = 1)` | duration: number = 1 | - | 触发飞入事件<br>**参数**：duration - 飞入持续时间，默认为 1 | ESVisualObject |
| `flyTo(duration: number = 1)` | duration: number = 1 | - | 触发飞向事件<br>**参数**：duration - 飞向持续时间，默认为 1 | ESVisualObject |
| `getBoundSphere(viewer: ESViewer)` | viewer: ESViewer | - | 获取对象的边界球<br>**参数**：viewer - 视图器对象<br>**返回**：包含边界球信息的 Promise | ESVisualObject |
| `getESProperties()` | - | - | 获取粒子系统的属性列表。<br>**返回**：属性列表。 | ESParticleSystemPrimitive |
| `registerAttachedObject(createViewerPropSceneObject: (viewer: ESViewer) => Destroyable | undefined)` | createViewerPropSceneObject: (viewer: ESViewer) => Destroyable \| undefined | - | 注册与视口关联的对象，当对象被添加到视口或从视口移除时，会自动创建或销毁关联对象。<br>**参数**：createViewerPropSceneObject - 一个函数，用于创建与视口关联的对象。 | ESSceneObject |
| `registerAttachedObjectForContainer(createContainerPropSceneObject: (viewer: ESViewer, container: HTMLDivElement) => Destroyable | undefined)` | createContainerPropSceneObject: (viewer: ESViewer, container: HTMLDivElement) => Destroyable \| undefined | - | 注册与视口容器关联的对象，当对象被添加到视口或从视口移除时，会自动创建或销毁关联对象。<br>**参数**：createContainerPropSceneObject - 一个函数，用于创建与视口容器关联的对象。 | ESSceneObject |
| `reload()` | - | - | - | ESSceneObject |
| `removefromViewer(viewer: ESViewer)` | viewer: ESViewer | - | 将对象从指定视口中移除。<br>**参数**：viewer - 要移除对象的视口。 | ESSceneObject |
| `smoothMove(Destination: ESJVector3D, Time: number)` | Destination: ESJVector3D, Time: number | - | 平滑移动到指定位置。<br>**参数**：Destination - 目标位置，格式为[经度, 纬度, 高度]；Time - 平滑移动所需的时间，单位为秒 | ESObjectWithLocation |
| `smoothMoveKeepPitch(Destination: ESJVector3D, Time: number)` | Destination: ESJVector3D, Time: number | - | 保持俯仰角平滑移动到指定位置。<br>**参数**：Destination - 目标位置，格式为[经度, 纬度, 高度]；Time - 平滑移动所需的时间，单位为秒 | ESObjectWithLocation |
| `smoothMoveOnGround(Lon: number, Lat: number, Time: number, Ground: string)` | Lon: number, Lat: number, Time: number, Ground: string | - | 贴地平滑移动。<br>**参数**：Lon - 目标位置的经度；Lat - 目标位置的纬度；Time - 平滑移动所需的时间，单位为秒；Ground - 地面类型，UE特有属性 | ESObjectWithLocation |
| `smoothMoveRelatively(RelativePosition: ESJVector3D, Time: number)` | RelativePosition: ESJVector3D, Time: number | - | 相对平滑移动。<br>**参数**：RelativePosition - 相对位置，格式为[经度, 纬度, 高度]；Time - 平滑移动所需的时间，单位为秒 | ESObjectWithLocation |
| `smoothMoveRelativelyWithRotation(RelativePosition: ESJVector3D, NewRotation: ESJVector3D, Time: number)` | RelativePosition: ESJVector3D, NewRotation: ESJVector3D, Time: number | - | 相对平滑偏移到指定位置和姿态。<br>**参数**：RelativePosition - 相对位置，格式为[经度, 纬度, 高度]；NewRotation - 目标姿态，格式为[偏航角, 俯仰角, 翻转角]；Time - 平滑移动所需的时间，单位为秒 | ESObjectWithLocation |
| `smoothMoveWithRotation(Destination: ESJVector3D, NewRotation: ESJVector3D, Time: number)` | Destination: ESJVector3D, NewRotation: ESJVector3D, Time: number | - | 平滑偏移到指定位置和姿态。<br>**参数**：Destination - 目标位置，格式为[经度, 纬度, 高度]；NewRotation - 目标姿态，格式为[偏航角, 俯仰角, 翻转角]；Time - 平滑移动所需的时间，单位为秒 | ESObjectWithLocation |
| `smoothMoveWithRotationOnGround(NewRotation: ESJVector3D, Lon: number, Lat: number, Time: number, Ground: string)` | NewRotation: ESJVector3D, Lon: number, Lat: number, Time: number, Ground: string | - | 贴地平滑偏移到指定位置和姿态。<br>**参数**：NewRotation - 目标姿态，格式为[偏航角, 俯仰角, 翻转角]；Lon - 目标位置的经度；Lat - 目标位置的纬度；Time - 平滑移动所需的时间，单位为秒；Ground - 地面类型，ue特有属性 | ESObjectWithLocation |
| `supportEditingModes()` | - | - | 获取当前对象支持的编辑模式<br>**返回**：支持的编辑模式数组 | ESVisualObject |
| `updateEditing()` | - | - | 更新编辑状态的方法，具体实现由子类完成 | ESVisualObject |

## 事件

| 事件 | 说明 | 来源 |
| --- | --- | --- |
| `activeViewerChanged` | - | ESSceneObject |
| `automaticLandingEvent` | 获取自动落地事件的监听器。 | ESObjectWithLocation |
| `calcFlyInParamEvent` | 获取计算飞入参数事件 | ESVisualObject |
| `calcFlyToParamEvent` | 获取计算飞向参数事件 | ESVisualObject |
| `createdEvent` | 获取对象创建事件。 | ESSceneObject |
| `editingChanged` | 获取编辑状态改变事件 | ESVisualObject |
| `flushEvent` | 获取刷新对象事件。 | ESSceneObject |
| `flyInEvent` | 获取飞入事件 | ESVisualObject |
| `flyOverEvent` | 获取飞行结束事件 | ESVisualObject |
| `flyToDistanceChanged` | 获取飞向距离改变事件 | ESVisualObject |
| `flyToEvent` | 获取飞向事件 | ESVisualObject |
| `flyToFlyDurationChanged` | 获取飞向持续时间改变事件 | ESVisualObject |
| `flyToHDeltaChanged` | 获取飞向水平偏移量改变事件 | ESVisualObject |
| `flyToHeadingChanged` | 获取飞向航向改变事件 | ESVisualObject |
| `flyToPDeltaChanged` | 获取飞向垂直偏移量改变事件 | ESVisualObject |
| `flyToPitchChanged` | 获取飞向俯仰角改变事件 | ESVisualObject |
| `pickedEvent` | 获取拾取事件 | ESVisualObject |
| `pointColorChanged` | 获取点颜色变化的事件 | ESObjectWithLocation |
| `pointMaterialChanged` | 获取点材质变化的事件 | ESObjectWithLocation |
| `pointMaterialParamsChanged` | 获取点材质参数变化的事件 | ESObjectWithLocation |
| `pointSizeChanged` | 获取点大小变化的事件 | ESObjectWithLocation |
| `pointSizeTypeChanged` | 获取点大小类型变化的事件 | ESObjectWithLocation |
| `ratioChanged` | 获取播放比率改变事件。 | ESParticleSystemPrimitive |
| `readyEvent` | - | ESSceneObject |
| `reloadEvent` | - | ESSceneObject |
| `smoothMoveEvent` | 获取平滑移动事件。 | ESObjectWithLocation |
| `smoothMoveKeepPitchEvent` | 获取保持俯仰角平滑移动事件。 | ESObjectWithLocation |
| `smoothMoveOnGroundEvent` | 获取贴地平滑移动事件。 | ESObjectWithLocation |
| `smoothMoveRelativelyEvent` | 获取相对平滑移动事件。 | ESObjectWithLocation |
| `smoothMoveRelativelyWithRotationEvent` | 获取相对平滑偏移到指定位置和姿态的事件。 | ESObjectWithLocation |
| `smoothMoveWithRotationEvent` | 获取平滑偏移到指定位置和姿态的事件。 | ESObjectWithLocation |
| `smoothMoveWithRotationOnGroundEvent` | 获取贴地平滑偏移到指定位置和姿态的事件。 | ESObjectWithLocation |
| `statusDisChanged` | 获取对象禁用状态改变的事件监听器。 | ESObjectWithLocation |
| `toDestroyFuncChanged` | 获取销毁函数改变事件。 | ESSceneObject |
| `updateFuncChanged` | 获取更新函数改变事件。 | ESSceneObject |

---
> 本文由 `generate-docs.mjs` 从源码自动生成，请勿手改。修改对象属性/方法后重跑脚本刷新。
