PolylineVolumeAnimationGeometry

new Cesium.PolylineVolumeAnimationGeometry(options)

带顶点动画的圆管体积线几何体

1. 此几何体是继承于PolylineVolumeGeometry圆管几何体。
2. 顶点动画运动方式是沿着圆管的绘制方向运动。
Name Type Description
options Object Object with the following properties:
Name Type Default Description
polylinePositions Array.<Cartesian3> An array of Cartesian3 positions that define the center of the polyline volume.
shapePositions Array.<Cartesian2> An array of Cartesian2 positions that define the shape to be extruded along the polyline
ellipsoid Ellipsoid Ellipsoid.WGS84 optional The ellipsoid to be used as a reference.
granularity Number CesiumMath.RADIANS_PER_DEGREE optional The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
vertexFormat VertexFormat VertexFormat.DEFAULT optional The vertex attributes to be computed.
cornerType CornerType CornerType.ROUNDED optional Determines the style of the corners.
animationDuration Number 3 optional 动画的持续时间。
animationRate Number 1 optional 动画的播放速率。
Example:
// 1. 创建带顶点动画的圆管
function computeCircle(radius) {
  var positions = [];
  for (var i = 0; i < 360; i++) {
    var radians = Cesium.Math.toRadians(i);
    positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
  }
  return positions;
}

var volume = new Cesium.PolylineVolumeAnimationGeometry({
  animationDuration: 3, // 动画持续时间
  vertexFormat : Cesium.VertexFormat.POSITION_ONLY,
  polylinePositions : Cesium.Cartesian3.fromDegreesArray([
    -72.0, 40.0,
    -70.0, 35.0
  ]),
  shapePositions : computeCircle(100000.0)
});

// 2. 顶点动画
// 2.1 从头开始播放
volume.playAnimation();
// 2.2 从1秒处开始播放
volume.playAnimation(1);
// 2.3 停止动画
volume.stopAnimation();
// 2.4 监听动画更新事件
volume.animationUpdateEvent.addEventListener((position, time)=>{
     console.log('动画当前播放的时间:', time);
     console.log('当前的位置:', position);
})
// 2.5 监听动画结束事件
volume.animationStopEvent.addEventListener((position, time)=>{
     console.log('动画当前播放的时间:', time);
     console.log('当前的位置:', position);
})
// 2.6 设置动画播放进度
volume.animationProgress = 0.5;

Extends

Members

readonly animationCurrentTime : Number

动画的播放时间(单位:秒)
动画时长(单位:秒)
Default Value: 3
动画的播放进度
动画的播放速率
动画停止回调
动画更新回调

readonly isAnimationStop : Boolean

动画是否停止

packedLength : Number

The number of elements used to pack the object into an array.
Inherited From:

Methods

继续或重播顶点动画
获取动画播放过程中的顶点数据,动画未播放或动画播放结束后获取的是动画结束的顶点数据
Returns:
暂停播放顶点动画
播放顶点动画
Name Type Description
time Number 动画播放的开始时间点,当播放时间大于持续时间时,顶点动画会直接结束。
停止顶点动画,顶点动画跳到播放完毕的状态