检查两个变量之间的时间

时间:2014-10-21 19:02:48

标签: javascript

我正在使用一个函数,比如animateDiv(),我在一个区间内指定了一个动画:

setInterval(function(){
   stopDiv();//first stop animation
   if(something == anotherthing){
      doSomething();// it's just about to finish the animation
   }
//now using animate
animateDiv();//finish animation from first to last position smoothly
},0);

如果我不使用if条件并直接使用doSomething()方法,它不会妨碍动画,即平滑地运行动画。

猜测我的眼睛,在stopDiv()和animateDiv()之间有100ms的间隙,因为检查了某些东西== anotherthing甚至在此检查后返回false。

那么,我应该如何管理我的代码呢?输出两个变量之间的检查结果需要几点时间?

0 个答案:

没有答案