系统优化
This commit is contained in:
1 parent
b98d67fdab
commit
c37cf09273
5 files changed
+489
-32
No files matched your search
@@ -98,7 +98,7 @@ export interface EmitterConfig {
|
||||
burstLoop: boolean // 爆发是否每秒重复
|
||||
/** 延迟发射(秒)= 粒子条左端位置 */
|
||||
delay: number
|
||||
/** 发射总时长(秒)= 粒子条宽度,超过后停止发射新粒子 */
|
||||
/** 持续发射时长(秒)= 时间轴绿色段;爆发模式不使用该时长 */
|
||||
duration: number
|
||||
shape: EmitShape // 发射形状
|
||||
radius: number
|
||||
@@ -346,7 +346,7 @@ export function defaultConfig(): EmitterConfig {
|
||||
burstCount: 50,
|
||||
burstLoop: false, // 一次性爆发(持续爆发开关已移除)
|
||||
delay: 0,
|
||||
duration: 0, // 0 = 无限发射/爆发,不受时长限制(发射时长 UI 已移除)
|
||||
duration: 1, // 持续发射时长;默认 1 秒(30f)。爆发模式运行时按 0 处理。
|
||||
shape: 'point',
|
||||
radius: 30,
|
||||
rectW: 60,
|
||||
@@ -858,7 +858,8 @@ export class ParticleEmitter extends Container {
|
||||
}
|
||||
this._attractionWasEnabled = cfg.attraction
|
||||
const inWindow = cfg.delay <= 0 || this._elapsed >= cfg.delay
|
||||
const withinDuration = cfg.duration <= 0 || this._elapsed < cfg.delay + cfg.duration
|
||||
// 发射时长只属于持续模式;爆发模式在延迟结束时执行一次,不显示也不消耗持续段。
|
||||
const withinDuration = cfg.mode === 'burst' || this._elapsed < cfg.delay + Math.max(1 / 30, cfg.duration)
|
||||
// 发射(仅在窗口内且未超时长)
|
||||
if (inWindow && withinDuration) {
|
||||
if (cfg.mode === 'stream') {
|
||||
|
||||
Reference in new issue
Block a user