Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| marcus-hsieh-generative [2021/06/20 20:07] – renick | marcus-hsieh-generative [2021/06/29 01:38] (current) – renick | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | =====Marcus' | + | =====Marcus |
| + | by [[: | ||
| < | < | ||
| - | <iframe src=" | + | <iframe src=" |
| </ | </ | ||
| + | |||
| + | ===== about my crazyDog.js ===== | ||
| + | |||
| + | I know more about coding and useing p5.js | ||
| + | |||
| + | The animation code is released under the [[https:// | ||
| + | |||
| + | ===== the code for my crazyDog.js ===== | ||
| + | |||
| < | < | ||
| + | function setup() { | ||
| + | createCanvas(1800, | ||
| + | } | ||
| + | |||
| + | class Face { | ||
| + | constructor (positionX, | ||
| + | { this.positionX= positionX | ||
| + | | ||
| + | } | ||
| + | draw () { | ||
| + | | ||
| + | ellipse(this.positionX+98, | ||
| + | ellipse(this.positionX+55, | ||
| + | ellipse(this.positionX+135, | ||
| + | fill(0, | ||
| + | ellipse(this.positionX+135, | ||
| + | fill(0, | ||
| + | ellipse(this.positionX+100, | ||
| + | fill(0, 189, 35) | ||
| + | ellipse(this.positionX+120, | ||
| + | |||
| + | | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function faceArray (n) { | ||
| + | let outputArray = []; | ||
| + | for (let x = 0; x < n ; x++) { | ||
| + | for (let y = 0; y < n ; y++) { | ||
| + | outputArray.push(new Face ( (x*150), | ||
| + | } | ||
| + | } | ||
| + | return outputArray | ||
| + | } | ||
| + | |||
| + | let myFaces = faceArray(10); | ||
| + | |||
| + | class Face2 { | ||
| + | constructor (positionX, | ||
| + | { this.positionX= positionX | ||
| + | | ||
| + | } | ||
| + | draw (animateX, | ||
| + | stroke(50); | ||
| + | | ||
| + | | ||
| + | ellipse(animateX+this.positionX+55, | ||
| + | ellipse(animateX+this.positionX+135, | ||
| + | fill(0, | ||
| + | ellipse(animateX+this.positionX+135, | ||
| + | fill(0, | ||
| + | ellipse(animateX+this.positionX+100, | ||
| + | fill(0, 189, 35) | ||
| + | ellipse(animateX+this.positionX+120, | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function faceArray2 (n) { | ||
| + | let outputArray = []; | ||
| + | for (let x = 0; x < n ; x++) { | ||
| + | for (let y = 0; y < n ; y++) { | ||
| + | outputArray.push(new Face2 ( (x*180), | ||
| + | } | ||
| + | } | ||
| + | return outputArray | ||
| + | } | ||
| + | |||
| + | let myFaces2 = faceArray2(10); | ||
| + | |||
| + | function draw() { | ||
| + | background(220); | ||
| + | for (let x = 0; x < 12; x += 1) { | ||
| + | for (let y = 0; y < 12; y += 1) { | ||
| + | DrawCloud(x * 150, y * 120); | ||
| + | | ||
| + | } | ||
| + | } | ||
| + | //for(let i = 0; i < myFaces.length ; i++){ | ||
| + | // myFaces[i].draw() | ||
| + | //} | ||
| + | for(let i = 0; i < myFaces.length ; i++){ | ||
| + | myFaces2[i].draw(Math.random() * 2,(-1) * frameCount % height) | ||
| + | } | ||
| + | |||
| + | | ||
| + | } | ||
| + | function DrawCloud(xPosition, | ||
| + | noStroke(); | ||
| + | fill(252, 252, 252); | ||
| + | ellipse(50 + xPosition, 50 + yPosition, 60, 50); | ||
| + | ellipse(80 + xPosition, 40 + yPosition, 60, 50); | ||
| + | ellipse(130 + xPosition, 50 + yPosition, 60, 50); | ||
| + | ellipse(70 + xPosition, 70 + yPosition, 60, 50); | ||
| + | ellipse(110 + xPosition, 65 + yPosition, 60, 50); | ||
| + | } | ||
| </ | </ | ||