Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| ingram-chung-generative [2021/06/20 23:33] – created renick | ingram-chung-generative [2021/06/29 01:32] (current) – renick | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Ingram Chung' | ====== Ingram Chung' | ||
| + | by [[ingram-chung|Ingram]] | ||
| + | < | ||
| + | <iframe src=" | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== about my crazyDog.js ===== | ||
| + | |||
| + | ===JUST CRAZY=== | ||
| + | |||
| + | The animation code is released under the [[https:// | ||
| + | |||
| + | ===== the code for my crazyDog.js ===== | ||
| + | < | ||
| + | function setup() { | ||
| + | createCanvas(1800, | ||
| + | } | ||
| + | |||
| + | class BackgroundPattern { | ||
| + | | ||
| + | { this.x = xpostion; | ||
| + | this.y = ypostion; | ||
| + | } | ||
| + | draw () { | ||
| + | fill(color(random(0, | ||
| + | rect(this.x, | ||
| + | fill(color(random(0, | ||
| + | rect(this.x + 10, this.y, 10, 10) | ||
| + | } | ||
| + | } | ||
| + | |||
| + | class Dog { | ||
| + | | ||
| + | { this.x = xpostion; | ||
| + | this.y = ypostion; | ||
| + | } | ||
| + | draw () { | ||
| + | fill(color(random(0, | ||
| + | circle(this.x+60, | ||
| + | circle(this.x+340, | ||
| + | circle(this.x+60, | ||
| + | circle(this.x+340, | ||
| + | circle(this.x+200, | ||
| + | circle(this.x+170, | ||
| + | circle(this.x+230, | ||
| + | circle(this.x+200, | ||
| + | circle(this.x+170, | ||
| + | circle(this.x+230, | ||
| + | line(this.x+200, | ||
| + | line(this.x+230, | ||
| + | line(this.x+170, | ||
| + | fill(255, | ||
| + | circle(this.positionx+50, | ||
| + | circle(this.positionx+80, | ||
| + | circle(this.positionx+100, | ||
| + | circle(this.positionx+110, | ||
| + | circle(this.positionx+120, | ||
| + | circle(this.positionx+110, | ||
| + | circle(this.positionx+100, | ||
| + | circle(this.positionx+80, | ||
| + | stroke(0, | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function backgroundPatternArray (n, y){ | ||
| + | let outputArray = []; | ||
| + | for (let i = 0; i < n ; i++) { | ||
| + | outputArray.push(new BackgroundPattern (10 + (i * 30),10 + y)) | ||
| + | } | ||
| + | return outputArray | ||
| + | } | ||
| + | |||
| + | function dogArray (n){ | ||
| + | let outputArray = []; | ||
| + | for (let i = 0; i < n ; i++) { | ||
| + | outputArray.push(new Dog (Math.random()*800, | ||
| + | } | ||
| + | return outputArray | ||
| + | } | ||
| + | |||
| + | let myDogArray = dogArray(100); | ||
| + | console.log(myDogArray); | ||
| + | |||
| + | function draw() { | ||
| + | // | ||
| + | for(let i = 0; i < 100 ; i++){ | ||
| + | let myBackgroundPatternArray = backgroundPatternArray(300, | ||
| + | for(let i = 0; i < myDogArray.length ; i++){ | ||
| + | myBackgroundPatternArray[i].draw() | ||
| + | } | ||
| + | } | ||
| + | //let dog2 = new Dog (100, 100); | ||
| + | // | ||
| + | for(let i = 0; i < myDogArray.length ; i++){ | ||
| + | myDogArray[i].draw() | ||
| + | } | ||
| + | } | ||
| + | </ | ||