Spaces:
Sleeping
Sleeping
Download backend/libs/three/renderers/webgl/WebGLAnimation.js from k-l-lambda/starry: direct link, hf CLI and curl.
- Browser
- Download file 737 Bytes
-
https://huggingface.co/spaces/k-l-lambda/starry/resolve/main/backend/libs/three/renderers/webgl/WebGLAnimation.js
- Command line
-
hf download hf://spaces/k-l-lambda/starry/backend/libs/three/renderers/webgl/WebGLAnimation.js
-
curl -L -o WebGLAnimation.js https://huggingface.co/spaces/k-l-lambda/starry/resolve/main/backend/libs/three/renderers/webgl/WebGLAnimation.js
737 Bytes
| function WebGLAnimation() { | |
| let context = null; | |
| let isAnimating = false; | |
| let animationLoop = null; | |
| let requestId = null; | |
| function onAnimationFrame(time, frame) { | |
| animationLoop(time, frame); | |
| requestId = context.requestAnimationFrame(onAnimationFrame); | |
| } | |
| return { | |
| start: function () { | |
| if (isAnimating === true) return; | |
| if (animationLoop === null) return; | |
| requestId = context.requestAnimationFrame(onAnimationFrame); | |
| isAnimating = true; | |
| }, | |
| stop: function () { | |
| context?.cancelAnimationFrame(requestId); | |
| isAnimating = false; | |
| }, | |
| setAnimationLoop: function (callback) { | |
| animationLoop = callback; | |
| }, | |
| setContext: function (value) { | |
| context = value; | |
| }, | |
| }; | |
| } | |
| export { WebGLAnimation }; | |