Skip to content

API Reference ​

Complete reference for the @scumble/react component layer. Everything below is imported from one place — Path2D, PathOpName, and the image types are re-exports from the @scumble/graphics core:

tsx
import { Canvas, Rect, LinearGradient, vec, createAnimation } from "@scumble/react";

New here? Start with Getting Started, then circle back for the details.

Containers ​

ExportDescription
CanvasThe GPU drawing surface — the root node every scene renders into, with an optional logical viewPort.
GroupGrouping node: cascading transforms, paint inheritance, and clipping for a subtree.

Animation ​

ExportDescription
createAnimationMint a declarative native animation track spec with an imperative playback controller attached.
AnimationControllerThe imperative surface: pause / play / seekTo / cancel / onFinish / handle.
ControlledAnimationSpecThe createAnimation() return type — a track spec plus its controller, usable directly as animate.

Shapes ​

ExportDescription
CircleA circle from center + radius.
EllipseAn axis-aligned ellipse from center + two radii.
LineA straight line between two points — always stroked.
RectAn axis-aligned rectangle.
RRectA rectangle with corner radii.
PolylineAn open polyline through vertices — stroked by default.
PolygonA closed polygon through vertices — filled by default.
PointsA point set with Skia drawPoints semantics: dots, segments, or an open polyline.
PathAn SVG d string or Path2D, with fill rule and path trim.
ImageDraw a bitmap with fit and sampling control.
ParagraphWidth-constrained rich text, laid out natively (CoreText / HarfBuzz, BiDi-aware).
TextSpanOne styled run of text inside a <Paragraph>.

Images ​

ExportDescription
useImageResolve a source uri into a stable ImageHandle.
createImageHandleThe non-hook handle factory — same uri, same reference.

Shaders ​

Declarative children of a shape (or <Paint>): directly under a shape they fill it, inside <Paint style="stroke"> they stroke it.

ExportDescription
LinearGradientA linear gradient between two points.
RadialGradientA radial gradient from a center + radius.
SweepGradientAn angular sweep around a center.
TwoPointConicalGradientA two-circle (focal) conical gradient.
ImageShaderFill or stroke a shape with a bitmap texture.

Paint & Filters ​

ExportDescription
PaintDeclarative override for a shape's fill or stroke paint.
BlurImage filter: blur the shape's rendered layer.
DropShadowImage filter: a blurred colored copy behind the shape.
ColorMatrixColor filter: a per-pixel 4×5 color matrix.
ColorBlendColor filter: blend a constant color onto the source.
MaskBlurMask filter: feather the shape's alpha mask.

Clipping ​

ExportDescription
ClipRectClip a Group's subtree to a rectangle.
ClipRRectClip a Group's subtree to a rounded rectangle.
ClipPathClip a Group's subtree to an arbitrary path.

Utilities ​

ExportDescription
vecBuild an {x, y} point for shader/vertex props.
Path2DCommand-style path builder, with lazy boolean compositions via Path2D.op().
PathOpNameThe four boolean path-op names: "difference" | "intersect" | "union" | "xor".
FitHow a bitmap is inscribed into its destination rect (CSS object-fit family).
TileModeHow an image shader tiles outside its fitted rect.
ImageSamplingOptionsTexel sampling knobs for <Image> (filter / mipmap / cubic).
ImageFilterMode, ImageMipmapMode, ImageCubicResamplerThe sub-types of ImageSamplingOptions.

Released under the Apache License 2.0.