Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

applyPaintStroke

applyPaintStroke(grid, stroke, baseOf, selected?): TerrainChange

Runs one Paint or Scatter stroke over the grid and returns the cells it touched with their paint before and after. Each cell takes the stroke once, at the strongest weight any dab reached it with, so a slow drag and a fast one paint alike. baseOf answers a cell’s material where the rules decide it. Given the cells a stroke’s where selected, each takes the stroke once at its strength in place of the dabs, and More and clear grow back what was erased in it.

Parameter Type
grid PaintGrid
stroke { clear: boolean; erase: boolean; families?: ScatterFamily[]; level?: number; lower: boolean; material?: string; multiplier?: number; points: [number, number][]; radius: number; shape: "circle" | "square"; strength: number; tool: "scatter" | "paint" | "sculpt" | "smooth" | "flatten"; where?: string; }
stroke.clear boolean
stroke.erase boolean
stroke.families? ScatterFamily[]
stroke.level? number
stroke.lower? boolean
stroke.material? string
stroke.multiplier? number
stroke.points? [number, number][]
stroke.radius? number
stroke.shape? "circle" | "square"
stroke.strength? number
stroke.tool? "scatter" | "paint" | "sculpt" | "smooth" | "flatten"
stroke.where? string
baseOf? (cell) => string
selected? readonly number[]

TerrainChange