Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ben-crazydogjs [2021/06/16 21:14] – renick | ben-crazydogjs [2021/06/20 18:27] (current) – brandon.chen | ||
---|---|---|---|
Line 2: | Line 2: | ||
< | < | ||
- | <iframe src=" | + | <iframe src=" |
</ | </ | ||
Line 14: | Line 14: | ||
let dogeColor=0 | let dogeColor=0 | ||
function setup() { | function setup() { | ||
- | | + | createCanvas(600, |
- | dogeColor = random(255) | + | dogeColor = random(255) |
} | } | ||
Line 21: | Line 21: | ||
class Dog { | class Dog { | ||
- | | + | constructor (x ,y) |
- | { | + | { |
- | this.positionx = x | + | this.positionx = x |
- | this.positiony = y | + | this.positiony = y |
- | } | + | } |
- | draw () | + | draw () |
- | { | + | { |
- | | + | fill(dogeColor) |
- | rect(this.positionx+65, | + | rect(this.positionx+65, |
- | rect(this.positionx+70, | + | rect(this.positionx+70, |
- | rect(this.positionx+165, | + | rect(this.positionx+165, |
- | rect(this.positionx+160, | + | rect(this.positionx+160, |
- | rect(this.positionx+65, | + | rect(this.positionx+65, |
- | //ears | + | //ears |
rect(this.positionx+55, | rect(this.positionx+55, | ||
rect(this.positionx+25, | rect(this.positionx+25, | ||
- | | + | //Head |
- | | + | circle(this.positionx+55, |
{let numberarray = [0, 15, 10, 5] | {let numberarray = [0, 15, 10, 5] | ||
- | | + | let r = random(numberarray) |
- | //Eyes | + | //Eyes |
- | fill(0,0,0) | + | fill(0,0,0) |
circle(this.positionx+40, | circle(this.positionx+40, | ||
circle(this.positionx+70, | circle(this.positionx+70, | ||
- | + | } | |
- | | + | |
- | | + | //mouth |
{ | { | ||
- | | + | fill(' |
- | arc(this.positionx+55, | + | arc(this.positionx+55, |
- | } | + | } |
//teeths | //teeths | ||
fill(" | fill(" | ||
- | | + | triangle(this.positionx+60, |
- | if (mouseIsPressed) { | + | if (mouseIsPressed) { |
dogeColor = color(random (255), random(255), | dogeColor = color(random (255), random(255), | ||
} | } | ||
- | | + | } |
} | } | ||
class backgroundPattern { | class backgroundPattern { | ||
- | | + | constructor (x,y) |
- | { | + | { |
- | this.xposition = x | + | this.xposition = x |
- | this.yposition = y | + | this.yposition = y |
- | } | + | } |
- | draw () | + | draw () |
- | { | + | { |
- | //sun | + | //sun |
- | //outer | + | //outer |
- | noStroke(); | + | noStroke(); |
- | fill(255, 165, 0, 50); | + | fill(255, 165, 0, 50); |
- | if(sun> | + | if(sun> |
- | circle(150, sun--, 200); | + | circle(150, sun--, 200); |
- | } | + | } |
- | else if(sun==105){ | + | else if(sun==105){ |
- | circle(150, sun, 200); | + | circle(150, sun, 200); |
- | } | + | } |
- | //inner | + | //inner |
- | noStroke(); | + | noStroke(); |
- | fill(255, 100, 0, 100); | + | fill(255, 100, 0, 100); |
- | if(sun> | + | if(sun> |
- | circle(150, sun--, 150); | + | circle(150, sun--, 150); |
- | } | + | } |
- | else if(sun==105){ | + | else if(sun==105){ |
- | circle(150, sun, 150); | + | circle(150, sun, 150); |
- | } | + | } |
- | + | //clouds | |
- | | + | fill(dogeColor) |
- | fill(dogeColor) | + | circle(this.xposition+50, |
- | circle(this.xposition+50, | + | circle(this.xpositionx+80, |
- | circle(this.xpositionx+80, | + | circle(this.xposition+100, |
- | circle(this.xposition+100, | + | circle(this.xposition+110, |
- | circle(this.xposition+110, | + | circle(this.xposition+120, |
- | circle(this.xposition+120, | + | circle(this.xposition+110, |
- | circle(this.xposition+110, | + | circle(this.xposition+100, |
- | circle(this.xposition+100, | + | circle(this.xposition+80, |
- | circle(this.xposition+80, | + | stroke(0, |
- | | + | //hat |
- | //hat | + | fill(' |
- | fill(' | + | ellipse (this.xposition + 55, 390, 70, 40) |
- | | + | rect (this.xposition + 35, 330, |
- | rect (this.xposition + 35, 330, | + | //tie |
- | //tie | + | fill(0, |
- | fill(0, | + | rect(this.xposition+100, |
- | rect(this.xposition+100, | + | |
triangle(this.xposition+100, | triangle(this.xposition+100, | ||
- | | + | textSize(32); |
//Click Me | //Click Me | ||
fill(' | fill(' | ||
text(' | text(' | ||
- | | + | } |
| | ||
} | } | ||
function draw() { | function draw() { | ||
- | background(red+=5, | + | background(red+=5, |
- | for(let i = 0; i<100 ; i++) { | + | for(let i = 0; i<100 ; i++) { |
- | let dog1 = new Dog (i*150, 213+(i*0)) | + | let dog1 = new Dog (i*150, 213+(i*0)) |
- | | + | dogarr = [ |
- | dog1 | + | dog1 |
- | ] | + | ] |
- | | + | for (let i = 0; i < dogarr.length; |
- | } | + | } |
- | for(let i =0; | + | for(let i =0; |
- | let background1 = new backgroundPattern (i*150, | + | let background1 = new backgroundPattern (i*150, |
- | backgroundPatternarr = [ | + | backgroundPatternarr = [ |
- | background1 | + | background1 |
- | ] | + | ] |
- | for(let i = 0; i< backgroundPatternarr.length; | + | for(let i = 0; i< backgroundPatternarr.length; |
- | } | + | } |
} | } | ||
</ | </ | ||