You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
791 B
39 lines
791 B
class Ball extends Decoration{
|
|
|
|
graphics: p5.Graphics
|
|
|
|
constructor(properties: object){
|
|
super(properties);
|
|
this.createGraphics();
|
|
}
|
|
|
|
createGraphics(){
|
|
let img = images['ball'];
|
|
this.graphics = p.createGraphics(img.width, img.height);
|
|
this.updateColor();
|
|
}
|
|
|
|
updateColor(){
|
|
let img = images['ball'];
|
|
this.graphics.clear();
|
|
this.graphics.tint(this.colors[0]);
|
|
this.graphics.image(img, 0, 0);
|
|
}
|
|
|
|
|
|
display(pos?: p5.Vector, dim?: p5.Vector){
|
|
super.display(pos, dim);
|
|
|
|
p.image(this.graphics, 0, 0, this.radius * 2, this.radius * 2);
|
|
if (this.mouseIsOver){
|
|
this.brightness(70);
|
|
}
|
|
|
|
p.pop();
|
|
}
|
|
|
|
update(){
|
|
super.update();
|
|
}
|
|
|
|
} |