Store
Angular Three NgtCanvas
starts with a default NgtSignalStore<NgtState>
that is used to keep track of
the state of the canvas like the Renderer, Camera, Scene, Controls, events, size, etc…
We can access this store via the injectStore
function
Reactive State
The store exposes its properties as Signal
via the select()
function. select()
creates a computed
Signal
under the hood and caches the created Signal.
We can access nested properties of the store by passing more arguments to select()
To access the entire store, we can use select()
without any arguments or use state
property.
Snapshot State
We can access the latest state of the store via the snapshot
property. snapshot
always returns the latest state
upon accessing.
This is useful when we want to access the latest state imperatively without reactivity. Most of the time, this is used in the animation loop.
get()
Alternatively, we can access the snapshot properties as values via get()
.
We can access nested properties of the store by passing more arguments to get()