From 3828de6d0b1fce91a40d21ee276cbb3ae2b72239 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 16 Sep 2020 23:45:50 +1000 Subject: [PATCH] squareGen: clone of bismuth.garden icon but randomly generated each time --- squareGen/squareGen.pde | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 squareGen/squareGen.pde diff --git a/squareGen/squareGen.pde b/squareGen/squareGen.pde new file mode 100644 index 0000000..4dbb59a --- /dev/null +++ b/squareGen/squareGen.pde @@ -0,0 +1,26 @@ +int size = 250; +int weight = 20; +int gridSize = 20; +int repetitions = int(random(5)); +int dir = int(random(0, 2)); + +void setup() { + size(500, 500); +} + +void draw() { + background(255); + stroke(0); + fill(255); + strokeWeight(weight); + float centerW = (width/2)-(size/2); + float centerH = (height/2)-(size/2); + rect(centerW, centerH, size, size); + strokeCap(SQUARE); + stroke(0); + strokeWeight(weight/2); + //fill(255); + float startX = centerW + weight; + float startY = centerH + weight; + line(startX, startY, startX + (gridSize*repetitions*(1-dir)), startY + (gridSize*repetitions*dir)); +}