LogoPixi’VN
pixi-jsFunctions

Function: buildGeometryFromPath()

> buildGeometryFromPath(options): MeshGeometry

Defined in: node_modules/pixi.js/lib/scene/graphics/shared/utils/buildGeometryFromPath.d.ts:53

When building a mesh, it helps to leverage the simple API we have in GraphicsPath as it can often be easier to define the geometry in a more human-readable way. This function takes a GraphicsPath and returns a MeshGeometry.

Parameters

options

GraphicsPath | GeometryPathOptions

either a GraphicsPath or GeometryPathOptions

Returns

MeshGeometry

a new MeshGeometry instance build from the path

Example


const path = new GraphicsPath()
   .drawRect(0, 0, 100, 100)

const geometry:MeshGeometry = buildGeometryFromPath(path);

const mesh = new Mesh({geometry});

You can also pass in a Matrix to transform the uvs as by default you may want to control how they are set up.

Advanced