| 339 | }; |
| 340 | |
| 341 | const tick = now => { |
| 342 | const {all} = rAF; |
| 343 | all.forEach(object => { |
| 344 | trackTime(object, now); |
| 345 | const progress = getProgress(object); |
| 346 | const { |
| 347 | element, |
| 348 | keyframes, |
| 349 | loop, |
| 350 | optimize, |
| 351 | direction, |
| 352 | change, |
| 353 | easing, |
| 354 | duration, |
| 355 | gaussian, |
| 356 | end, |
| 357 | options |
| 358 | } = object; |
| 359 | |
| 360 | // object is an animation |
| 361 | if (direction) { |
| 362 | let curve = progress; |
| 363 | switch (progress) { |
| 364 | case 0: |
| 365 | if (direction == "alternate") reverseKeyframes(keyframes); |
| 366 | break; |
| 367 | case 1: |
| 368 | if (loop) |
| 369 | resetTime(object); |
| 370 | else { |
| 371 | all.delete(object); |
| 372 | if (optimize && element) accelerate(element); |
| 373 | if (gaussian) clearBlur(element, gaussian); |
| 374 | } |
| 375 | if (end) end(options); |
| 376 | break; |
| 377 | default: |
| 378 | curve = ease(easing, progress); |
| 379 | } |
| 380 | if (gaussian) setDeviation(object, curve); |
| 381 | if (change && end) change(curve); |
| 382 | if (element) Object.assign(element.style, createStyles(keyframes, curve)); |
| 383 | return; |
| 384 | } |
| 385 | |
| 386 | // object is a delay |
| 387 | if (progress < 1) return; |
| 388 | all.delete(object); |
| 389 | end(duration); |
| 390 | }); |
| 391 | |
| 392 | if (all.size) requestAnimationFrame(tick); |
| 393 | }; |
| 394 | |
| 395 | document.addEventListener("visibilitychange", () => { |
| 396 | const now = performance.now(); |
nothing calls this directly
no test coverage detected