Created
October 9, 2017 12:18
-
-
Save gaffer-93/57e9bc3fe7080c15fa1bcc1705b06f24 to your computer and use it in GitHub Desktop.
This file contains hidden or 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... | |
| int number_of_triangles = 5; | |
| // that get 5 times bigger everytime? | |
| int scaler = 5; | |
| // Set your starting cordinates... | |
| int x = number_of_triangles * scaler; // x starts at 45 (5 * 5 = 45) | |
| int y = 0; // y starts at 0 | |
| int w = scaler * 2; // w starts at 10 (5 * 2 = 10) | |
| int 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