Vector Source
Loads an SVG file and emits its paths as native Caddis geometry, preserving per-path fill / stroke colors, stroke widths, layer names, and z-order.
Category: Source Menu path: Source > Vector Source
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
out | shape | output | Multi-path Shape with one Caddis Path per SVG sub-path. Each path carries the SVG element's color/stroke attributes. |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
path | string | "" | File path to the SVG. Browse via the … button or drop an .svg from the Assets panel. |
originMode | enum | Center | Center puts the SVG's viewBox center at (0, 0) — matches Caddis's parametric primitives. TopLeft keeps SVG's native top-left frame. |
scale | scalar | 1.0 | Uniform scale applied to all geometry post-parse. Useful when an icon was authored at 24px but you want it at 200px without inserting a Transform2D. |
overrideColors | boolean | false | When ON, strips per-path fill / stroke / strokeWidth attributes so DrawShape's uniform params drive rendering. Useful for "treat this SVG as line art and recolor" workflows. OFF preserves the original SVG colors per path. |
Expose Channels
When enabled (E button on node header), adds input ports that override params via edge connections:
| Port | Type | Overrides |
|---|---|---|
scale_in | scalar | scale |
How It Works
usvg parses the SVG into a fully-resolved tree (CSS applied, references inlined, transforms baked, basic shapes converted to paths). VectorSource walks that tree, emits one Caddis Path per SVG sub-path (each M… starts a new sub-path), and copies the per-element fill/stroke styling onto each path as attributes. Group transforms are baked into per-vertex coordinates so a circle inside a translate(50,50) scale(2) group lands where you expect.
Per-path attributes emitted (read by DrawShape's grouped renderer):
color— fill color (RGBA, linear-light). Includes element + fill opacity.strokeColor— stroke color, distinct from fill.strokeWidth— stroke width × the geometric mean of the path's transform scale (so strokes survive group scaling).name— SVG element id, prefixed with the group hierarchy (e.g."logo/icon/leaf").
A typical layer: VectorSource → Transform2D → DrawShape → Output. Drop an SVG asset onto the timeline and this chain is built automatically.
Usage Examples
Bring in an SVG logo
Export the logo as SVG from your design tool. Drop the .svg onto the Assets panel (or drag straight to the timeline). The new layer renders pixel-accurate solid fills/strokes, preserves layer names, and is fully composable with the rest of the graph (animate the Transform2D, blur it, mask it, etc.).
Animate per-path attributes
Wire VectorSource → ShapeAttributes → DrawShape and use ShapeAttributes to override color or opacity per path — driven by a Math node, a Field, or whatever else. The original SVG fill is the starting point; ShapeAttributes layers over it.
Tweak vertices in Edit mode
Wire VectorSource → EditableShape → Transform2D → DrawShape. EditableShape auto-switches to Edit mode and lets you drag any vertex while keeping the SVG topology + colors intact.
Explode Actions
Two one-click actions in the VectorSource Properties panel split the SVG into separately-animatable pieces (a "piece" = one SVG <path> element / one fill region):
- Explode Geometry — produces
VectorSource → [N ShapeExploders] → MergeShapes → existing DrawShape. All pieces share the layer's DrawShape styling but can be transformed independently (insert a Transform2D between any ShapeExploder and the merge to animate that piece). Best for "animate the position of each letter, render with one consistent look." - Explode Render — produces
VectorSource → [N (ShapeExploder → Transform2D → DrawShape)] → multi-input Merge → Output. Each piece gets its own full render stack — independent fill, stroke, opacity, filter. Best for "each letter gets a different gradient / drop shadow / blur."
Both actions create the entire chain in one undo entry. The button is disabled when fewer than 2 pieces are detected (single-path SVGs don't need explosion).
Tips
- File is re-read on every render call; large or complex SVGs (hundreds of paths) may add visible overhead. Will add mtime-aware caching if it shows up in profiles.
- Origin mode is a hint — once you wire a Transform2D, you have full control over position, scale, and rotation regardless.
- Path order matches the SVG's render order, so DrawShape's grouped renderer paints them in the same z-order.
- Edit the SVG file in any vector editor while the project is open — VectorSource doesn't auto-reload yet, but re-rendering the comp picks up the new file.
v1 Limitations (planned for follow-up)
- Gradient fills (linear / radial) fall back to the first stop's color. Future Phase 2: auto-generate
Gradientnodes wired intofill_sourceper path. <text>elements are dropped unless your SVG export already flattens text to outlines (most design tools have an "outline text" option on export).<image>embeds are skipped — use a separate ImageSource.- Filters / clipPaths / masks are skipped; author equivalents in Caddis's effect chain.
- Pattern fills become transparent.
fill-ruleis per-element in SVG but Caddis'sFillRuleis currently shape-wide; mixed even-odd / non-zero in a single SVG falls back to non-zero.
Related Nodes
- EditableShape — wire after VectorSource to tweak vertices while preserving SVG fidelity (use Edit mode).
- ShapeAttributes — override per-path color/opacity/strokeWidth, driven by fields or values.
- Transform2D — position, scale, rotate the imported shape.
- DrawShape — rasterizes the multi-path output with per-path fill + stroke.
- ImageSource — for raster images.