casc-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 10.5 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/primitives/particle/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-16 09:28:13\n * @LastEditTime: 2022-03-23 10:29:32\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\primitives\\particle\\index.ts\n */\nimport type { PropType } from 'vue'\nimport { createCommentVNode, defineComponent, getCurrentInstance } from 'vue'\nimport type {\n VcCartesian2,\n VcColor,\n VcComponentInternalInstance,\n VcComponentPublicInstance,\n VcPickEvent,\n VcReadyObject\n} from 'casc-cesium-utils/types'\nimport { usePrimitives } from 'casc-cesium-composables'\nimport {\n show,\n modelMatrix,\n image,\n color,\n startColor,\n endColor,\n imageSize,\n minimumImageSize,\n maximumImageSize,\n sizeInMeters,\n enableMouseEvent\n} from 'casc-cesium-utils/cesium-props'\nimport { kebabCase } from 'casc-cesium-utils/util'\nimport { primitiveEmits } from 'casc-cesium-utils/emits'\n\nconst emits = {\n ...primitiveEmits,\n complete: (evt: Cesium.ParticleSystem) => true\n}\nexport const particlePrimitiveProps = {\n ...show,\n updateCallback: Function,\n emitter: Object as PropType<Cesium.ParticleEmitter>,\n ...modelMatrix,\n emitterModelMatrix: Object as PropType<Cesium.Matrix4>,\n emissionRate: {\n type: Number,\n default: 5\n },\n bursts: Array as PropType<Array<Cesium.ParticleBurst>>,\n loop: {\n type: Boolean,\n default: true\n },\n scale: {\n type: Number,\n default: 1.0\n },\n startScale: Number,\n endScale: Number,\n ...color,\n ...startColor,\n ...endColor,\n ...image,\n ...imageSize,\n ...minimumImageSize,\n ...maximumImageSize,\n ...sizeInMeters,\n speed: {\n type: Number,\n default: 1.0\n },\n minimumSpeed: Number,\n maximumSpeed: Number,\n lifetime: {\n type: Number,\n default: Number.MAX_VALUE\n },\n particleLife: {\n type: Number,\n default: 5.0\n },\n minimumParticleLife: Number,\n maximumParticleLife: Number,\n mass: {\n type: Number,\n default: 1.0\n },\n minimumMass: Number,\n maximumMass: Number,\n ...enableMouseEvent\n}\nexport default defineComponent({\n name: 'VcPrimitiveParticle',\n props: particlePrimitiveProps,\n emits: emits,\n setup(props, ctx) {\n // state\n const instance = getCurrentInstance() as VcComponentInternalInstance\n instance.cesiumClass = 'ParticleSystem'\n instance.cesiumEvents = ['complete']\n usePrimitives(props, ctx, instance)\n return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n }\n})\n\nexport type VcPrimitiveParticleEmits = typeof emits\nexport type VcPrimitiveParticleProps = {\n /**\n * Whether to display the particle system.\n * Default value: true\n */\n show?: boolean\n /**\n * The callback function to be called each frame to update a particle.\n */\n updateCallback?: (particle: Cesium.Particle, dt: number) => void\n /**\n * The particle emitter for this system.\n */\n emitter?: Cesium.ParticleEmitter\n /**\n * The 4x4 transformation matrix that transforms the particle system from model to world coordinates.\n */\n modelMatrix?: Cesium.Matrix4\n /**\n * The 4x4 transformation matrix that transforms the particle system emitter within the particle systems local coordinate system.\n */\n emitterModelMatrix?: Cesium.Matrix4\n /**\n * The number of particles to emit per second.\n * Default value: 5.0\n */\n emissionRate?: number\n /**\n * An array of ParticleBurst, emitting bursts of particles at periodic times.\n */\n bursts?: Array<Cesium.ParticleBurst>\n /**\n * Whether the particle system should loop its bursts when it is complete.\n * Default: true\n */\n loop?: boolean\n /**\n * Sets the scale to apply to the image of the particle for the duration of its particleLife.\n * Default value: 1.0\n */\n scale?: number\n /**\n * The initial scale to apply to the image of the particle at the beginning of its life.\n */\n startScale?: number\n /**\n * The final scale to apply to the image of the particle at the end of its life.\n */\n endScale?: number\n /**\n * Sets the color of a particle for the duration of its particleLife.\n * Default value: white\n */\n color?: VcColor\n /**\n * The color of the particle at the beginning of its life.\n */\n startColor?: VcColor\n /**\n * The color of the particle at the end of its life.\n */\n endColor?: VcColor\n /**\n * The URI, HTMLImageElement, or HTMLCanvasElement to use for the billboard.\n */\n image?: string | HTMLImageElement | HTMLCanvasElement\n /**\n * If set, overrides the minimumImageSize and maximumImageSize inputs that scale the particle image's dimensions in pixels.\n */\n imageSize?: VcCartesian2\n /**\n * Sets the minimum bound, width by height, above which to randomly scale the particle image's dimensions in pixels.\n */\n minimumImageSize?: VcCartesian2\n /**\n * Sets the maximum bound, width by height, below which to randomly scale the particle image's dimensions in pixels.\n */\n maximumImageSize?: VcCartesian2\n /**\n * Sets if the size of particles is in meters or pixels. true to size the particles in meters; otherwise, the size is in pixels.\n */\n sizeInMeters?: boolean\n /**\n * If set, overrides the minimumSpeed and maximumSpeed inputs with this value.\n * Default value: 1.0\n */\n speed?: number\n /**\n * Sets the minimum bound in meters per second above which a particle's actual speed will be randomly chosen.\n */\n minimumSpeed?: number\n /**\n * Sets the maximum bound in meters per second below which a particle's actual speed will be randomly chosen.\n */\n maximumSpeed?: number\n /**\n * How long the particle system will emit particles, in seconds.\n * Default value: Number.MAX_VALUE\n */\n lifetime?: number\n /**\n * If set, overrides the minimumParticleLife and maximumParticleLife inputs with this value.\n * Default value: 5.0\n */\n particleLife?: number\n /**\n * Sets the minimum bound in seconds for the possible duration of a particle's life above which a particle's actual life will be randomly chosen.\n */\n minimumParticleLife?: number\n /**\n * Sets the maximum bound in seconds for the possible duration of a particle's life below which a particle's actual life will be randomly chosen.\n */\n maximumParticleLife?: number\n /**\n * Sets the minimum and maximum mass of particles in kilograms.\n * Default value: 1.0\n */\n mass?: number\n /**\n * Sets the minimum bound for the mass of a particle in kilograms. A particle's actual mass will be chosen as a random amount above this value.\n */\n minimumMass?: number\n /**\n * Sets the maximum mass of particles in kilograms. A particle's actual mass will be chosen as a random amount below this value.\n */\n maximumMass?: number\n /**\n * Specifies whether to respond to mouse pick events.\n * Default Value: true\n */\n enableMouseEvent?: boolean\n /**\n * Triggers before the component is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the component is successfully loaded.\n */\n onReady?: (readyObject: VcReadyObject) => void\n /**\n * Triggers when the component load failed.\n */\n onUnready?: (e: any) => void\n /**\n * Triggers when the component is destroyed.\n */\n onDestroyed?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the mouse is pressed on this primitive.\n */\n onMousedown?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse bounces up on this primitive.\n */\n onMouseup?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse clicks on this primitive.\n */\n onClick?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse clicks outside this primitive.\n */\n onClickout?: (evt: VcPickEvent) => void\n /**\n * Triggers when the left mouse button double-clicks this primitive.\n */\n onDblclick?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves on this primitive.\n */\n onMousemove?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves over to this primitive.\n */\n onMouseover?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves out of this primitive.\n */\n onMouseout?: (evt: VcPickEvent) => void\n}\n\nexport type VcPrimitiveParticleRef = VcComponentPublicInstance<VcPrimitiveParticleProps>\n"],"names":[],"mappings":";;;;;;;AAiBA,MAAM,KAAK,GAAG;AACd,EAAE,GAAG,cAAc;AACnB,EAAE,QAAQ,EAAE,CAAC,GAAG,KAAK,IAAI;AACzB,CAAC,CAAC;AACU,MAAC,sBAAsB,GAAG;AACtC,EAAE,GAAG,IAAI;AACT,EAAE,cAAc,EAAE,QAAQ;AAC1B,EAAE,OAAO,EAAE,MAAM;AACjB,EAAE,GAAG,WAAW;AAChB,EAAE,kBAAkB,EAAE,MAAM;AAC5B,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,MAAM,EAAE,KAAK;AACf,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IA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