31 lines
508 B
JavaScript
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));
|
|
}
|