//Ankitha Vasudev
//ankithav@andrew.cmu.edu
//Section B
//Project 04
var r = 210;
var g = 220;
var b = 255;
var angle = 0;
var cx = 0;
function setup() {
createCanvas(400, 300);
background(0);
angleMode(degrees);
}
//spiral eye
function draw() {
angle = angle+5;
cx = cx+20;
fill(0);
push();
translate(width/2,height/2-10);
rotate(radians(angle));
strokeWeight(0.5);
stroke(r-200, g-150, b);
line(cx, 0, 10, 10);
pop();
//loop
for (var x = 0; x < width; x += 10) {
//bottom right curves
strokeWeight(0.75);
stroke(r+40, g+20, b);
line(x, height-30, width-30, height-x);
stroke(r-50, g-60, b);
line(x, height, width, height-x);
//top left curves
stroke(r+40, g+30, b);
line(x, 20, 40, height - x);
stroke(r-70, g-80, b);
line(x, 0, 0, height - x);
//top right curves
stroke(r-20, g-10, b);
line(width/2 + x, 0, width, x);
stroke(r+40, g+20, b);
line(width/2 + x, 0, width, x+50);
//bottom left curves
stroke(r-40, g-20, b);
line(0, x+80, x, height);
stroke(r+40, g+20, b);
line(10, x, x, height);
}
}
For this project, I played around with looping and changing coordinates to obtain different patterns. I also wanted to create a dynamic element, which led to the idea of creating an abstract eye.