轨迹

trajectory


/**
     * 轨迹动画
     * @param timestamp
     * @param elapsed
     */
    animateLine(timestamp, elapsed) {
      if (elapsed > 1000 / 25) {
        if (this.trackPointList.features.length){
          let {geometry: {coordinates}, properties} = this.trackPointList.features[this.pointIndex]
          pointSource.features[0].geometry.coordinates = coordinates;
          this.mapMain.getSource('point').setData(pointSource);
          this.pointIndex =  this.pointIndex  + this.spend.value
          elapsed = 0
          if (this.pointIndex >= this.trackPointList.features.length){
            this.percent = Math.round(((this.sourceIndex + 1) / this.trackData.length) * 100);
            this.generatedNextTrajectoryData()
          }
        }else {
          this.percent = Math.round(((this.sourceIndex + 1) / this.trackData.length) * 100);
          this.generatedNextTrajectoryData()
        }
      }
      if (this.pointIndex <= this.trackPointList.features.length && this.sourceIndex <= this.trackData.length) {
        animation =  requestAnimationFrame(_timestamp => this.animateLine(_timestamp, elapsed + _timestamp - timestamp) )
      }
      if (this.sourceIndex + 1 > this.trackData.length){
        this.resetAnimation()
      }
    },
上次更新:
贡献者: QiaoJiazhou