MCPcopy Create free account
hub / github.com/bwasti/mebm / render

Method render

script.js:545–574  ·  view source on GitHub ↗
(ctx_out, ref_time)

Source from the content-addressed store, hash-verified

543 }
544
545 render(ctx_out, ref_time) {
546 let f = this.getFrame(ref_time);
547 if (f) {
548
549 let scale = f[2];
550 this.ctx.font = Math.floor(scale * 30) + "px Georgia";
551 let lines = this.name.split('\n');
552 let rect = this.ctx.measureText(this.name);
553 this.width = rect.width;
554 this.height = rect.actualBoundingBoxAscent + rect.actualBoundingBoxDescent;
555 let x = f[0] + this.canvas.width / 2;
556 let y = f[1] + this.canvas.height / 2;
557 if (this.shadow) {
558 this.ctx.shadowColor = "black";
559 this.ctx.shadowBlur = 7;
560 } else {
561 this.ctx.shadowColor = null;
562 this.ctx.shadowBlur = null;
563 }
564 this.ctx.fillStyle = this.color;
565 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
566 this.ctx.save();
567 this.ctx.translate(x, y);
568 this.ctx.rotate(f[3] * (Math.PI / 180));
569 this.ctx.textAlign = "center";
570 this.ctx.fillText(this.name, 0, 0);
571 this.ctx.restore();
572 this.drawScaled(this.ctx, ctx_out);
573 }
574 }
575}
576
577class VideoLayer extends RenderedLayer {

Callers

nothing calls this directly

Calls 3

getFrameMethod · 0.80
splitMethod · 0.80
drawScaledMethod · 0.80

Tested by

no test coverage detected