解决粒子首位帧衔接问题

This commit is contained in:
tianmo committed 2026-09-02 22:55:38 +08:00
1 parent 0656684a92
commit 9c2421110c
22 files changed
+2873 -1407

No files matched your search

+2 -4
View File
@@ -5,6 +5,7 @@ import type { SpineExportResult, SpineExportWarning, SpineJsonDocument, SpineJso
import { downgradeSpineJsonTo38 } from './spine38JsonExporter'
import { reduceBezierSamples, reduceNumericSamples, roundSpine, unwrapDegrees, type NumericSample } from './spineKeyframeReducer'
import { buildWeightedTrailMesh } from './spineMeshBuilder'
import { loopSegmentTiming } from '../core/loopSegmentTiming'
type Track = { key: string; name: string; states: Array<ParticleState | null> }
type ExportInput = { systems: ParticleSystem[]; timeline: TimelineState; settings: SpineExportSettings }
@@ -51,10 +52,7 @@ function particleDurationFrames(system: ParticleSystem, fps: number) {
if (c.mode !== 'stream') end = delay + life
else if (c.streamBehavior !== 'loop') end = delay + Math.max(1 / fps, Number(c.duration) || 0) + life
else {
const loop = Math.max(1, Math.ceil(Number(c.loopDurationFrames) || 1)) / fps
if (c.generateLoopEndAnimation) end = delay + life + 1 / fps
else if (c.generateLoopStartAnimation) end = delay + loop * Math.max(1, Math.ceil(life / loop))
else end = delay + loop
end = delay + loopSegmentTiming(c, fps).total / fps
}
return Math.max(1, Math.ceil(end * fps) + 1)
}