MotionScript

@motion-script/core


@motion-script/core / resolveSurfaceSource

Function: resolveSurfaceSource()

resolveSurfaceSource(source): ResolvedSurfaceSource

Defined in: render3d/texture.ts:145

Narrow a surface source to the arm that knows how to draw it: a Graphics is replayed into a render context, a Node is laid out against the buffer and rendered.

Structural rather than instanceof, because that would need value imports of both classes and close the cycle the type-only imports above avoid. Graphics is a command recorder and exposes ops(); a Node has no such method. The union makes any other value a type error, so this only has to separate two known shapes rather than validate an unknown one.

Parameters

source

SurfaceSource3D

Returns

ResolvedSurfaceSource