geom

GeomRect2DGeom.Nodes.Rect2D

Inherits: Node2D

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

A rectangle placed on the canvas.

From code

The code used to generate this page's thumbnail.

var rect := GeomRect2D.new()
rect.position = c
rect.size = Vector2(r * 2.0, r * 1.5)
# Clockwise from bottom-left, as fractions of the shorter half-side.
rect.corner_radii = Vector4(0.35, 0.35, 0.35, 0.35)
rect.color = AMBER
add_child(rect)
var rect = Geom.Nodes.Rect2D();
rect.Position = c;
rect.Set("size", new Vector2(r * 2.0f, r * 1.5f));
// Clockwise from bottom-left, as fractions of the shorter half-side.
rect.Set("corner_radii", new Vector4(0.35f, 0.35f, 0.35f, 0.35f));
rect.Set("color", AMBER);
AddChild(rect);

Properties

BlendMode blend_mode Geom.BLEND_TRANSPARENTGeom.BlendMode.Transparent
bool border false
Color color Color(1, 1, 1, 1)
Vector4 corner_radii Vector4(0, 0, 0, 0)
GeomDash dash null
Resource fill null
bool pivot_at_corner false
Vector2 size Vector2(180, 110)
ThicknessSpace size_space Geom.SPACE_WORLDGeom.ThicknessSpace.World
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.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.

bool border = false

Draw an outline of thickness instead of a fill.

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

Fill color, or the outline's color when border is set.

Vector4 corner_radii = Vector4(0, 0, 0, 0)

Corner radii as fractions of half the shorter side: x top-left, then clockwise.

GeomDash dash = null

A dash pattern.

Resource fill = null

A gradient in place of color. Takes GeomFillRadial, GeomFillAngular, GeomFillLinear or GeomFillCorners.

bool pivot_at_corner = false

Position by the top-left corner instead of the center.

Vector2 size = Vector2(180, 110)

Width and height.

ThicknessSpace size_space = Geom.SPACE_WORLDGeom.ThicknessSpace.World

How size is measured.

float thickness = 8.0

Outline thickness. Used only when border is set.

ThicknessSpace thickness_space = Geom.SPACE_WORLDGeom.ThicknessSpace.World

How thickness is measured.