1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.FrameManager = void 0;
|
4 | class FrameManager {
|
5 | constructor(container) {
|
6 | this.container = container;
|
7 | }
|
8 | nextFrame(timestamp) {
|
9 | try {
|
10 | const container = this.container;
|
11 | if (container.lastFrameTime !== undefined &&
|
12 | timestamp < container.lastFrameTime + 1000 / container.fpsLimit) {
|
13 | container.draw();
|
14 | return;
|
15 | }
|
16 | const deltaValue = timestamp - container.lastFrameTime;
|
17 | const delta = {
|
18 | value: deltaValue,
|
19 | factor: (60 * deltaValue) / 1000,
|
20 | };
|
21 | container.lastFrameTime = timestamp;
|
22 | container.particles.draw(delta);
|
23 | if (container.getAnimationStatus()) {
|
24 | container.draw();
|
25 | }
|
26 | }
|
27 | catch (e) {
|
28 | console.error("tsParticles error in animation loop", e);
|
29 | }
|
30 | }
|
31 | }
|
32 | exports.FrameManager = FrameManager;
|