Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| daniel-ho-generative [2021/06/22 00:21] – renick | daniel-ho-generative [2021/06/29 01:30] (current) – renick | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Daniel Ho's crazyDog.js ====== | ====== Daniel Ho's crazyDog.js ====== | ||
| + | |||
| + | [[daniel-ho|by Daniel]] | ||
| < | < | ||
| - | <iframe src=" | + | <iframe src=" |
| </ | </ | ||
| ===== about my crazyDog.js ===== | ===== about my crazyDog.js ===== | ||
| - | This is my crazyDog.js. I've been working on it all semester. | + | This is my crazyDog.js. I've been working on it all semester. |
| + | |||
| + | The animation code is released under the [[https:// | ||
| ===== the code for my crazyDog.js ===== | ===== the code for my crazyDog.js ===== | ||
| Line 13: | Line 17: | ||
| < | < | ||
| - | **function setup() { | + | function setup() { |
| createCanvas(1800, | createCanvas(1800, | ||
| + | background(0) | ||
| } | } | ||
| - | + | ||
| - | class background{ | + | |
| - | constructor(x, | + | |
| - | this.posix = x | + | function backgroundpatterns(x, |
| - | this.posiy = y | + | for(let i = 0; i<174;i++){ |
| - | } | + | fill(bgColor) |
| - | draw(){ | + | |
| - | fill(color(random(0, | + | |
| - | ellipse(this.posix, | + | |
| - | rect(this.posix-3, | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | function backgroundpatterns(x, | + | |
| - | for(let i = 0; i<100;i++){ | + | |
| - | fill(color(random(0, | + | |
| ellipse(x, | ellipse(x, | ||
| rect(x-3, | rect(x-3, | ||
| Line 37: | Line 32: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| - | function backgroundpatterns2(x, | + | function backgroundpatterns2(x, |
| - | for(let i = 0;i<100;i++){ | + | for(let i = 0;i<60;i++){ |
| - | fill(color(random(0, | + | fill(bgColor) |
| - | backgroundpatterns(x, | + | backgroundpatterns(x, |
| y = y+10 | y = y+10 | ||
| } | } | ||
| } | } | ||
| + | |||
| class dog { | class dog { | ||
| constructor(x1, | constructor(x1, | ||
| Line 67: | Line 62: | ||
| triangle(50+this.positionx, | triangle(50+this.positionx, | ||
| } | } | ||
| + | |||
| function loopdog(x) { | function loopdog(x) { | ||
| let outputarray = []; | let outputarray = []; | ||
| for(let i = 0; | for(let i = 0; | ||
| - | | + | |
| } | } | ||
| // | // | ||
| return outputarray | return outputarray | ||
| } | } | ||
| - | |||
| - | |||
| - | //A | ||
| - | function A (){ | ||
| - | } | ||
| - | |||
| - | //B | ||
| - | function B(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //C | ||
| - | function C(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //D | ||
| - | function D(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //E | ||
| - | function E(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //F | ||
| - | function F(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //G | ||
| - | function G(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | |||
| - | //H | ||
| - | function H(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //I | ||
| - | function I(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //J | ||
| - | function J(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //K | ||
| - | function K(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //L | ||
| - | function L(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //M | ||
| - | function M(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //N | ||
| - | function N(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | //O | ||
| - | function O(){ | ||
| - | |||
| - | } | ||
| - | |||
| - | // | ||
| - | function P(){ | ||
| - | |||
| - | } | ||
| //function loopbackground(y){ | //function loopbackground(y){ | ||
| //let outputarray2 = []; | //let outputarray2 = []; | ||
| //for(let) | //for(let) | ||
| //} | //} | ||
| + | |||
| + | let redraw = 0; | ||
| + | |||
| + | function drawBackground (){ | ||
| + | if (redraw == 0) { | ||
| + | backgroundpatterns2(20, | ||
| + | redraw = 1 | ||
| + | } | ||
| + | } | ||
| + | |||
| function draw() { | function draw() { | ||
| - | | + | |
| - | let dog2 = new dog(0, | + | |
| - | dog2.draw() | + | |
| - | let background3 = new background(10, | + | |
| - | background3.draw() | + | |
| let mydog = loopdog(10); | let mydog = loopdog(10); | ||
| for(let i = 0; i < mydog.length ; i++){ | for(let i = 0; i < mydog.length ; i++){ | ||
| | | ||
| - | // | ||
| - | // | ||
| - | //}, 2000); | ||
| } | } | ||
| - | + | ||
| - | }** | + | } |
| </ | </ | ||
| + | By: [[: | ||