//Jina Lee
//jinal2@andrew.cmu.edu
//Section E
//Project 07
var numLines = 30;
var angle = 0;
var angleX;
var circleW;
var r;
var g;
var b;
function setup() {
createCanvas(480, 480);
}
function draw() {
background(0);
//r is a random number between 0 - 255
r = random(255);
//g is a random number betwen 0 - 255
g = random(255);
//b is a random number between 0 - 255
b = random(255);
for(var i = 0; i < numLines; i++){
noFill();
push();
//changing the speed of ellipse
angleX = map(mouseX, 0, 400, 0, 90);
//changing the amount of lines drawn
numLines = map(mouseY, 0, 400, 5, 50);
//changing the ellipse width
circleW = map(mouseY, 0, 400, 200, 50);
//color is random
stroke(r, g, b);
strokeWeight(5);
//move it so it is random
translate(width / 2, height / 2);
rotate(radians(angle));
ellipseMode(CENTER);
ellipse(0, 0, circleW, 470);
pop();
angle += angleX;
}
}
For this project, I was really worried on how to start because the shapes seemed so difficult and complex. As I was working, I realized that it was not as bad as I thought. as long as I defined my variables properly and used a for loop to draw the pattern, it worked. I used the map function to control the to control the speed, number of lines, and width of ellipse.