2022-06-20 02:39:31 +00:00
|
|
|
import {render } from "./draw.js"
|
2022-06-21 13:35:33 +00:00
|
|
|
var RUNNING = false;
|
2022-06-20 02:39:31 +00:00
|
|
|
var animationStage = 0;
|
|
|
|
export function start() {
|
|
|
|
if (!RUNNING) {
|
2022-06-21 13:35:33 +00:00
|
|
|
RUNNING = true;
|
2022-06-20 02:39:31 +00:00
|
|
|
loop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stop() {
|
|
|
|
RUNNING = false
|
|
|
|
}
|
|
|
|
|
|
|
|
export function get() {
|
|
|
|
return animationStage
|
|
|
|
}
|
|
|
|
|
|
|
|
async function loop() {
|
|
|
|
if (RUNNING === true)
|
|
|
|
setTimeout(function(){
|
2022-06-21 13:35:33 +00:00
|
|
|
if (animationStage < 6) {
|
2022-06-20 02:39:31 +00:00
|
|
|
animationStage = animationStage + 1;
|
|
|
|
} else {
|
|
|
|
animationStage = 0;
|
|
|
|
}
|
|
|
|
render()
|
|
|
|
loop();
|
|
|
|
}, (250));
|
|
|
|
}
|