Skip to content

Commit 3da5c7d

Browse files
authored
Merge pull request #461 from QAQCup/QAQCup-patch-2
fix: 修复Sprite动画最后一帧有偏差的问题
2 parents 5ad24ed + f6b6851 commit 3da5c7d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/av-cliper/src/sprite/base-sprite.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,12 @@ export function linearTimeFn(
212212
opts: Required<IAnimationOpts>,
213213
): Partial<TAnimateProps> {
214214
const offsetTime = time - opts.delay;
215-
if (offsetTime / opts.duration >= opts.iterCount) return {};
216-
217215
const t = offsetTime % opts.duration;
216+
const process =
217+
offsetTime / opts.duration >= opts.iterCount || offsetTime === opts.duration
218+
? 1
219+
: t / opts.duration;
218220

219-
const process = offsetTime === opts.duration ? 1 : t / opts.duration;
220221
const idx = kf.findIndex((it) => it[0] >= process);
221222
if (idx === -1) return {};
222223

0 commit comments

Comments
 (0)