MCPcopy Create free account
hub / github.com/DFin/Neural-Network-Visualisation / update

Method update

assets/main.js:1811–1833  ·  view source on GitHub ↗
(time)

Source from the content-addressed store, hash-verified

1809 }
1810
1811 update(time) {
1812 if (!Number.isFinite(time)) return;
1813 if (this.lastTimestamp === 0) {
1814 this.lastTimestamp = time;
1815 this.lastFrameTimestamp = time;
1816 return;
1817 }
1818 const delta = time - this.lastTimestamp;
1819 this.lastTimestamp = time;
1820 if (delta < 0) return;
1821
1822 this.accumulatedTime += delta;
1823 this.frameCount += 1;
1824 this.lastFrameTimestamp = time;
1825
1826 if (this.accumulatedTime >= 250) {
1827 const fps = Math.round((this.frameCount * 1000) / this.accumulatedTime);
1828 this.currentFps = fps;
1829 this.accumulatedTime = 0;
1830 this.frameCount = 0;
1831 this.refreshDisplay();
1832 }
1833 }
1834
1835 refreshDisplay() {
1836 const now = typeof performance !== "undefined" ? performance.now() : Date.now();

Callers 4

initializeVisualizerFunction · 0.45
refreshNetworkStateFunction · 0.45
onSnapshotChangeFunction · 0.45
renderFrameMethod · 0.45

Calls 1

refreshDisplayMethod · 0.95

Tested by

no test coverage detected