Created
January 16, 2018 08:46
-
-
Save KrabCode/8ae7b29e0a2cc07f5b7874d2270e8e04 to your computer and use it in GitHub Desktop.
recursively smaller lines!
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
| void setup(){ | |
| //size(800,600); | |
| fullScreen(P2D); | |
| } | |
| float step ; | |
| void draw(){ | |
| background(255); | |
| step = map(mouseX, 0, width, .1f, 1f); | |
| drawRecursively(width/2, height/2, width/3, true); | |
| } | |
| void drawRecursively(float x, float y, float size, boolean hor){ | |
| if(size < width/2 && size > 2f){ | |
| if(hor){ | |
| line(x-size, y, x+size, y); | |
| drawRecursively(x-size, y, size * step, !hor); | |
| drawRecursively(x+size, y, size * step, !hor); | |
| }else{ | |
| line(x, y-size, x, y+size); | |
| drawRecursively(x, y-size, size * step, !hor); | |
| drawRecursively(x, y+size, size * step, !hor); | |
| } | |
| } | |
| } | |
Author
KrabCode
commented
Jan 16, 2018

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment