Class: BlockAnimations
Constructors
constructor
• new BlockAnimations(host): BlockAnimations
Parameters
| Name | Type |
|---|---|
host | BlockAnimationHost |
Returns
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
| Name | Type |
|---|---|
block | Block |
Returns
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
| Name | Type |
|---|---|
cx | number |
cz | number |
level | number |
meshes | Mesh<BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, Material | Material[], Object3DEventMap>[] |
nowMs | number |
Returns
void
handleSectionUnloaded
▸ handleSectionUnloaded(cx, cz, level): void
The section's meshes are gone (chunk unloaded): forget its voxels.
Parameters
| Name | Type |
|---|---|
cx | number |
cz | number |
level | number |
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
| Name | Type |
|---|---|
names | string | string[] |
animation | BlockAnimation |
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
| Name | Type |
|---|---|
nowMs | number |
Returns
update
▸ update(nowMs): void
Advance every moving voxel to nowMs. Called once per frame.
Parameters
| Name | Type |
|---|---|
nowMs | number |
Returns
void