const line2= new Cesium.Primitive({ geometryInstances: new Cesium.GeometryInstance({ geometry: new Cesium.PolylineGeometry({ // positions: Cesium.Cartesian3.fromDegreesArrayHeights(positionArray), positions: Cesium.Cartesian3.fromDegreesArrayHeights([positions[positions.length-2].lon,positions[positions.length-2].lat,positions[positions.length-2].height, positions[positions.length-1].lon,positions[positions.length-1].lat,positions[positions.length-1].height]), width: 5.0, vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT, arcType: Cesium.ArcType.NONE, }), attributes: { // color: Cesium.ColorGeometryInstanceAttribute.fromColor( // Cesium.Color.BLUE // ), //rgb/255,转换 // color: Cesium.ColorGeometryInstanceAttribute.fromColor( // new Cesium.Color(0, 1, 0.0, 0.2) // ), // color: Cesium.ColorGeometryInstanceAttribute.fromColor( // Cesium.Color.fromCssColorString('#ffff00') // ), //rgba,a也是0到255 // color: Cesium.ColorGeometryInstanceAttribute.fromColor( // Cesium.Color.fromBytes(255, 0, 0, 200) // ), color: Cesium.ColorGeometryInstanceAttribute.fromColor( Cesium.Color.fromCssColorString( "rgba(255, 255, 255, 0.75)") ), }, }), appearance: new Cesium.PolylineColorAppearance(), })
标签:颜色,color,positions,Cesium,length,cesium,new,赋值,255 From: https://www.cnblogs.com/zwjun/p/17148836.html