Skip to content

tshwantshaGape

Runs tshwantsha once — or a set number of times — while the loop is halted.

When the loop has been halted with emisaPoapoeletso, tshwantshaGape is what runs tshwantsha — once, or as many times as you ask for.

When you may call it (p5.js 2.x): tshwantshaGape only does anything after setaLoeto has finished. Calling it inside setaLoeto — or inside tshwantsha itself — does nothing at all. Its natural home is a function that responds to the user (a mouse click, say); those keywords arrive in a later batch, so the examples below use setTimeout to wait.

Note too that p5.js draws one frame after setaLoeto even when emisaPoapoeletso has been called — which is why a first image appears before you call tshwantshaGape.

tshwantshaGape(makgetlho)
NameTypeDescription
makgetlho (optional)paloHow many times tshwantsha should run. Defaults to once when omitted.
Run tshwantsha five times to draw a row of circles
diri x = 40;

tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(220);
  emisaPoapoeletso();
}

tiro tshwantsha() {
  tlatsaMmala(200, 0, 120);
  kgolokwe(x, 200, 50);
  x = x + 70;
}

setTimeout(tiro () {
  tshwantshaGape(5);
}, 600);
Run tshwantsha once to change the picture
diri mmala = 0;

tiro setaLoeto() {
  thalaKanefase(400, 400);
  emisaPoapoeletso();
}

tiro tshwantsha() {
  bokamorago(220);
  tlatsaMmala(mmala, 160, 90);
  khutloTharo(200, 60, 60, 340, 340, 340);
  mmala = 220;
}

setTimeout(tiro () {
  tshwantshaGape();
}, 800);

emisaPoapoeletso, simololaPoapoeletso, boemoJwaPoapoeletso, tshwantsha