Last active
February 17, 2019 19:31
-
-
Save wonderburg7/415118e39107840ece7923f659fa4e44 to your computer and use it in GitHub Desktop.
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
float pointNo = 100; | |
float stage = 0.0; | |
PVector point1; | |
PVector point2; | |
PVector point3; | |
PVector point4; | |
PVector point5, point6, point7, point8; | |
PVector l1mp, l2mp, l3mp, l4mp; | |
PVector l5mp, l6mp, l7mp, l8mp; | |
int colourValue = 0; | |
void setup() { | |
size(1000, 1000); | |
noLoop(); | |
translate(1000, 1000); | |
strokeWeight(2); | |
background(50,48,49); | |
point1 = new PVector(100, 100); | |
point2 = new PVector(900, 100); | |
point3 = new PVector(900, 900); | |
point4 = new PVector(100, 900); | |
point5 = new PVector(900, 100); | |
point6 = new PVector(900, 100); | |
point7 = new PVector(900, 900); | |
point8 = new PVector(900, 900); | |
} | |
void draw() { | |
stage = 0; | |
for (int i = 0; i < pointNo+1; i++) { | |
if (colourValue == 0){ | |
stroke(23,126,137); | |
} else if (colourValue == 1){ | |
stroke(8,76,97); | |
} else if (colourValue == 2){ | |
stroke(219,58,52); | |
} else if (colourValue == 3){ | |
stroke(255,200,87); | |
} | |
/* | |
l1mp = PVector.lerp(point1, point2, stage); | |
l2mp = PVector.lerp(point2, point3, stage); | |
l3mp = PVector.lerp(point3, point4, stage); | |
l4mp = PVector.lerp(point4, point1, stage); | |
line(l1mp.x, l1mp.y, l2mp.x, l2mp.y); | |
line(l2mp.x, l2mp.y, l3mp.x, l3mp.y); | |
line(l3mp.x, l3mp.y, l4mp.x, l4mp.y); | |
line(l4mp.x, l4mp.y, l1mp.x, l1mp.y); | |
l5mp = PVector.lerp(point5, point6, stage); | |
l6mp = PVector.lerp(point6, point7, stage); | |
l7mp = PVector.lerp(point7, point8, stage); | |
l8mp = PVector.lerp(point8, point5, stage); | |
line(l5mp.x, l5mp.y, l6mp.x, l6mp.y); | |
line(l6mp.x, l6mp.y, l7mp.x, l7mp.y); | |
line(l7mp.x, l7mp.y, l8mp.x, l8mp.y); | |
line(l8mp.x, l8mp.y, l5mp.x, l5mp.y); | |
*/ | |
l1mp = PVector.lerp(point1, point2, 0); | |
l3mp = PVector.lerp(point3, point4, stage); | |
line(l1mp.x, l1mp.y, l3mp.x, l3mp.y); | |
l4mp = PVector.lerp(point3, point3, 0); | |
l1mp = PVector.lerp(point1, point2, stage); | |
line(l4mp.x, l4mp.y, l1mp.x, l1mp.y); | |
stage += (1/pointNo); | |
colourValue++; | |
if (colourValue == 2){ | |
colourValue = 0; | |
} | |
} | |
save("LLL.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment