Skip to main content

createTextPath

Creates a new text on a path node from an existing vector node.

Signature

createTextPath(node: VectorNode, startSegment: number, startPosition: number): TextPathNode

Parameters

node

The vector-like node to convert to a text on a path node. These can be VectorNodes, shape nodes (Rectangle, Ellipse, Polygon, Star), or Line nodes.

startSegment

The index of the segment in the vector network to start the text path from.

startPosition

A number between 0 and 1 representing the position along the start segment to start the text path from.

Remarks

Once you create a TextPathNode, you can then modify properties such as characters, fontSize, fill, etc just like a regular TextNode.

Example:

const circle = figma.createEllipse()
circle.resize(200, 200)
await figma.loadFontAsync({ family: "Inter", style: "Regular" })
const textPath = figma.createTextPath(circle, 2, 0.5)
textPath.characters = "This is text on a path!"

The base vector network cannot currently be modified after creating the TextPathNode.

info

Creating a TextPathNode modifies the type of the underlying node. Make sure that you use the node object returned from this function rather than the original node object.