Recently in dynamic flow, but, according to texture don't know why don't write any great god help see
//dynamic line material
The function PolylineTrailLinkMaterialProperty (color, duration) {
Enclosing _definitionChanged=new Cesium, Event ();
Enclosing _color=undefined;
Enclosing _colorSubscription=undefined;
this.color=color;
This. Duration=duration;
Enclosing _time=(new Date ()). The getTime ();
}
Object. DefineProperties (PolylineTrailLinkMaterialProperty prototype, {
IsConstant: {
Get: the function () {
return false;
}
},
DefinitionChanged: {
Get: the function () {
Return this. _definitionChanged;
}
},
Color: Cesium createPropertyDescriptor (' color ')
});
PolylineTrailLinkMaterialProperty. Prototype. GetType=function (time) {
Return 'PolylineTrailLink';
}
PolylineTrailLinkMaterialProperty. Prototype. GetValue=https://bbs.csdn.net/topics/function (time, result) {
if (! Cesium. Defined (result)) {
Result={};
}
Result. Color=Cesium. Property. GetValueOrClonedDefault (enclosing _color, time, Cesium, color, WHITE, and the result. The color).
Result. The image=Cesium. Material. PolylineTrailLinkImage;
Result. Time=(((new Date ()). The getTime () - this. _time) % this. The duration)/this. Duration;
return result;
}
PolylineTrailLinkMaterialProperty. Prototype. Equals=function (other) {
Return this===other | |
(other instanceof PolylineTrailLinkMaterialProperty & amp; &
Cesium. Property. The equals (enclosing _color, other. _color))
}
Cesium. PolylineTrailLinkMaterialProperty=PolylineTrailLinkMaterialProperty;
Cesium. Material. PolylineTrailLinkType='PolylineTrailLink';
Cesium. Material. PolylineTrailLinkImage="../../static/images/effects/LinkPulse. PNG ";
Cesium. Material. PolylineTrailLinkSource=
"Czm_material czm_getMaterial (czm_materialInput materialInput) \ n \
{czm_material material=czm_getDefaultMaterial (materialInput); Vec2 st=materialInput. St; \ n \
Vec4 colorImage=texture2D (image, vec2 (fract (st. s - time), st. t)); \ n \
Material. The alpha=colorImage. A * color. A; \ n \
Material. Diffuse=(colorImage. RGB + color. RGB)/2.0; \ n \
The return material. } ";
Cesium. Material. _materialCache. AddMaterial (Cesium. Material. PolylineTrailLinkType, {
Fabric: {
Type: Cesium. Material. PolylineTrailLinkType,
Uniforms: {
Color: new Cesium. Color (1.0, 0.0, 0.0, 0.5),
Image: Cesium. Material. PolylineTrailLinkImage,
Time: 20
},
Source: Cesium. Material. PolylineTrailLinkSource
},
Translucent: function (material) {
return true;
}
});
let line=earth. CZM. Viewer. Entities. Add ({
Name: 'PolylineTrail'
Polyline: {
Positions: Cesium. Cartesian3. FromDegreesArrayHeights ([113.9251090, 27.6920705, 113.9276940, 27.6878466, 300, 300]),
Width: 8,
Material: new Cesium. PolylineTrailLinkMaterialProperty (Cesium. Color. AQUA, 10000),
ClampToGround: true
}
});