对于轨迹图片效果 我们先定义一下他的interface, 方便使用的人知道他的调用参数
export interface PMaterialTrailImage {
color?: any;
speed?: number;
image: string;
count?: number;
direction?: boolean;
order?: boolean;
}
//color:颜色,duration:时长,url:图片地址,count:分段数量,direction:纵横,order:方向
对于轨迹图片我们叫 MaterialTrailImage
```javascript
import { MaterialProperty } from "./MaterialProperty";
const defaultOption: PMaterialTrailImage = {
color: new Cesium.Color(0.0, 0.0, 1.0, 0.5),
speed: 3000,
image: Cesium.Material.DefaultImageId,
count: 1,
direction: false,
order: false,
}
/**
图片流动效果
*/
export class MaterialTrailImage extends MaterialProperty {
public _getType(option: PMaterialTrailImage) {
// 由于参数需要动态变动,所以count有变动,认为是新着色器
const { direction = false, order = false } = option;
returnMaterialTrailImage${direction}${order}
}
constructor(option=defaultOption) {
super(MaterialTrailImage.prototype, defaultOption, option);
}
/**
direction(纵横)[boolean]:纵或者横
goodPoor(方向)[boolean]:顺或者逆
*/
getSource(option: PMaterialTrailImage) {
const { direction = false, order = false } = option;
const v1 = direction ? "st.t" : "st.s";
更多参考 https://xiaozhuanlan.com/topic/4370915862
网友评论