Skip to main content

Class: BlockAnimations

Constructors

constructor

new BlockAnimations(host): BlockAnimations

Parameters

NameType
hostBlockAnimationHost

Returns

BlockAnimations

Accessors

activeCount

get activeCount(): number

Voxels currently moving; a diagnostic for tests and the agent.

Returns

number


trackedCount

get trackedCount(): number

Voxels with a tracked mesh, moving or at rest.

Returns

number

Methods

clear

clear(): void

Returns

void


get

get(block): BlockAnimation

Parameters

NameType
blockBlock

Returns

BlockAnimation


handleSectionMeshed

handleSectionMeshed(cx, cz, level, meshes, nowMs): void

The meshes of one chunk section just landed. Every animated voxel among them is compared with the mesh it replaces: same state and the pose carries over (a neighbour's edit remeshed the section mid-swing); a new state and the leaf starts moving from where it visibly was.

Parameters

NameType
cxnumber
cznumber
levelnumber
meshesMesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>[]
nowMsnumber

Returns

void


handleSectionUnloaded

handleSectionUnloaded(cx, cz, level): void

The section's meshes are gone (chunk unloaded): forget its voxels.

Parameters

NameType
cxnumber
cznumber
levelnumber

Returns

void


register

register(names, animation): () => void

Declare how the named blocks move between their states. Names are matched case-insensitively, as the registry keys them. Returns a disposer that forgets the declaration again.

Parameters

NameType
namesstring | string[]
animationBlockAnimation

Returns

fn

▸ (): void

Returns

void


snapshot

snapshot(nowMs): BlockAnimationsSnapshot

What the animations know right now, for the agent harness: the block names with a declared motion, and every tracked voxel with the pose it is showing. angle is radians about the hinge from the stage-0 pose; progress is 1 at rest.

Parameters

NameType
nowMsnumber

Returns

BlockAnimationsSnapshot


update

update(nowMs): void

Advance every moving voxel to nowMs. Called once per frame.

Parameters

NameType
nowMsnumber

Returns

void