sketch
// Liu Xiangqi xiangqil@andrew.cmu.edu Section-A Project-04
var strokeR = 204;
var strokeG = 230;
var strokeB = 255;
function setup(){
createCanvas(640, 480);
}
function draw() {
background(0);
//draw the outer ring
var x1 = 320;
var y1 = 0;
var x2 = 320-120*sqrt(3);
var y2 = 360;
var x3 = 320+120*sqrt(3);
var y3 = 360;
stroke(255);
noFill();
triangle(x1, y1, x2, y2, x3, y3);
push();
translate(width/2, height/2);
for (var i= 0; i < 60; i ++) {
strokeR = 204;
strokeG = map(i, 0, 30, 230, 153);
strokeB = 255;
stroke(strokeR, strokeG, strokeB);
rotate(radians(2));
triangle(x1-width/2, y1-height/2, x2-width/2, y2-height/2, x3-width/2, y3-height/2);
}
pop();
//draw the inner ring
var x4 = 320;
var y4 = 360;
var x5 = 320 - 60*sqrt(3);
var y5 = 180;
var x6 = 320 + 60*sqrt(3);
var y6 = 180;
stroke(255);
noFill();
triangle(x4, y4, x5, y5, x6, y6);
push();
translate(width/2, height/2);
for (var i= 0; i < 40; i ++) {
strokeR = map(i, 0, 30, 204, 255);
strokeG = map(i, 0, 30, 153, 204);
strokeB = map(i, 0, 30, 255, 204);
stroke(strokeR, strokeG, strokeB);
rotate(radians(3));
triangle(x4-width/2, y4-height/2, x5-width/2, y5-height/2, x6-width/2, y6-height/2);
}
pop();
//draw the innermost ring
var x7 = 320;
var y7 = 180;
var x8 = 320 - 30*sqrt(3);
var y8 = 270;
var x9 = 320 + 30*sqrt(3);
var y9 = 270;
stroke(255);
noFill();
triangle(x7, y7, x8, y8, x9, y9);
push();
translate(width/2, height/2);
for (var i= 0; i < 30; i ++) {
strokeR = 255
strokeG = map(i, 0, 30, 255, 204);
strokeB = map(i, 0, 30, 255, 204);
stroke(strokeR, strokeG, strokeB);
rotate(radians(4));
triangle(x7-width/2, y7-height/2, x8-width/2, y8-height/2, x9-width/2, y9-height/2);
}
pop();
}