系统优化

This commit is contained in:
tianmo committed 2026-08-29 01:59:58 +08:00
1 parent b98d67fdab
commit c37cf09273
5 files changed
+489 -32

No files matched your search

+6 -4
View File
@@ -80,7 +80,8 @@ export const useParticleStore = defineStore('particle', {
activeId: 0,
activeObjectType: 'particle' as SceneObjectType,
activeObjectId: 0,
timeline: { playing: true, loop: true, frame: 0, totalFrames: 120, fps: 60, recorded: false, animation: 'animation' } as TimelineState,
// 与 Spine 编辑器默认时间基准对齐:1 秒 = 30 帧。
timeline: { playing: true, loop: true, frame: 0, totalFrames: 60, fps: 30, recorded: false, animation: 'animation' } as TimelineState,
settings: { tickEnabled: false, axisFontSize: 12, tickWidth: 1, showAxisLabels: true, axisColor: '#7a86ad' } as SettingsState,
}),
getters: {
@@ -203,10 +204,10 @@ export const useParticleStore = defineStore('particle', {
},
/** 依据所有粒子系统的"最晚消失时间"重算总帧数。
* 固定生命周期使用 lifeMin;随机生命周期使用上下限中的较大值。
* 单系统总时长 = delay(延迟) + duration(发射时长) + 最大粒子生命,
* 单系统总时长 = delay + 持续模式 duration(爆发为 0)+ 最大粒子生命,
* 多系统取最大;转帧 = ceil(sec * fps)。 */
recalcTotalFrames() {
const fps = this.timeline.fps || 60
const fps = this.timeline.fps || 30
let maxSec = 0
for (const sys of this.systems) {
const c = sys.config
@@ -215,7 +216,8 @@ export const useParticleStore = defineStore('particle', {
const particleLife = c.lifeMode === 'fixed'
? lifeMin
: Math.max(lifeMin, lifeMax)
const end = Math.max(0, Number(c.delay) || 0) + Math.max(0, Number(c.duration) || 0) + particleLife
const emissionDuration = c.mode === 'stream' ? Math.max(1 / fps, Number(c.duration) || 0) : 0
const end = Math.max(0, Number(c.delay) || 0) + emissionDuration + particleLife
if (end > maxSec) maxSec = end
}
const frames = Math.max(1, Math.ceil(maxSec * fps))