daniel-ho-generative

This is an old revision of the document!


Daniel's crazyDog.js

DISCRIPTION

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.


**function setup() {
  createCanvas(1000,1000);
}

class background{
  constructor(x,y){
    this.posix = x
    this.posiy = y
  }
  draw(){
    fill(color(random(0,255),random(0,255),random(0,255)))
    ellipse(this.posix,this.posiy,10)
    rect(this.posix-3,this.posiy-3,5)
  }
}

function backgroundpatterns(x,y){
  for(let i = 0; i<100;i++){
    fill(color(random(0,255),random(0,255),random(0,255)))
ellipse(x,y,10)
rect(x-3,y-3,5)
    x = x + 10
  }
}

function backgroundpatterns2(x,y){
  for(let i = 0;i<100;i++){
    fill(color(random(0,255),random(0,255),random(0,255)))
    backgroundpatterns(x,y)
    y = y+10
  }
}

class dog {
  constructor(x1,y1,num){
    this.positionx = x1
    this.fat1 = num
    this.positiony = y1
  }
draw(){
  fill(color(random(0,255),random(0,255),random(0,255)))
  ellipse(65+this.positionx,90+this.positiony,50+this.fat1,50+this.fat1);
  square(75+this.positionx,34+this.positiony,10+this.fat1);
  square(35+this.positionx,34+this.positiony,10+this.fat1);
  square(40+this.positionx,40+this.positiony,40+this.fat1);
  ellipse(75+this.positionx,50+this.positiony,5+this.fat1);
  ellipse(45+this.positionx,50+this.positiony,5+this.fat1);
line(45+this.positionx,60+this.positiony,50+this.positionx,65+this.positiony);
line(50+this.positionx,65+this.positiony,70+this.positionx,65+this.positiony);
line(70+this.positionx,65+this.positiony,75+this.positionx,60+this.positiony);
  ellipse(56+this.positionx,115+this.positiony,10+this.fat1,10+this.fat1);
  ellipse(80+this.positionx,110+this.positiony,10+this.fat1,10+this.fat1);
  triangle(50+this.positionx, 40+this.positiony, 60+this.positionx, 10+this.positiony, 70+this.positionx, 40+this.positiony);}
}

function loopdog(x) {
   let outputarray = [];
  for(let i = 0;i<x;i++){
 outputarray.push(new dog(random(0,500),0,0 + (random(0,10) *i)))
  }
  //console.log(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){
  //let outputarray2 = [];
  //for(let)
//}

function draw() {
  backgroundpatterns2(20,20)
  let dog2 = new dog(0,0,0)
  dog2.draw()
  let background3 = new background(10,10)
  background3.draw()
  let mydog = loopdog(10);
for(let i = 0; i < mydog.length ; i++){
    mydog[i].draw()
  //setTimeout(function(){
    //mydog[i].draw()
//}, 2000);
}

}** 


  • daniel-ho-generative.1624243790.txt.gz
  • Last modified: 2021/06/20 19:49
  • by sharon.chou