JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="myCanvas" width="640" height="480"></canvas>

CSS

body {
        margin: 0px;
        padding: 0px;
      }

JavaScript

var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var imageObj = new Image();

window.requestAnimFrame = (function(){
  return  window.requestAnimationFrame       ||
          window.webkitRequestAnimationFrame ||
          window.mozRequestAnimationFrame    ||
          function( callback ){
            window.setTimeout(callback, 1000 / 60);
          };
})();

draw = function(frame) {
  // draw cropped image
    var col = frame % 60;
    var row = Math.floor(frame / 60);
    
    var sourceWidth = 21;
    var sourceHeight = 11;
    var sourceX = 18 + (sourceWidth * col);
    var sourceY = 18 + (sourceHeight * row);
    var destWidth = canvas.width;
    var destHeight = canvas.height;
    var destX = 0;
    var destY = 0;

    context.drawImage(imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight);
};

imageObj.onload = function(frame) {
    draw(280);
};

var frame = 0;
var stall = 0;
var current = stall;

(function animloop(){
    requestAnimFrame(animloop);
    //draw(0);
    draw(frame);
    if (current <= 0) {
         frame = frame + 1;
        current = stall;
    }
    current--;
})();

imageObj.src = 'http://i.imgur.com/6aIziOH.jpg';