API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classAlphaOccluder
Shadows from a texture's own silhouette, traced once. ```ts lighting.occludeFrom(new AlphaOccluder(tree)); ``` Pass the drawable and it supplies everything: its texture, the frame of it that it shows - so a sprite from an atlas outlines itself rather than the whole page - its own box, and its transform, which already carries the anchor. Pass a bare texture instead and the whole of it is traced, placed by `node`. The alpha channel is traced and simplified per distinct frame, on first sight and then never again, so an animation costs one trace per frame OF THE CLIP rather than one per rendered frame - and the outline follows the clip instead of freezing on whichever frame was showing at construction. What runs every rendered frame is a comparison and the transform. That leaves two cases with no outline rather than a wrong one, both reported on the `AlphaOccluder` log source in a development build. A render target has no pixels this side of the GPU and can never be traced. A texture that is not readable yet - still loading, or tainted by a cross-origin image - is retried on the next frame rather than cached. The outline follows the art, which is not always the shadow you want - a tree casts the shadow of its trunk, not of its canopy. Reach for PolygonOccluder where they differ.
import { AlphaOccluder } from '@codexo/exojs-lighting'Shadows from a texture's own silhouette, traced once.
```ts lighting.occludeFrom(new AlphaOccluder(tree)); ```
Pass the drawable and it supplies everything: its texture, the frame of it that it shows - so a sprite from an atlas outlines itself rather than the whole page - its own box, and its transform, which already carries the anchor. Pass a bare texture instead and the whole of it is traced, placed by `node`.
The alpha channel is traced and simplified per distinct frame, on first sight and then never again, so an animation costs one trace per frame OF THE CLIP rather than one per rendered frame - and the outline follows the clip instead of freezing on whichever frame was showing at construction. What runs every rendered frame is a comparison and the transform.
That leaves two cases with no outline rather than a wrong one, both reported on the `AlphaOccluder` log source in a development build. A render target has no pixels this side of the GPU and can never be traced. A texture that is not readable yet - still loading, or tainted by a cross-origin image - is retried on the next frame rather than cached.
The outline follows the art, which is not always the shadow you want - a tree casts the shadow of its trunk, not of its canopy. Reach for PolygonOccluder where they differ.
new(source: AlphaOccluderDrawableA drawable whose own texture, frame and layout box describe where its silhouette belongs. Core's `Sprite` - and therefore `AnimatedSprite` and `Video`, which e… | TextureA static GPU texture sourced from an image, canvas, or video element. Holds the pixel source, its sampling state (ScaleModes, WrapModes) and its upload state (…, options: AlphaOccluderOptionsTuning for AlphaOccluder.): AlphaOccludercollect(bounds: ReadonlyRectangleRead-only view of a Rectangle: every accessor and non-mutating query a rectangle offers, with none of its writers. Returned by APIs that hand out a LIVE intern…, out: OccluderSinkWhere an OccluderSource writes what blocks light. The main channel is line segments in world space: an occluder has no thickness, no interior and no material,…): void