<div id="block">click me</div>
#block{
  	position:absolute;
    left: 50%;
    top: 50%;
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    background: #0c8;
    line-height: 100px;
    text-align: center;
    color: #fff;
    cursor: pointer;
}
var deg = 0;
block.addEventListener("click", function(){
  setInterval(function(){
    var i = 0;  
    var t = Date.now();
    while(++i < 200000000); //模拟耗时操作
    console.log(Date.now() - t);
  }, 100);

  var self = this;
  requestAnimationFrame(function change(){
    self.style.transform = "rotate(" + (deg++) +"deg)";
    requestAnimationFrame(change);
  });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.