import * as THREE from 'three'; import { TweenKeyframe } from './utils'; type ParticleType = 'CUBE' | 'SPHERE'; /** * 粒子系统初始化参数 */ interface ParticleArgs { /** 粒子的初始位置坐标 */ positionBase: THREE.Vector3; /** * 粒子坐标的抖动计算形式 * @description * 粒子坐标的抖动计算形式,分 `CUBE` 和 `SPHERE` 形式。 * `CUBE` 形式通过一个 三维向量 的扩散值 positionCubeSpread,乘上一个 [0, 1] 的随机三维向量 计算。 * `SPHERE` 形式通过一个 数字 的扩散值 positionSphereSpread,乘上一个随机单位向量 计算。 */ positionStyle: ParticleType; /** 粒子坐标的抖动`CUBE`计算形式下的扩散值 */ positionCubeSpread: THREE.Vector3; /** 粒子坐标的抖动`SPHERE`计算形式下的扩散值 */ positionSphereSpread: number; /** * 粒子速度的抖动计算形式 * @description * 粒子速度的抖动计算形式,分 `CUBE` 和 `SPHERE` 形式。 * `CUBE` 形式通过一个 三维向量 的速度值 velocityCubeBase 加上 三维向量 的扩散值 velocityCubeSpread 乘上一个 [0, 1] 的随机三维向量 计算。 * `SPHERE` 形式通过一个 数字 的速度值 velocitySphereBase 加上 数字 的扩散值 velocitySphereSpread 乘上 粒子坐标与粒子的初始位置坐标方向的单位向量 计算。 */ velocityStyle: ParticleType; /** 粒子速度的`CUBE`计算形式下的速度值 */ velocityCubeBase: THREE.Vector3; /** 粒子速度的`CUBE`计算形式下的扩散值 */ velocityCubeSpread: THREE.Vector3; /** 粒子速度的`SPHERE`计算形式下的速度值 */ velocitySphereBase: number; /** 粒子速度的`SPHERE`计算形式下的扩散值 */ velocitySphereSpread: number; /** 粒子加速度 */ accelerationBase: THREE.Vector3; /** 粒子加速度扩散值 */ accelerationSpread: THREE.Vector3; /** 旋转角度初始值 */ angleBase: number; /** 旋转角度初始值的扩散值 */ angleSpread: number; /** 旋转角度速度值 */ angleVelocityBase: number; /** 旋转角度速度值的扩散值 */ angleVelocitySpread: number; /** 旋转角度加速度值 */ angleAccelerationBase: number; /** 旋转角度加速度值扩散值 */ angleAccelerationSpread: number; /** 粒子大小 */ sizeBase: number; /** 粒子大小的扩散值 */ sizeSpread: number; /** 粒子大小随时间分布的增益 */ sizeTween: TweenKeyframe | null; /** * 颜色(hsl) * @description * http://en.wikipedia.org/wiki/HSL_and_HSV * `{ x: h, y: s, z: l }` */ colorBase: THREE.Vector3; /** 颜色(hsl)的扩散值 * @description * http://en.wikipedia.org/wiki/HSL_and_HSV * `{ x: h, y: s, z: l }` */ colorSpread: THREE.Vector3; /** * 颜色(hsl)随时间分布的增益 * @description * http://en.wikipedia.org/wiki/HSL_and_HSV * `{ x: h, y: s, z: l }` */ colorTween: TweenKeyframe | null; /** 透明度 */ opacityBase: number; /** 透明度的扩散值 */ opacitySpread: number; /** 透明度随时间分布的增益 */ opacityTween: TweenKeyframe | null; /** 贴图素材 */ texture: THREE.Texture; /** 材质混合方式 */ blending: THREE.Blending; /** 一秒产生多少粒子 */ particlesPerSecond: number; /** 粒子存活时长 */ particleDeathAge: number; } declare class Particle extends THREE.Points { needsRender: boolean; /** 是否暂停 */ paused: boolean; private disposed; private birthTime; private instances; /** 粒子的初始位置坐标 */ positionBase: THREE.Vector3; /** * 粒子坐标的抖动计算形式 * @description * 粒子坐标的抖动计算形式,分 `CUBE` 和 `SPHERE` 形式。 * `CUBE` 形式通过一个 三维向量 的扩散值 positionCubeSpread,乘上一个 [0, 1] 的随机三维向量 计算。 * `SPHERE` 形式通过一个 数字 的扩散值 positionSphereSpread,乘上一个随机单位向量 计算。 */ positionStyle: ParticleType; /** 粒子坐标的抖动`CUBE`计算形式下的扩散值 */ positionCubeSpread: THREE.Vector3; /** 粒子坐标的抖动`SPHERE`计算形式下的扩散值 */ positionSphereSpread: number; /** * 粒子速度的抖动计算形式 * @description * 粒子速度的抖动计算形式,分 `CUBE` 和 `SPHERE` 形式。 * `CUBE` 形式通过一个 三维向量 的速度值 velocityCubeBase 加上 三维向量 的扩散值 velocityCubeSpread 乘上一个 [0, 1] 的随机三维向量 计算。 * `SPHERE` 形式通过一个 数字 的速度值 velocitySphereBase 加上 数字 的扩散值 velocitySphereSpread 乘上 粒子坐标与粒子的初始位置坐标方向的单位向量 计算。 */ velocityStyle: ParticleType; /** 粒子速度的`CUBE`计算形式下的速度值 */ velocityCubeBase: THREE.Vector3; /** 粒子速度的`CUBE`计算形式下的扩散值 */ velocityCubeSpread: THREE.Vector3; /** 粒子速度的`SPHERE`计算形式下的速度值 */ velocitySphereBase: number; /** 粒子速度的`SPHERE`计算形式下的扩散值 */ velocitySphereSpread: number; /** 粒子加速度 */ accelerationBase: THREE.Vector3; /** 粒子加速度扩散值 */ accelerationSpread: THREE.Vector3; /** 旋转角度初始值 */ angleBase: number; /** 旋转角度初始值的扩散值 */ angleSpread: number; /** 旋转角度速度值 */ angleVelocityBase: number; /** 旋转角度速度值的扩散值 */ angleVelocitySpread: number; /** 旋转角度加速度值 */ angleAccelerationBase: number; /** 旋转角度加速度值扩散值 */ angleAccelerationSpread: number; /** 粒子大小 */ sizeBase: number; /** 粒子大小的扩散值 */ sizeSpread: number; /** 粒子大小随时间分布的增益 */ sizeTween: TweenKeyframe | null; /** * 颜色(hsl) * @description * http://en.wikipedia.org/wiki/HSL_and_HSV * `{ x: h, y: s, z: l }` */ colorBase: THREE.Vector3; /** 颜色(hsl)的扩散值 * @description * http://en.wikipedia.org/wiki/HSL_and_HSV * `{ x: h, y: s, z: l }` */ colorSpread: THREE.Vector3; /** * 颜色(hsl)随时间分布的增益 * @description * http://en.wikipedia.org/wiki/HSL_and_HSV * `{ x: h, y: s, z: l }` */ colorTween: TweenKeyframe | null; /** 透明度 */ opacityBase: number; /** 透明度的扩散值 */ opacitySpread: number; /** 透明度随时间分布的增益 */ opacityTween: TweenKeyframe | null; /** 一秒产生多少粒子 */ particlesPerSecond: number; /** 粒子存活时长 */ particleDeathAge: number; constructor(args: Partial); /** 贴图素材 */ get texture(): THREE.Texture | null; set texture(value: THREE.Texture | null); /** 材质混合方式 */ get blending(): THREE.Blending; set blending(value: THREE.Blending); private createInstance; /** 暂停 */ pause(): void; /** 开始 */ play(): void; /** * 通过 Five 默认调用的 setTime 方法 * @param time - 毫秒 */ setTime(time: number): void; /** 析构 */ dispose(): void; } export { Particle }; export type { ParticleArgs, ParticleType, TweenKeyframe as ParticleTweenKeyframe };