Skip to content

Commit

Permalink
Update demo-canvas-advanced-compositing.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cacheflowe committed Dec 26, 2023
1 parent e5414f8 commit 9934817
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions demo/demo-canvas-advanced-compositing.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class CanvasDrawingDemo extends DemoBase {
// animate
this.frameCount = 0;
this.animate();

// demo helpers
super.injectCSS(`canvas{ max-width: 100%; }`);
super.injectCSS(`.third{ width: 33%; }`);
}

//////////////////////////////////
Expand All @@ -60,19 +64,22 @@ class CanvasDrawingDemo extends DemoBase {

buildCanvasRadarGrid() {
this.canvasGrid = this.createCanvas(this.radarW, this.radarH);
this.canvasGrid.classList.add("third");
this.ctxGrid = this.canvasGrid.getContext("2d");
this.el.appendChild(this.canvasGrid);
}

buildCanvasRadarGradientMatte() {
this.maskTop = 0;
this.canvasGradientMatte = this.createCanvas(this.radarW, this.radarH);
this.canvasGradientMatte.classList.add("third");
this.ctxGradientMatte = this.canvasGradientMatte.getContext("2d");
this.el.appendChild(this.canvasGradientMatte);
}

buildCanvasRadarMaskedGrid() {
this.canvasMaskedGrid = this.createCanvas(this.radarW, this.radarH);
this.canvasMaskedGrid.classList.add("third");
this.ctxMaskedGrid = this.canvasMaskedGrid.getContext("2d");
this.el.appendChild(this.canvasMaskedGrid);
}
Expand Down Expand Up @@ -172,6 +179,7 @@ class CanvasDrawingDemo extends DemoBase {
lineW -= curveSubtract;
x += curveSubtract;
}
// finally draw the line
this.ctx.strokeStyle = "#ffffff";
this.ctx.lineWidth = 3;
this.ctx.beginPath();
Expand Down

0 comments on commit 9934817

Please sign in to comment.