JSFiddle - React, Tailwind, and code Playground

by gfosco

HTML

<canvas id="test">
<p>Your browser doesn't support canvas, therefore it sucks.</p>
</canvas>

CSS

#test {
position:absolute;
  top:0px;
  left:0px;
  width:480px;
  height:320px;
  border:1px solid black;
}

JavaScript

var canvas = document.getElementById('test').getContext('2d');
var FPS = 30;

setInterval(function() {
 //update();
 draw();
}, 1000/FPS);
    

function draw() {

}

var textX = 0;
var textY = 10;

function update() {
  textX += 1;
  textY += 1;
}

function draw() {
  canvas.fillStyle = "#000";
  canvas.fillText("Sup Bro!", textX, textY);
}