VaelisDocs
v1.0.0
Components · v1.0.0

StrokePath

Vaelis 1.0.0 StrokePath component reference: fields, script API, behavior and examples.

View as Markdownllms.txt
ScopeThis page documents the StrokePath component in Vaelis 1.0.0. Runtime fields are serialized scene data; the Script API section lists only members intentionally exposed to game scripts.
Where to find it in the editorTop GameObject → 2D Object → Stroke Path. After a Stroke Path exists, the toolbar exposes Path (P); click empty space to append, drag points, and click segments to insert.

#What it does

A variable-thickness strip along placed points — rivers, cables, roads, conveyor belts or walls — with flat color or textured fill.

Component setup & editor toolsStrokePath creates a drawable strip/path; its editing is performed with the Stroke Path viewport tool/gizmo.

#How to add and use StrokePath

Editor path: Select the target entity in the Hierarchy (left side) → look at the Inspector (right side) → click Add Component at the bottom of the Inspector → search for StrokePath → click the component row. The Add Component picker is a centered modal with a search box; it only lists components not already attached.

For components with a dedicated editor tool, the tool is opened or activated from the location described below. Do not assume that adding the component alone activates its editor; some systems require a separate window, panel, or viewport tool.

#Component setup & editor tools

  • Select an entity with StrokePath → use the Stroke Path viewport tool/gizmo to edit path points. Keep the Inspector open for serialized path/material settings.

#What you should see after adding it

The component appears as its own section in the Inspector. Its serialized settings are listed in the Component data table below. If a field is conditional, it appears only when the relevant mode/type is selected. If a field is a runtime state field (for example grounded or resolved velocity), treat it as read-only diagnostic state unless the API reference explicitly documents it as writable.

#How to read the settings

For every setting below, the documentation distinguishes type, default, meaning, and tuning direction where behavior is known. When a value represents a direction, use the engine's coordinate convention documented in Coordinate system; do not substitute Unity/Godot conventions.

#Component data

FieldTypePurposeDefault
pointsarray of {x,y}Local-space point list defining the open polyline (not rotated/scaled by the Transform).[{x:-100,y:0}, {x:100,y:0}]
thicknessnumberStrip thickness.40
colorhex stringFlat fill color, used when useTexture is false.#8a8a8a
opacitynumberOpacity.1
useTexturebooleanUse an image texture along the path instead of a flat fill.false
textureKeystring|nullTexture asset key.null
textureModeenumstretch | tile.stretch
textureTilingnumberTiling length when textureMode is tile.100
textureScalenumberTexture scale.1
textureOffsetnumberTexture offset; animatable for a flowing river/conveyor-belt look.0
textureFlipbooleanFlip texture.false
textureRotationnumberTexture rotation.0
jointModeenumJoint style between segments.round
capModeenumEnd-cap style.round
smoothingnumber0-1. Runs the authored `points` through a Catmull-Rom spline resample BEFORE tessellation, turning the raw straight-segment polyline into a smooth curve — same idea as a…0

#Tuning behavior

These are the practical direction-of-change rules for the most important controls on this component.

SettingWhat changing it does
thicknessLarger values make the strip wider.
textureTilingIn TILE mode, larger values make each repeated texture cover more path length, so the image repeats less often.
textureScaleHigher scales the texture; lower makes it smaller/repeated more densely.
textureOffsetChanging this over time scrolls the texture along the path.
opacity0 invisible, 1 opaque.

#Script API

MemberKindDescription
pointsPropertyLocal-space point array; reads return a fresh deep copy, writes replace the component’s array with a deep copy.
thicknessPropertyStrip thickness.
colorPropertyFlat fill color.
opacityPropertyOpacity.
useTexturePropertyWhether a texture is used instead of a flat fill.
textureKeyPropertyTexture asset key.
textureModePropertystretch | tile.
textureTilingPropertyTiling length.
textureScalePropertyTexture scale.
textureOffsetPropertyTexture offset.
textureFlipPropertyTexture flip.
getPoint(i)MethodRead one point by index.
setPoint(i,x,y)MethodOverwrite one point.
addPoint(x,y)MethodAppend a point.
insertPoint(i,x,y)MethodInsert a point at index i.
removePoint(i)MethodRemove a point by index.
pointCountPropertyRead-only point count.
getLength()MethodTotal path length.
firstPointPropertyRead-only first point.
lastPointPropertyRead-only last point.
worldToLocal(x,y)MethodConvert a world-space point to the entity’s local point space.
localToWorld(x,y)MethodConvert a local-space point to world space.
capModeProperty'none' | 'box' | 'round' — see StrokePathCapMode in components/StrokePath.js.
jointModeProperty'sharp' | 'bevel' | 'round' — see StrokePathJointMode in components/StrokePath.js.
textureRotationPropertyTexture rotation in degrees, around each tile's own center.

#Notes & behavior

  • Points are placed with the Path tool in the Scene viewport, then adjusted by dragging a point or clicking a segment to insert a new one between two existing points.
  • An open polyline (A to B), not a closed loop.
  • Reads/writes on this.strokePath.points always operate on a copy, so mutating a returned array can never silently corrupt the live component; assign it back (or use the point methods) to apply a change.

#Examples

js
this.strokePath.addPoint(this.x, this.y);
js
this.strokePath.textureOffset += 20 * time.deltaTime; // flowing river/conveyor look
Need the full workflow?Components: complete workflow covers adding, configuring, testing, combining, and removing components.