godisa
→ scale()Makes everything drawn afterwards bigger or smaller.
godisa(tekanyetso)Give godisa a number and every shape after it is multiplied by that number. godisa(2) makes things twice as big; godisa(0.5) makes them half the size. A number below 1 shrinks — the name speaks of growing, but the function does both.
You can give two numbers to change width and height separately: godisa(2, 0.5) stretches sideways and squashes vertically.
Scaling is done from the (0, 0) point, so a shape does not grow in place — it moves too. Use sutisa first if you want it to grow where it stands.
Transformations accumulate, and here they multiply. Calling godisa(2) twice is the same as calling godisa(4) once, not godisa(2).
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
tekanyetso | palo | The number to multiply by. 1 changes nothing, 2 doubles, 0.5 halves. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(240);
tlogelaMothalo();
metlha ditekanyetso = [0.5, 0.85, 1.2, 1.6];
gopheta (diri i = 0; i < 4; i = i + 1) {
baya();
sutisa(70 + i * 90, 200);
godisa(ditekanyetso[i]);
// dipalo tse di tshwanang mo go tsotlhe tse nne — godisa fela ke e e fetogang
tlatsaMmala(70 + i * 45, 150, 220 - i * 30);
thalaKhutlotharo(-30, 25, 0, -35, 30, 25);
tsaya();
}
}tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(20, 26, 40);
tlogelaMothalo();
gopheta (diri i = 0; i < 8; i = i + 1) {
baya();
sutisa(200, 60 + i * 42);
// e otlolola ka fa go tshelang fa e ntse e pitlagana ka fa go emeng
godisa(0.5 + i * 0.22, 1.1 - i * 0.11);
tlatsaMmala(240 - i * 18, 120 + i * 14, 90 + i * 18);
thalaSediko(0, 0, 80);
tsaya();
}
}