JSFiddle - React, Tailwind, and code Playground

by Will Stott

HTML

<canvas width="100" height="100"></canvas>
<img src="https://i.imgur.com/aA1ZrWR.gif">

CSS

img {
  width: 100px;
  height: 100px;
}

JavaScript

const canvas = document.getElementsByTagName("canvas")[0];
const img = document.getElementsByTagName("img")[0];
const ctx = canvas.getContext("2d");
window.requestAnimationFrame(() => {
  ctx.drawImage(img, 0, 0, 100, 100);
})