Skip to content

Instantly share code, notes, and snippets.

@villares
Created May 24, 2017 01:32
Show Gist options
  • Save villares/dbbcbfd2ac183e4b9293c0891c4acb40 to your computer and use it in GitHub Desktop.
Save villares/dbbcbfd2ac183e4b9293c0891c4acb40 to your computer and use it in GitHub Desktop.
void setup() {
size(400, 400);
frameRate(5);
}
void draw() {
background(0);
stroke(255);
raio(width/2, 0, 10);
}
void raio(float x_start, float y_start, int num) {
float w = 70;
float y_step = 20;
float r_range = 10;
noFill();
pushMatrix();
translate(x_start, y_start);
beginShape();
vertex(0, 0);
for (int i = 1; i < num; i++) {
if (i % 2 == 0) {
vertex(-w/2 + random(-r_range, r_range), i*y_step + random(-r_range, r_range));
} else {
vertex(w/2 + random(-r_range, r_range), i*y_step + random(-r_range, r_range));
}
}
endShape();
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment