vue-cesium
Version:
Vue 3.x components for CesiumJS.
56 lines (53 loc) • 2.64 kB
JavaScript
import { getCesiumColor, getCesiumValue } from '../../../utils/util.mjs';
import BaseMaterialProperty from './VcBaseMaterialProperty.mjs';
"use strict";
class VcLineFlowMaterialProperty extends BaseMaterialProperty {
constructor(options = {}) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
super(options);
const { Color, Cartesian2, defined } = Cesium;
this.image = (_a = options.image) != null ? _a : options.url;
this.color = (_b = options.color) != null ? _b : new Color(1, 1, 1, 0);
this.axisY = (_c = options.axisY) != null ? _c : false;
this.mixt = (_d = options.mixt) != null ? _d : false;
this.speed = (_e = options.speed) != null ? _e : 10;
this.duration = options.duration;
this.repeat = (_f = options.repeat) != null ? _f : new Cartesian2(1, 1);
this.image2 = (_g = options.image2) != null ? _g : options.bgUrl;
this.color2 = (_i = (_h = options.color2) != null ? _h : options.bgColor) != null ? _i : new Color(1, 1, 1, 0);
this.hasImage2 = defined(this.image2);
this.globalAlpha = (_j = options.globalAlpha) != null ? _j : true;
}
getType(value) {
return "VcLineFlow";
}
getValue(time, result) {
const { Color, Cartesian2, defined } = Cesium;
!defined(result) && (result = {});
result.image = this.image;
result.color = getCesiumColor(this.color, new Color(1, 1, 1, 0), time);
result.repeat = getCesiumValue(this.repeat, Cartesian2, time);
result.axisY = this.axisY;
result.mixt = this.mixt;
result.speed = getCesiumValue(this.speed, Number, time);
if (this.duration) {
if (this._time === void 0) {
this._time = (/* @__PURE__ */ new Date()).getTime();
result.time = ((/* @__PURE__ */ new Date()).getTime() - this._time) / (this.duration * 1e3);
}
} else {
result.time = -1;
}
result.hasImage2 = this.hasImage2;
result.image2 = this.image2;
result.color2 = getCesiumColor(this.color2, new Color(1, 1, 1, 0), time);
result.globalAlpha = this.globalAlpha;
return result;
}
equals(other) {
const reData = this === other || other instanceof VcLineFlowMaterialProperty && Cesium.Property["equals"](this.color, other.color) && Cesium.Property["equals"](this.repeat, other.repeat) && this.image === other.image && this.axisY === other.axisY && this.speed === other.speed && this.hasImage2 === other.hasImage2 && this.image2 === other.image2 && this.image2 === other.image2 && Cesium.Property["equals"](this.color2, other.color2);
return reData;
}
}
export { VcLineFlowMaterialProperty as default };
//# sourceMappingURL=VcLineFlowMaterialProperty.mjs.map