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

Method animate

assets/main.js:2877–2912  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2875 }
2876
2877 animate() {
2878 this.renderRequested = false;
2879 this.needsContinuousRender = false;
2880
2881 const renderFrame = (time) => {
2882 this.renderRequested = false;
2883 const controlsChanged = this.controls.update();
2884 this.renderer.render(this.scene, this.camera);
2885 if (this.fpsMonitor) {
2886 this.fpsMonitor.update(time);
2887 }
2888 if (this.needsContinuousRender || controlsChanged) {
2889 this.requestRender();
2890 }
2891 };
2892
2893 this.requestRender = () => {
2894 if (this.renderRequested) return;
2895 this.renderRequested = true;
2896 requestAnimationFrame(renderFrame);
2897 };
2898
2899 this.controls.addEventListener("start", () => {
2900 this.needsContinuousRender = true;
2901 this.requestRender();
2902 });
2903 this.controls.addEventListener("end", () => {
2904 this.needsContinuousRender = false;
2905 this.requestRender();
2906 });
2907 this.controls.addEventListener("change", () => {
2908 this.requestRender();
2909 });
2910
2911 this.requestRender();
2912 }
2913}
2914
2915function clamp(value, min, max) {

Callers 1

constructorMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected