Skip to content

Grid(plane, params) ⇒ None ​

Grid: This constrains children to a fixed width and or height

ParamTypeDescription
planeTHREE.Object3DContainer Plane object which children elements conform to
paramsObjectOptional dictionary for X/Y Scrolling, element radius and padding
js
// YScroll - Overflow on the Y axis, this will use rows for sizing
// XScroll - Overflow on the X axis, this will use columns for sizing

// Overflow grid on x axis and use row count to adjust children size
// Children elements are constrained to fit vertically

// Overflow grid on y axis and use column count to adjust children size
// Children elements are constrained to fit horizontally

// If neither XScroll or YScroll are enabled then grid will overflow on both axes




// Call this on a plane object to create a grid.
// All children elements will conform to the grid
let params = {
	'enabled': true,
	'padding': 0.01, // measured in world units, 1 = 1 metre, 0.01 = 1cm
	'rows': 3,
	'columns': 3,
	'roundedRadius': 0.05, // how much round the corners of child elements
	'width': 1.4, // width of each element
	'height': 1.4, // height of each element
	'YScroll': true,
	'XScroll': false,
	'rounded': true,
	'zOffset': 0.001 // move forward for z-fighting or 3D planes
}

UI.Grid(plane : Object3D, params: Object)