Created
March 8, 2018 10:21
-
-
Save m0wh/e16eba61ec2a22f816b96ec73b5183b7 to your computer and use it in GitHub Desktop.
Processing experiment
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
Wall wall = new Wall(); | |
float i = 0; | |
int res = 8; | |
int angle; | |
void setup() { | |
size(800, 800); | |
frameRate(150); | |
noLoop(); | |
} | |
void draw() { | |
background(#313E4D); | |
stroke(#43CDF5); | |
strokeWeight(2); | |
for(int x = 0; x < res*width/res; x+=width/res) { | |
for(int y = 0; y < res*height/res; y+=height/res) { | |
angle = int(random(-2,2)); | |
wall.create(width/res/2+x, height/res/2+y, PI/4 + angle*PI/2, sqrt((width/res)*(width/res) + (height/res)*(height/res))); | |
} | |
} | |
} | |
class Wall { | |
int xp; | |
int yp; | |
void create(int x, int y, float angle, float len) { | |
xp = int(cos(angle)*len/2); | |
yp = int(sin(angle)*len/2); | |
line(x + xp,y - yp,x - xp ,y + yp); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment