sketch//Alexia Forsyth
//aforsyth
//Section A
var dx1;
var dy1;
var dx2;
var dy2;
var angle = 3;
var numLines = 350;
function setup() {
createCanvas(400, 300);
background(255,240,105);
dx1 = (25)/numLines;
dy1 = (135)/numLines;
dx2 = (25)/numLines;
dy2 = (-135)/numLines;
}
function draw() {
push();//saves original origin
translate(100,100); //translate by 100 for the sun center
var x1 = -(width);
var y1 = height/2;
var x2 = 0;
var y2 = height/2;
//dark red bottom layer of lines
for (var i = 0; i <= numLines; i += 1) {
stroke(215,100,20);
rotate(radians(angle));
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
//revert to original coordinates
var x1 = -(width);
var y1 = height/2;
var x2 = 0;
var y2 = height/2;
numLines -= 20;//reduce number of lines by 20
angle +=5; //rotate by 5
//3rd dark orange layer
for (var i = 0; i <= numLines; i += 1) {
stroke(205,95,0);
line(x1, y1, x2, y2);
rotate(radians(angle));
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
//revert to original coordinates
var x1 = -(width);
var y1 = height/2;
var x2 = 0;
var y2 = height/2;
numLines -= 20;//reduce number of lines by 20
angle +=5; //rotate by 5
//second bright orange layer
for (var i = 0; i <= numLines; i += 1) {
stroke(204,153,0);
line(x1, y1, x2, y2);
rotate(radians(angle));
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
//revert to original coordinates
var x1 = -(width);
var y1 = height/2;
var x2 = 0;
var y2 = height/2;
angle +=5; //angle by 5
numLines -= 20; //subtract number of lines by 20
//outer yellow lines
for (var i = 0; i <= numLines; i += 1) {
stroke(250,236,30);
line(x1, y1, x2, y2);
rotate(radians(angle));
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
pop(); //revert to original origin
fill(204,153,0);
noStroke();
ellipse(113,95,150,150); //sun
noLoop();
}