/*
Judy Li
Section A
judyli@andrew.cmu.edu
Project-04
*/
function setup() {
createCanvas(400, 300);
background(218,175,32);
}
function draw() {
var x = 0;
var x1 = 0;
var x2 = 0;
var x3 = 0;
var x4 = 0;
var x5 = 0;
var y2 = 0;
var y3 = 0;
var y4 = 0;
var y5 = 0;
for (var i = 0; i < 50; i++) {
x += 10;
stroke(255, 0, 0);
line(300, 300, x, 0);
}
for (var e = 0; e < 50; e++) {
x1 += 10;
stroke(0,255,255);
line(300, 0, x1, 300);
}
for (var c = 0; c < 1; c += 0.1) {
x2 = lerp(300, 400, c);
y2 = lerp(150, 0, c);
stroke(0, 0, 255);
line(400, 150, x2, y3);
}
for (var d = 0; d < 1; d += 0.1) {
x3 = lerp(300, 400, d);
y3 = lerp(300, 300, d);
stroke(255, 0, 255);
line(400, 150, x3, y3);
}
for (var h = 0; h < 30; h++) {
x4 += 10;
y4 += 10;
stroke(255, 255, 255);
line(0, y4, x4, 300);
}
for (var s = 0; s < 30; s++) {
x5 += 10;
y5 += 10;
stroke(100, 100, 100);
line(300 - x5, 0, 0, y5);
}
for (var f = 0; f < 6; f++) {
ellipse(450 - (f * 75), 150, 20 * (f / 1.5), 20 * (f / 1.5));
ellipse(450 - (f * 75), 150, 18 * (f / 1.5), 18 * (f / 1.5));
ellipse(450 - (f * 75), 150, 16 * (f / 1.5), 16 * (f / 1.5));
ellipse(450 - (f * 75), 150, 14 * (f / 1.5), 14 * (f / 1.5));
ellipse(450 - (f * 75), 150, 12 * (f / 1.5), 12 * (f / 1.5));
ellipse(450 - (f * 75), 150, 10 * (f / 1.5), 10 * (f / 1.5));
ellipse(450 - (f * 75), 150, 8 * (f / 1.5), 8 * (f / 1.5));
ellipse(450 - (f * 75), 150, 6 * (f / 1.5), 6 * (f / 1.5));
ellipse(450 - (f * 75), 150, 4 * (f / 1.5), 4 * (f / 1.5));
ellipse(450 - (f * 75), 150, 2 * (f / 1.5), 2 * (f / 1.5));
stroke(0);
noFill();
}
strokeWeight(0.5);
}
This project was a super fun one because it was easier for me to take control of the direction of my lines/curves. The only thing I had a little trouble with was the ‘lerp’ command. I had to test around with the x and y values so that I was able to get a sense of what I had to tweak to get a specific string pattern.