font fix, blur, coloring controls
This commit is contained in:
parent
8511d8d2ec
commit
34c3030e13
5 changed files with 26 additions and 3 deletions
|
@ -3,7 +3,10 @@ import UI from "./ui.js";
|
|||
class Canvas extends UI {
|
||||
constructor(width, height) {
|
||||
super(document.createElement("canvas"), width, height);
|
||||
|
||||
this._blurStrength = 0;
|
||||
this._ctx = this.element.getContext("2d");
|
||||
this._ctx.filter = "blur(" + this._blurStrength + "px)";
|
||||
}
|
||||
clear() {
|
||||
this.resetStyle();
|
||||
|
@ -14,6 +17,7 @@ class Canvas extends UI {
|
|||
}
|
||||
resetStyle() {
|
||||
this._ctx.fillStyle = "";
|
||||
this._ctx.filter = "blur(" + this._blurStrength + "px)";
|
||||
}
|
||||
draw(shape) {
|
||||
this._ctx.fillStyle = shape.color.rgba();
|
||||
|
@ -26,6 +30,10 @@ class Canvas extends UI {
|
|||
this.element.width = width;
|
||||
this.element.height = height;
|
||||
}
|
||||
setBlurStrength(num) {
|
||||
this._blurStrength = parseInt(num) || 0;
|
||||
this._ctx.filter = "blur(" + this._blurStrength + "px)";
|
||||
}
|
||||
}
|
||||
|
||||
export default Canvas;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue