dikolosa
→ rotate()Turns the drawing around the (0, 0) point.
dikolosa(sekhutlo)Everything drawn after dikolosa appears turned. The shape turns around the (0, 0) point, not around its own centre — which is why dikolosa is usually used after sutisa, which puts (0, 0) wherever you want the turning to happen.
The angle follows seeloSaSekhutlo. By default it is read in radians: dikolosa(1) is one radian, roughly 57°. Call seeloSaSekhutlo(DEGREES) first to count in degrees.
Transformations accumulate, and are reset at the start of tshwantsha. So a single dikolosa inside tshwantsha does not make a shape spin.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
sekhutlo | palo | How far to turn, in the unit seeloSaSekhutlo has set. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(28, 30, 48);
seeloSaSekhutlo(DEGREES);
tlogelaMothalo();
baya();
sutisa(200, 200);
gopheta (diri i = 0; i < 12; i = i + 1) {
dikolosa(30);
tlatsaMmala(230, 90 + i * 12, 150, 200);
thalaSelee(0, -80, 46, 120);
}
tsaya();
tlatsaMmala(250, 220, 120);
thalaSediko(200, 200, 50);
}tiro setaLoeto() {
thalaKanefase(400, 400);
seeloSaSekhutlo(DEGREES);
}
tiro tshwantsha() {
bokamorago(18, 20, 36);
tlogelaMothalo();
// peba e laola gore ngwedi o kae mo tseleng ya ona
metlha sekhutlo = lekanyetsa(thibela(pebaX, 0, 400), 0, 400, 0, 360);
baya();
sutisa(200, 200);
tlatsaMmala(250, 210, 80);
thalaSediko(0, 0, 70);
dikolosa(sekhutlo);
tlatsaMmala(210, 215, 225);
thalaSediko(120, 0, 26);
tsaya();
}