JSFiddle - React, Tailwind, and code Playground

by viksra

HTML

<canvas id="strobe"></canvas>

CSS

#strobe {
				height: 42px;
				width: 42px;
				/* background: url("http://www.manyjets.com/images/strobe-linear-dodge.png"); */
			}

JavaScript

window.onload = function() {
var canvas=document.getElementById("strobe"); // grabs the canvas element
var context=canvas.getContext("2d"); // returns the 2d context object
var img=new Image() //creates a variable for a new image
 
img.src= "http://www.manyjets.com/images/strobe-linear-dodge.png" // specifies the location of the image
context.drawImage(img,0,0); // draws the image at the specified x and y location
}