code: function Animation(duration, timingFunction, frames) {
      var defer;
  
      var frameQueue = getFrameQueue(duration, frames);
      var framePercent = 1 / (duration / INTERVAL);
      var frameIndex = 0;
  
      var bezier = getBezier(timingFunction);
  
      if (!bezier) {
          throw new Error('unexcept timing function');
      }
  
      var currentFrame;
  
      var isPlaying = false;
      /**
       * 播放动画
       * @method play
       * @return {lib.animation~Animation} this 当前实例
       * @instance
       * @memberOf lib.animation~Animation
       */
      this.play = function() {
          if (isPlaying) return;
          isPlaying = true;
  
          if (!defer) {
              defer = PromiseDefer();
              PromiseMixin(defer.promise, this);
          }
  
          function request() {
              var percent = framePercent * (frameIndex + 1).toFixed(10);
              var currentFrame = frameQueue[frameIndex];
  
              currentFrame
                  .request(percent.toFixed(10), timingFunction(percent).toFixed(10))
                  .then(function() {
                      if (!isPlaying) return;
  
                      if (frameIndex === frameQueue.length - 1) {
                          isPlaying = false;
                          defer && defer.resolve('FINISH');
                          defer = null;
                      } else {
                          frameIndex++;
                          request();
                      }
                  }, function() {
                      // CANCEL
                  });
          }
  
          request();
          return this;
      }
  
      /**
       * 暂停动画
       * @method stop
       * @return {lib.animation~Animation} this 当前实例
       * @instance 
       * @memberOf lib.animation~Animation
       */
      this.stop = function() {
          if (!isPlaying) return;
          isPlaying = false;
  
          if (frameQueue[frameIndex]) {
              frameQueue[frameIndex].cancel();
          }
  
          return this;
      }
  }
docs: 构造一个动画对象
  @class lib.animation~Animation
  @param {Number} duration       动画时间，单位毫秒
  @param {String|Array|Function} timingFunction 时间函数，支持标准的时间函数名、贝塞尔曲线数组（需要lib.cubicbezier库支持）以及自定义函数
  @param {Function} frames       每一帧执行的函数