diff --git a/packages/clarity-js/src/layout/animation.ts b/packages/clarity-js/src/layout/animation.ts index cfebd1db..ffb0d637 100644 --- a/packages/clarity-js/src/layout/animation.ts +++ b/packages/clarity-js/src/layout/animation.ts @@ -36,6 +36,19 @@ export function start(): void { return createdAnimation; } } + if (document.getAnimations) { + for (var animation of document.getAnimations()) { + if (animation.playState === "finished") { + trackAnimationOperation(animation, "finish"); + } + else if (animation.playState === "paused" || animation.playState === "idle") { + trackAnimationOperation(animation, "pause"); + } + else if (animation.playState === "running") { + trackAnimationOperation(animation, "play"); + } + } + } } }