JSFiddle - React, Tailwind, and code Playground

by amindunited

JavaScript

let count = 0;
let startRequestId = null;

const onRepaint = (timestamp) => {
	if (startRequestId) { startRequestId = timestamp; }
	console.log('on repaint', timestamp);
  let progress = timestamp - startRequestId;
  console.log('progeress', (progress / 1000.0));
  if (count < 10) {
  	count ++;
	  window.requestAnimationFrame(onRepaint);  
  }
}
window.requestAnimationFrame(onRepaint);