hide()

in packages/layers/marker/src/Marker.ts [301:350]


	hide(duration = 1000) {
		const timeline = this.timeline
		if (!timeline) {
			console.warn('timeline not ready')
			return
		}

		if (this._object3d) {
			traverse(this._object3d, (mesh) => {
				if (IR.isRenderable(mesh)) {
					mesh.material.alphaMode = 'BLEND'
				}
			})
		}
		if (this._html) {
			this.element.style.opacity = '1.0'
		}

		timeline.addTrack({
			id: 'Marker Hide',
			startTime: timeline.currentTime,
			duration: duration,
			onStart: () => {},
			onEnd: () => {
				if (this._object3d) {
					traverse(this._object3d, (mesh) => {
						if (IR.isRenderable(mesh)) {
							mesh.material.opacity = 0.0
						}
					})
				}
				if (this._html) {
					this.element.style.opacity = '0.0'
				}
				this.visible = false
			},
			onUpdate: (t, p) => {
				if (this._object3d) {
					traverse(this._object3d, (mesh) => {
						if (IR.isRenderable(mesh)) {
							mesh.material.opacity = (this._matrOpMap.get(mesh.material) ?? 1.0) * (1 - p)
						}
					})
				}
				if (this._html) {
					this.element.style.opacity = (1 - p).toString()
				}
			},
		})
	}