Created
October 9, 2017 12:17
-
-
Save gaffer-93/0b7587c7ed25fdeedecb87a02b69e345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// So I think this will work, havent tested it though | |
void draw() | |
{ | |
size(500, 500); | |
// So we want 5 triangles... | |
number_of_triangles = 5; | |
// that get 5 times bigger everytime? | |
scaler = 5; | |
// Set your starting cordinates... | |
x = number_of_triangles * scaler; // x starts at 45 (5 * 5 = 45) | |
y = 0; // y starts at 0 | |
w = scaler * 2; // w starts at 10 (5 * 2 = 10) | |
h = w; // h stays at 10 each time (w = 10 now so we can just reuse that by doing h = w) | |
// From 0 to number_of_triangles countin up in 1s -> 0, 1, 2, 3, 4 (notice the < meaning we stop at 4 but we started at 0 so it's still 5 traingles) | |
for (int i = 0; i < number_of_triangles; i = i + 1) { | |
x = x - scaler; // x goes down by 5 (scaler) each time | |
y = y + scaler * 2; // y goes up by 10 (scaler * 2) each time | |
w = w + scaler * 2; // w goes up by 10 (scaler * 2) each time | |
rect(x, y, w, h); // draw that shit | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment