Skip to content
pixi-silk
GitHub repository
Interface

CanvasGridOptions

import type { CanvasGridOptions } from 'pixi-silk/ui/grid';

Options of CanvasGrid. In dots style, alpha defaults to 0.32 and fade to [12, 160], so dots read as strong as lines.

Extends#

Properties#

PropertyTypeDescriptionInherited fromDefined in
alpha?numberOpacity of a line at full strength, 0..1. Default 0.1.GridLevelOptions.alphaui/grid.ts:29
axes?booleanDraws the x = 0 and y = 0 axes in axisColor, 1 pixel wide. Default false. Change it later through state.axes.-ui/grid.ts:50
axisAlpha?numberOpacity of the axes, 0..1. Default 0.5.-ui/grid.ts:54
axisColor?ColorSourceColour of the axes. Default 0x64a8ff.-ui/grid.ts:52
cameraCameraThe camera the grid follows. The grid redraws whenever the camera’s signals change.-ui/grid.ts:40
color?ColorSourceLine and dot colour. Default white.-ui/grid.ts:44
dotSize?numberDot diameter in CSS pixels. Default 2. A level is skipped when its spacing is below twice this.-ui/grid.ts:48
fade?[number, number]Screen spacing in CSS pixels where a level starts to show and where it reaches full strength. Default [6, 120].GridLevelOptions.fadeui/grid.ts:31
lineWidth?numberLine width in CSS pixels. Default 1. A level is skipped when its spacing is below twice this.-ui/grid.ts:46
ratio?numberEach level is this many times the one below. Default 10, at least 2.GridLevelOptions.ratioui/grid.ts:27
style?GridStyleLines or dots. Default lines. Change it later through state.style, and the grid crossfades.-ui/grid.ts:42
ticker?Ticker | nullTicker that runs fades and redraws. Default Ticker.shared. With null, call CanvasGrid.tick yourself.-ui/grid.ts:56
unit?numberFinest step, in world units. Default 1, a pixel grid at 100%. Must be above 0.GridLevelOptions.unitui/grid.ts:25