LavaUI docs GitHub

protocol View3D

Swift

protocol View3D

Content of a Scene3D: objects, lights and groups of them.

Unlike View, a 3D view has no body and no state of its own. It flattens into SpatialElements the scene draws, and the …3D modifiers set their transform, material and behaviour.

Sources/LavaUI/Spatial.swift:509

Methods

func animation3D(_ animation: SpatialAnimation = .smooth()) -> some View3D
  

Animates changes to the object's transform. See SpatialAnimation.

Sources/LavaUI/Spatial.swift:699

func catalog3D(index: Int, itemCount: Int, focusedIndex: Int?, layout: CatalogLayout3D = .focusedShelf()) -> some View3D
  

Places the object at item index of a focused shelf. See CatalogLayout3D.pose(at:itemCount:focusedIndex:).

Sources/LavaUI/Spatial.swift:649

func catalog3D(index: Int, itemCount: Int, focusedIndex: Int?, itemHeight: Float = 0, layout: BookshelfLayout3D) -> some View3D
  

Places the object at item index of a bookshelf. See BookshelfLayout3D.pose(at:itemCount:focusedIndex:itemHeight:).

Sources/LavaUI/Spatial.swift:658

func material3D(_ material: Material3D) -> some View3D
  

Sets how the object's faces are coloured.

Sources/LavaUI/Spatial.swift:703

func offset3D(x: Float = 0, y: Float = 0, z: Float = 0) -> some View3D
  

Moves the object by the given amounts, in world units, from where it is.

Sources/LavaUI/Spatial.swift:673

func onHover3D(_ action: @escaping (Bool) -> Void) -> some View3D
  

Calls action with true when the pointer moves onto the object and false when it leaves.

Sources/LavaUI/Spatial.swift:738

func onTap3D(_ action: @escaping () -> Void) -> some View3D
  

Calls action when the object is clicked. With camera controls on, a drag of four pixels or more orbits instead and does not count as a click.

Sources/LavaUI/Spatial.swift:743

func position(_ value: Vector3) -> some View3D
  

Replaces the position.

Sources/LavaUI/Spatial.swift:669

func reflection3D(_ style: Reflection3DStyle = Reflection3DStyle()) -> some View3D
  

Mirrors the object in a horizontal floor.

Sources/LavaUI/Spatial.swift:721

func reflection3D(planeY: Float = -0.75, opacity: Float = 0.3, fadeDistance: Float = 1.6, blurRadius: Float = 1.5) -> some View3D
  

Mirrors the object in a horizontal floor. See Reflection3DStyle.

Sources/LavaUI/Spatial.swift:727

func rotation3D(angle: Angle3D, axis: Vector3) -> some View3D
  

Replaces the rotation with angle about axis.

Stored as Euler angles (axis × angle), which is exact for a rotation about one of the coordinate axes — [0, 1, 0] and the like — and an approximation for any other axis.

Sources/LavaUI/Spatial.swift:692

func scale3D(_ value: Float) -> some View3D
  

Scales the object uniformly.

Sources/LavaUI/Spatial.swift:680

func scale3D(_ value: Vector3) -> some View3D
  

Scales the object by a different amount along each axis.

Sources/LavaUI/Spatial.swift:684

func shadow3D(_ style: Shadow3DStyle = Shadow3DStyle()) -> some View3D
  

Draws a soft shadow under the object.

Sources/LavaUI/Spatial.swift:707

func shadow3D(color: Color = Color(r: 0, g: 0, b: 0), radius: Float = 16, offsetX: Float = 7, offsetY: Float = 11, opacity: Float = 0.32) -> some View3D
  

Draws a soft shadow under the object. See Shadow3DStyle.

Sources/LavaUI/Spatial.swift:711

func spatialElements() -> [SpatialElement]

The objects this view contributes, with its modifiers applied.

Sources/LavaUI/Spatial.swift:511

func transform3D(_ value: Transform3D) -> some View3D
  

Replaces the transform.

Sources/LavaUI/Spatial.swift:645