MultiplayerMinesweeper/www/scripts/display/visualLoop.js
Alexander Bass c89f24a2a7 Animations are now possible
Need new sprite system to accomodate for it though()
2022-06-19 22:39:31 -04:00

31 lines
508 B
JavaScript

import {render } from "./draw.js"
var RUNNING = false
var animationStage = 0;
export function start() {
if (!RUNNING) {
RUNNING = true
loop();
}
}
export function stop() {
RUNNING = false
}
export function get() {
return animationStage
}
async function loop() {
if (RUNNING === true)
setTimeout(function(){
if (animationStage < 2) {
animationStage = animationStage + 1;
} else {
animationStage = 0;
}
render()
loop();
}, (250));
}