LavaUI docs GitHub

struct BookshelfLayout3D

Swift

struct BookshelfLayout3D

Two stacks of books around a face-on cover: neighbours stand on the shelf at a steep yaw so a sliver of their front is still readable, and the focused item turns to face the camera.

Index 0 is the left of the list, not of the screen. The focused card sits at x = 0; everything before it packs into the left stack, everything after into the right. An empty stack is just an empty stack.

Sources/LavaUI/Spatial.swift:412

Constructors

init(stackOrigin: Float = 1.05, stackPitch: Float = 0.16, stackRecede: Float = 0.07, bookAngle: Angle3D = .degrees(62), focusDepth: Float = 0.55, focusLift: Float = 0.06, focusScale: Float = 1.06)

Creates a layout.

Sources/LavaUI/Spatial.swift:430

Properties

var bookAngle: Angle3D

Yaw of a book in the stack. Large enough to read as a spine-on-shelf pose; small enough that the cover is still visible.

Sources/LavaUI/Spatial.swift:421

var focusDepth: Float

How far the focused item comes forward, toward the camera.

Sources/LavaUI/Spatial.swift:423

var focusLift: Float

How far the focused item rises.

Sources/LavaUI/Spatial.swift:425

var focusScale: Float

Scale of the focused item.

Sources/LavaUI/Spatial.swift:427

var stackOrigin: Float

World x of the first book in a stack, measured from the focused card.

Sources/LavaUI/Spatial.swift:414

var stackPitch: Float

How tightly later books pack along x. Small on purpose: a stack, not a row.

Sources/LavaUI/Spatial.swift:416

var stackRecede: Float

How far each further book steps back.

Sources/LavaUI/Spatial.swift:418

Methods

static func bookStacks(stackOrigin: Float = 1.05, stackPitch: Float = 0.16, bookAngle: Angle3D = .degrees(62)) -> BookshelfLayout3D

Bookshelf stacks with the default depth and focus.

Sources/LavaUI/Spatial.swift:449

func pose(at index: Int, itemCount: Int, focusedIndex: Int?, itemHeight: Float = 0) -> CatalogPose3D

The pose of item index of itemCount, with focusedIndex at x = 0 and facing the camera. itemHeight stands the books on a shelf at y = 0; pass 0 to centre them on y = 0 instead.

Sources/LavaUI/Spatial.swift:462

func recommendedMinimumCameraDistance(itemCount: Int, itemWidth: Float, itemHeight: Float, clearance: Float = 2.2) -> Float

A camera distance that keeps the camera outside the stacks, for CameraControls3D.minimumDistance.

Sources/LavaUI/Spatial.swift:490