fix: sequenceCurve 在 0 处不固定为 0

This commit is contained in:
AncTe committed 2026-11-25 19:09:21 +08:00
1 parent f2b5ba9d97
commit 35d03881d2
1 file changed
+11 -4
+11 -4
View File
@@ -185,12 +185,19 @@ export function sequenceCurve(
);
return () => 0;
}
const keep = [seq[0](0), ...cumsum(duration)];
const keep = [0, ...cumsum(duration)];
return p => {
const index = keep.findIndex(sum => p <= sum);
if (index <= 0) return 0;
const progress = (p - keep[index - 1]) / duration[index - 1];
return seq[index - 1](progress) * scale[index - 1] + move[index - 1];
if (index < 0) {
return 0;
} else if (index === 0) {
return seq[0](0);
} else {
const progress = (p - keep[index - 1]) / duration[index - 1];
return (
seq[index - 1](progress) * scale[index - 1] + move[index - 1]
);
}
};
}