JSFiddle - React, Tailwind, and code Playground
by ajmeese7
JavaScript
var b = document.createElement('canvas');
b.width = 320;
b.height = 160;
ctx = b.getContext("2d");
function draw(txt) {
let angle = -45;
ctx.rotate(angle * Math.PI / 180);
ctx.font = "20px Arial";
var txtHeight = 35;
var offset = 5;
var w = Math.ceil(ctx.measureText(txt).width)
var txt = new Array(w * 2).join(txt + ' ');
for (var i = 0; i < Math.ceil(b.height / txtHeight); i++) {
ctx.fillText(txt, -(i * offset), i * txtHeight);
}
}
document.body.appendChild(b);
draw('Kara Meese');