JSFiddle - React, Tailwind, and code Playground

by Shashank D

HTML

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

JavaScript

var canvas = document.getElementById('canvas'),ctx = canvas.getContext('2d');

var set = false;

if(set) {
	var rotation = 1;
  setInterval( function () {
  	rotation++;
    
		ctx.clearRect(0, 0, 300, 200);
    
    ctx.save();
    
    var rad = rotation * Math.PI / 180;
    ctx.translate(105, 105);
    ctx.rotate(rad);
    
    ctx.textAlign = 'center';
    ctx.textBaseline = 'middle';
    ctx.font = '20px FontAwesome';
    ctx.fillText('\uf020', 0, 0);
    
    ctx.restore();
    
  }, 1);
}