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.
30 lines
733 B
30 lines
733 B
class Loader{
|
|
|
|
constructor(dom){
|
|
this.dim = createVector($(dom).width(), $(dom).height());
|
|
this.c = createGraphics(this.dim.x, this.dim.y);
|
|
this.c.parent(dom);
|
|
this.radius = min(this.dim.x, this.dim.y) * 0.4;
|
|
this.center = createVector(this.dim.x / 2, this.dim.y / 2);
|
|
$(dom).find('canvas').show();
|
|
this.angle = 0;
|
|
}
|
|
|
|
update(){
|
|
this.angle += PI / 10;
|
|
}
|
|
|
|
display(){
|
|
let c = this.c;
|
|
c.clear();
|
|
c.noFill();
|
|
c.stroke(0);
|
|
c.strokeWeight(5);
|
|
c.arc(this.center.x, this.center.y, this.radius * 2, this.radius * 2, this.angle, this.angle + PI + HALF_PI);
|
|
}
|
|
|
|
destroy(){
|
|
this.c.remove();
|
|
}
|
|
|
|
} |