tshwantshaGape
Runs
tshwantshaonce — 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.
Syntax
Section titled “Syntax”tshwantshaGape(makgetlho)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
makgetlho (optional) | palo | How many times tshwantsha should run. Defaults to once when omitted. |
Examples
Section titled “Examples”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);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);See also
Section titled “See also”emisaPoapoeletso, simololaPoapoeletso, boemoJwaPoapoeletso, tshwantsha