Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var edge, step, rows;
- function setup() {
- createCanvas(600, 800);
- colorMode(HSB, 360, 100, 100);
- edge = 50;
- rows = 14;
- step = (height - 2 * edge) / rows;
- drawGrid();
- }
- function drawGrid() {
- background('#202020');
- for (var x = edge + step / 2; x < width - edge; x += step) {
- for (var y = edge + step / 2; y < height - edge; y += step) {
- drawElement(x, y);
- }
- }
- }
- function drawElement(x, y) {
- var sz = step * .9;
- noFill();
- //stroke("#ffffff");
- strokeCap(SQUARE);
- if (random(1) > 0.2) {
- while (sz > step * .1) {
- strokeWeight(random(1, 2));
- stroke(random(0, 360), 100, 100);
- push();
- translate(x, y);
- rotate(random(TWO_PI));
- var end = random(PI / 2, TWO_PI);
- arc(0, 0, sz, sz, 0, end);
- pop();
- sz += -step * .1;
- }
- }
- }
- function mouseReleased() {
- drawGrid();
- }
- function keyTyped() {
- if (key === 's') save("image-" + int(random(12345)) + ".png");
- }
- function draw() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement