Example #1
0
 draw_background(bgcolor, stroke) {
   context.fillStyle = bgcolor;
   context.strokeStyle = stroke;
   context.rect(this.x, this.y, this.w, this.h);
   context.fill();
   context.stroke();
 }
Example #2
0
 draw_text(fgcolor) {
   context.fillStyle = fgcolor;
   context.textAlign = "center";
   context.textBaseline = "middle";
   context.font = "30px sans-serif";
   context.fillText(this.text, this.x + this.w / 2, this.y + this.h / 2);
 }