JSFiddle - React, Tailwind, and code Playground

by Dogbert

HTML

<canvas></canvas>

CSS

body {
  background: steelblue;
}

canvas {
  border: 1px dashed black;
}

JavaScript

var canvas = document.querySelector('canvas');
canvas.width = 300;
canvas.height = 300;
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'white';
ctx.translate(150, 150);
ctx.rotate(d2r(45));
ctx.fillRect(0, 0, 100, 1);
ctx.font = '24px Georgia';
ctx.fillText('Hello World', 0, 0);

function d2r(d) {
  return d * Math.PI / 180;
}