Skip to content
ExamplesOpen editor ↗

tshwantshaGape

→ redraw()

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

tshwantshaGape(makgetlho)

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: 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 — pebaETobeditswe. The examples below use it: one frame is drawn per click, so you watch tshwantsha run one step at a time.

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

NameTypeDescription
makgetlho (optional)paloHow many times tshwantsha should run. Defaults to once when omitted.
One more circle per click
diri x = 40;

tiro setaLoeto() {
  thalaKanefase(400, 200);
  bokamorago(238);
  tlogelaMothalo();
  emisaPoapoeletso();
  tlhalosa('Mola wa diko tse dikhibidu o o okelediwang ka sediko se le sengwe nako nngwe le nngwe fa kanefase e tobediwa.');
}

tiro tshwantsha() {
  tlatsaMmala(200, 70, 110);
  thalaSediko(x, 100, 46);
  x = x + 56;
}

tiro pebaETobeditswe() {
  tshwantshaGape();
}
Many frames from one click
diri sekhutlo = 0;

tiro setaLoeto() {
  thalaKanefase(400, 260);
  seeloSaSekhutlo(DEGREES);
  bokamorago(24, 28, 40);
  emisaPoapoeletso();
  tlhalosa('Mothalo o o dikologang mo bogareng, o o okelediwang ka mela e le metlhano nako nngwe le nngwe fa kanefase e tobediwa.');
}

tiro tshwantsha() {
  baya();
  sutisa(200, 130);
  dikolosa(sekhutlo);
  mothaloMmala(240, 200, 120);
  boketeMothalo(2);
  thalaMothalo(0, 0, 110, 0);
  tsaya();
  sekhutlo = sekhutlo + 11;
}

tiro pebaETobeditswe() {
  tshwantshaGape(5);
}

emisaPoapoeletso, simololaPoapoeletso, boemoJwaPoapoeletso, tshwantsha, pebaETobeditswe