阶段10开发完成
This commit is contained in:
1 parent
cffe02c1ec
commit
c239171cc4
21 files changed
+997
-36
No files matched your search
@@ -465,8 +465,25 @@ export const useParticleStore = defineStore('particle', {
|
||||
const particleLife = c.lifeMode === 'fixed'
|
||||
? lifeMin
|
||||
: Math.max(lifeMin, lifeMax)
|
||||
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
|
||||
const emissionDuration = c.mode === 'stream'
|
||||
? c.streamBehavior === 'loop'
|
||||
? Math.max(1 / fps, Math.ceil(Math.max(1, Number(c.loopDurationFrames) || 1)) / fps)
|
||||
: Math.max(1 / fps, Number(c.duration) || 0)
|
||||
: 0
|
||||
let end = Math.max(0, Number(c.delay) || 0) + emissionDuration + particleLife
|
||||
if (c.mode === 'stream' && c.streamBehavior === 'loop') {
|
||||
if (c.generateLoopEndAnimation) {
|
||||
// 结束段从循环衔接帧开始,立即停止生成;额外保留一帧用于明确记录“全部死亡”。
|
||||
end = Math.max(0, Number(c.delay) || 0) + particleLife + 1 / fps
|
||||
} else if (c.generateLoopStartAnimation) {
|
||||
// 启动段从空状态自然预热到稳定循环衔接帧;寿命跨越多个周期时自动增加预热周期。
|
||||
const warmupCycles = Math.max(1, Math.ceil(particleLife / emissionDuration))
|
||||
end = Math.max(0, Number(c.delay) || 0) + emissionDuration * warmupCycles
|
||||
} else {
|
||||
// 纯循环段延迟期间保持衔接帧,之后播放一个完整周期,不追加常规生命周期尾段。
|
||||
end = Math.max(0, Number(c.delay) || 0) + emissionDuration
|
||||
}
|
||||
}
|
||||
if (end > maxSec) maxSec = end
|
||||
}
|
||||
for (const spine of this.spines) {
|
||||
@@ -480,7 +497,8 @@ export const useParticleStore = defineStore('particle', {
|
||||
const end = Math.max(0, Number(collider.followDuration) || 0)
|
||||
if (end > maxSec) maxSec = end
|
||||
}
|
||||
const frames = Math.max(1, Math.ceil(maxSec * fps))
|
||||
// totalFrames 表示快照数量;0 秒和末端点都可选,因此比末端帧编号多 1。
|
||||
const frames = Math.max(1, Math.ceil(maxSec * fps) + 1)
|
||||
this.timeline.totalFrames = frames
|
||||
// clamp 当前帧
|
||||
if (this.timeline.frame >= frames) this.timeline.frame = frames - 1
|
||||
|
||||
Reference in new issue
Block a user