geom

GeomPolylinePath

Inherits: RefCounted

Drawing it

The code behind the picture above, where vp is the picture's size, c is its centre, r is 30% of its height.

var path := GeomPolylinePath.new()
GeomDraw.polyline_join = Geom.JOIN_ROUND
GeomDraw.thickness = vp.y * 0.085
GeomDraw.color = VIOLET
for i in 25:
	var u := i / 24.0
	path.add_point_2d(c + Vector2(-r * 1.15 + u * r * 2.3, -sin(u * TAU) * r * 0.62))
GeomDraw.polyline_2d(path, false)

Methods

void add_point(position: Vector3)
void add_point_2d(position: Vector2)
void add_point_2d_colored(position: Vector2, color: Color)
void add_point_2d_full(position: Vector2, color: Color, thickness_scale: float)
void add_point_colored(position: Vector3, color: Color)
void add_point_full(position: Vector3, color: Color, thickness_scale: float)
void clear()
int point_count()

Method descriptions

void add_point(position: Vector3)

Appends a 3D point using white and full thickness, so the style's own color and thickness pass through unchanged.

void add_point_2d(position: Vector2)

Appends a 2D point. Canvas paths ignore Z.

void add_point_2d_colored(position: Vector2, color: Color)

Appends a 2D point with its own color.

void add_point_2d_full(position: Vector2, color: Color, thickness_scale: float)

Appends a 2D point with its own color and thickness multiplier.

void add_point_colored(position: Vector3, color: Color)

Appends a 3D point with its own color, multiplied by the style color.

void add_point_full(position: Vector3, color: Color, thickness_scale: float)

Appends a point with its own color and a thickness multiplier, letting a path taper.

void clear()

Drops every point, keeping the allocation for reuse next frame.

int point_count()

How many points the path holds.