xxxxxxxxxx
39
let bacon;
function preload(){
kitn = loadImage("cat.jpg");
}
function setup() {
createCanvas(800, 600);
bacon = new Cat(30, 50, kitn);
}
function draw() {
background(220);
bacon.drawCat();
translate(60, 60)
// bacon.changeHue();
bacon.drawCat();
}
//how to write a class!
class Cat {
constructor(x, y, pic) {
//'this' assigns value to a particular object
//in parameters
this.x = x;
this.y = y;
this.pic = pic;
}
drawCat() {
image(this.pic, this.x, this.y)
}
moveCat() {
}
}