text: var _ = require("underscore")
  var AnimateToNum = function(_option) {
    this.config = {
      animTime:1000, //动画时间
      initNum:0,
      nowNum:0,
      callback:function(){
  
      }
    };
    _.extend(this.config,_option);
    this.config.nowNum = this.config.initNum;
    this.config.callback(this.config.nowNum);
    this.timer = null;
  }
  
  AnimateToNum.prototype = {
    /**
     * 滚动到某个数字，绑定callback，即可定时调用
     * @param num
     * @param callback
     */
    toNum:function(num){
      var isUp = num - this.config.nowNum > 0?true:false;
      var intervalTime = this.config.animTime / Math.abs(num - this.config.nowNum);
      var self = this;
      clearInterval(this.timer);
      this.timer = setInterval(function(){
        if(isUp){
          self.config.nowNum ++;
          if(self.config.nowNum >= num){
            clearInterval(self.timer);
          }
        }else{
          self.config.nowNum --;
          if(self.config.nowNum <= num){
            clearInterval(self.timer);
          }
        }
        self.config.callback(self.config.nowNum);
      },intervalTime);
    }
  }
  
  module.exports = AnimateToNum;
  