Skip to content

Commit f6b6851

Browse files
authored
Update base-sprite.ts
1 parent 485a655 commit f6b6851

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,13 @@ export function linearTimeFn(
211211
kf: TAnimationKeyFrame,
212212
opts: Required<IAnimationOpts>,
213213
): Partial<TAnimateProps> {
214-
let offsetTime = time - opts.delay;
215-
if (offsetTime / opts.duration > opts.iterCount) {
216-
offsetTime = opts.duration * opts.iterCount;
217-
}
218-
214+
const offsetTime = time - opts.delay;
219215
const t = offsetTime % opts.duration;
216+
const process =
217+
offsetTime / opts.duration >= opts.iterCount || offsetTime === opts.duration
218+
? 1
219+
: t / opts.duration;
220220

221-
const process = offsetTime === opts.duration ? 1 : t / opts.duration;
222221
const idx = kf.findIndex((it) => it[0] >= process);
223222
if (idx === -1) return {};
224223

0 commit comments

Comments
 (0)