updated animation call

master
Michael Murtaugh 2 years ago
parent b53850c03b
commit dc3d912faf

@ -9,15 +9,18 @@ function choice (arr) {
return ret;
}
function make_phrase (nn, terms) {
async function make_phrase (nn, terms, delay) {
nn.querySelector(".actor").innerHTML = choice(terms['actor']);
await sleep(delay);
nn.querySelector(".action").innerHTML = choice(terms['action']);
await sleep(delay);
if (randint(0, 2) == 0) {
nn.querySelector(".prefix").innerHTML = choice(terms['prefix'])+'-';
} else {
nn.querySelector(".prefix").remove();
}
nn.querySelector(".sort").innerHTML = choice(terms['sort']);
await sleep(delay);
nn.querySelector(".media").innerHTML = choice(terms['media']);
}
@ -35,7 +38,7 @@ async function make_phrases () {
while (true) {
let nn = template.cloneNode(true);
call.appendChild(nn);
make_phrase(nn, terms);
await make_phrase(nn, terms, 0.25);
if (terms['actor'].length == 0 || terms['action'].length == 0 || terms['prefix'].length == 0 || terms['sort'].length == 0 || terms['media'].length == 0) {
console.log("out of terms, stopping");
break;

Loading…
Cancel
Save