Created
January 16, 2018 18:12
-
-
Save KrabCode/6e4753844fe280803a488992e02eaaaa to your computer and use it in GitHub Desktop.
oscillating resursive spiral
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
| float inputX, inputY; | |
| public void settings() { | |
| // size(800,600); | |
| fullScreen(P2D); | |
| } | |
| public void setup() { | |
| background(0); | |
| ellipseMode(CENTER); | |
| rectMode(CENTER); | |
| } | |
| public void draw(){ | |
| background(0); | |
| noStroke(); | |
| noFill(); | |
| // inputX = map(mouseX, 0, width, 10,15); | |
| inputX = 12; | |
| inputY = map(mouseY, 0, height, 1.01f, 2); | |
| drawRecursively(width/2, height/2, round(inputX), sin(radians(frameCount/5))); | |
| } | |
| void drawRecursively(int x , int y, float size, float orientation){ | |
| pushMatrix(); | |
| if(size < width && size > 10){ | |
| stroke(0,0,255); | |
| translate(x,y); | |
| rotate(orientation); | |
| rect(0,0,size,size); | |
| popMatrix(); | |
| drawRecursively(x,y, size*inputY, orientation+orientation/16); | |
| }else{ | |
| popMatrix(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment