updated animation call

master
Michael Murtaugh 2 years ago
parent b53850c03b
commit dc3d912faf

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

Loading…
Cancel
Save