xxxxxxxxxx
106
//Assignment 7
let s = 1 //scale
c = 0.06 // change in scale
//color values
let b1 = 255
let c1 = 255
let d1 = 255
let e1 = 255
let f1 = 255
let g1 = 255
let h1 = 255
let b2 = 255
let c2 = 255
let d2 = 255
let e2 = 255
let f2 = 255
let g2 = 255
let h2 = 255
let b3 = 255
let c3 = 255
let d3 = 255
let e3 = 255
let f3 = 255
let g3 = 255
let h3 = 255
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
translate(200,200);
stroke(255);
s = s + c; //change scale
if(s>8){
c = c*-1; //go back
//random colors
b1 = random(100,255);
b2 = random(100,255);
b3 = random(100,255);
c1 = random(100,255);
c2 = random(100,255);
c3 = random(100,255);
d1 = random(100,255);
d2 = random(100,255);
d3 = random(100,255);
e1 = random(100,255);
e2 = random(100,255);
b3 = random(100,255);
f1 = random(100,255);
f2 = random(100,255);
f3 = random(100,255);
g1 = random(100,255);
g2 = random(100,255);
g3 = random(100,255);
h1 = random(100,255);
h2 = random(100,255);
h3 = random(100,255);
} if(s<1){
c = c *-1 // go forward
}
//circles
scale(s);
noFill();
circle(0,0,50);
stroke(b1,b2,b3);
circle(0,0,100);
stroke(c1,c2,c3);
circle(0,0,150);
stroke(d1,d2,d3);
circle(0,0,200);
stroke(e1,e2,e3);
circle(0,0,250);
stroke(f1,f2,f3);
circle(0,0,300);
stroke(g1,g2,g3);
circle(0,0,350);
stroke(h1,h2,h3);
circle(0,0,400);
}
function mousePressed() {
save("animation.png");
}