====== Brandon Chen's crazyDog.js ====== This is my crazyDog.js. I've been working on it all semester. The hardest thing was... I'm proud of it because... The code for my artwork is below. It's licensed as Creative Commons XXXXX. let red=0; let green=0; let blue=0; let sun=144 let dogeColor=0 function setup() { createCanvas(600, 536); dogeColor = random(255) } class Dog { constructor (x ,y) { this.positionx = x this.positiony = y } draw () { fill(dogeColor) rect(this.positionx+65,480, 20, 55, 20); rect(this.positionx+70,480, 20, 55, 20); rect(this.positionx+165,480, 20, 55, 20); rect(this.positionx+160,480, 20, 55, 20); rect(this.positionx+65, this.positiony+215, 120, 60); //ears rect(this.positionx+55, 395, 30, 30, 10); rect(this.positionx+25,395,30,30,10) //Head circle(this.positionx+55, this.positiony+205, 60) {let numberarray = [0, 15, 10, 5] let r = random(numberarray) //Eyes fill(0,0,0) circle(this.positionx+40,415,10) circle(this.positionx+70,415,10) } //mouth { fill('red') arc(this.positionx+55, 425, 30, 30, 0, PI, PIE,10) } //teeths fill("white") triangle(this.positionx+60,435,this.positionx+55,426,this.positionx+65,426); triangle(this.positionx+50,435,this.positionx+45,426,this.positionx+55,426); if (mouseIsPressed) { dogeColor = color(random (255), random(255), random(255)); } } } class backgroundPattern { constructor (x,y) { this.xposition = x this.yposition = y } draw () { //sun //outer noStroke(); fill(255, 165, 0, 50); if(sun>105){ circle(150, sun--, 200); } else if(sun==105){ circle(150, sun, 200); } //inner noStroke(); fill(255, 100, 0, 100); if(sun>105){ circle(150, sun--, 150); } else if(sun==105){ circle(150, sun, 150); } //clouds fill(dogeColor) circle(this.xposition+50,250,60) circle(this.xpositionx+80,240,60) circle(this.xposition+100,230,60) circle(this.xposition+110,270,60) circle(this.xposition+120,270,60) circle(this.xposition+110,280,60) circle(this.xposition+100,250,60) circle(this.xposition+80,290,60) stroke(0,0,0) //hat fill('black') ellipse (this.xposition + 55, 390, 70, 40) rect (this.xposition + 35, 330,40,50,10) //tie fill(0,0,0) rect(this.xposition+100,428,20,50) triangle(this.xposition+100,477,this.xposition+120,477,this.xposition+110,485) textSize(32); //Click Me fill('cyan'); text('Click on a Dog or Cloud', 250, 180); } } function draw() { background(red+=5, green++, blue); for(let i = 0; i<100 ; i++) { let dog1 = new Dog (i*150, 213+(i*0)) dogarr = [ dog1 ] for (let i = 0; i < dogarr.length; i++) { dogarr[i].draw() } } for(let i =0;i<100;i++) { let background1 = new backgroundPattern (i*150,213+(i*0)) backgroundPatternarr = [ background1 ] for(let i = 0; i< backgroundPatternarr.length; i++) {backgroundPatternarr[i].draw()} } }