Skip to content
🎉 Angular Three v4 is here! Read the announcement

Animation State

Import animation support from the explicit secondary entry point:

import {
NgteEcctrlAnimationState,
type NgteEcctrlAnimationStateContext,
type NgteEcctrlAnimationStateResolver,
type NgteEcctrlAnimationStateValue,
resolveEcctrlAnimationState,
} from 'angular-three-ecctrl/animation';
ExportPurpose
NgteEcctrlAnimationStateOptional ngte-ecctrl[animationState] directive.
NgteEcctrlAnimationStateValueThe resolved animation-state value.
NgteEcctrlAnimationStateContextContext provided to an animation-state resolver.
NgteEcctrlAnimationStateResolverType for a custom resolver function.
resolveEcctrlAnimationStateDefault resolver utility.

NgteEcctrlAnimationStateValue resolves to one of IDLE, WALK, RUN, JUMP_START, JUMP_IDLE, JUMP_FALL, or JUMP_LAND.

NgteEcctrlAnimationState has selector ngte-ecctrl[animationState]. Its animationState input enables the directive and is also its exportAs value; there is no alternate directive alias. Pass a custom NgteEcctrlAnimationStateResolver through the resolver input when the default resolution does not match the animation graph.

<ngte-ecctrl
#player="ecctrl"
#animation="animationState"
[animationState]="true"
[resolver]="resolver"
(animationStateChange)="onAnimationStateChange($event)"
>
<!-- Project the character model here. -->
</ngte-ecctrl>
Directive surfaceAPI
Selector / exportngte-ecctrl[animationState] / animationState
InputsanimationState (enabled boolean), resolver
OutputanimationStateChange
Readonly statestate signal, read with animation.state()

animationStateChange emits the resolved NgteEcctrlAnimationStateValue. JUMP_LAND is emitted when the controller becomes newly grounded while it is not moving.

See the basic controller example for a character setup.