geom

GeomLine2DGeom.Nodes.Line2D

Inherits: Node2D

C#: make one with the Geom.Nodes.Line2D() factory, then set and read its properties by name with Set and Get, or in the Inspector, where the node is GeomLine2D.

A line segment on the canvas.

From code

The code used to generate this page's thumbnail.

var line := GeomLine2D.new()
line.position = c
line.start = Vector2(-r, r * 0.6)
line.end = Vector2(r, -r * 0.6)
line.end_cap = Geom.CAP_ROUND
line.thickness = vp.y * 0.09
line.color = PINK
add_child(line)
var line = Geom.Nodes.Line2D();
line.Position = c;
line.Set("start", new Vector2(-r, r * 0.6f));
line.Set("end", new Vector2(r, -r * 0.6f));
line.Set("end_cap", (int)Geom.LineEndCap.Round);
line.Set("thickness", vp.Y * 0.09f);
line.Set("color", PINK);
AddChild(line);

Properties

BlendMode blend_mode Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent
Color color Color(1, 1, 1, 1)
GeomDash dash null
Vector2 end Vector2(100, 0)
LineEndCap end_cap Geom.CAP_ROUNDGeom.LineEndCap.Round
Resource fill null
Vector2 start Vector2(-100, 0)
float thickness 8.0
ThicknessSpace thickness_space Geom.SPACE_WORLDGeom.ThicknessSpace.World

Enumerations

enum Geom.ThicknessSpace

Geom.SPACE_WORLDGeom.ThicknessSpace.World = 0
World units, the same as a node's position.
Geom.SPACE_VIEWPORT_PIXELSGeom.ThicknessSpace.ViewportPixels = 1
The viewport's pixels. Constant size on screen at any zoom.
Geom.SPACE_VIEWPORT_PERCENTGeom.ThicknessSpace.ViewportPercent = 2
Percent of the viewport's shorter side. Like CSS vmin.

enum Geom.LineEndCap

Geom.CAP_NONEGeom.LineEndCap.None = 0
Cut off exactly at an endpoint.
Geom.CAP_SQUAREGeom.LineEndCap.Square = 1
Extend by half the thickness at an endpoint.
Geom.CAP_ROUNDGeom.LineEndCap.Round = 2
Extend by half the thickness, rounded.

enum Geom.BlendMode

Geom.BLEND_OPAQUEGeom.BlendMode.Opaque = 0
Sorts by position. Hard edges: no anti-aliasing, and alpha is ignored.
Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent = 1
Standard alpha blending. The default.
Geom.BLEND_ADDITIVEGeom.BlendMode.Additive = 2
Adds this color to what is behind.
Geom.BLEND_MULTIPLYGeom.BlendMode.Multiply = 3
Multiplies what is behind by this color.
Geom.BLEND_SUBTRACTGeom.BlendMode.Subtract = 4
Subtracts this color from the background.
Geom.BLEND_TRANSPARENT_DEPTHGeom.BlendMode.TransparentDepth = 5
Transparent, but writes depth, so shapes with alpha 1 sort by position with anti-aliased edges. A translucent color behaves like Transparent.

Property descriptions

BlendMode blend_mode = Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent

How the shape blends with what is behind it. Transparent Depth acts like Transparent on the canvas.

Color color = Color(1, 1, 1, 1)

Line color.

GeomDash dash = null

A dash pattern.

Vector2 end = Vector2(100, 0)

End position.

LineEndCap end_cap = Geom.CAP_ROUNDGeom.LineEndCap.Round

How the ends are finished.

Resource fill = null

A gradient in place of color. Takes GeomFillLinear.

Vector2 start = Vector2(-100, 0)

Start position.

float thickness = 8.0

Line width.

ThicknessSpace thickness_space = Geom.SPACE_WORLDGeom.ThicknessSpace.World

How thickness is measured.