GeomDisc2D
Inherits: Node2D
A disc, pie, ring or arc placed on the canvas.
Drawing it
The code behind the picture above, where c is its centre, r is 30% of its height.
GeomDraw.disc_2d_colored(c, r, CYAN) Properties
| float | angle_end_degrees | 270.0 |
| float | angle_start_degrees | 0.0 |
| bool | arc_end_cap_round | false |
| BlendMode | blend_mode | Geom.BLEND_TRANSPARENT |
| Color | color | Color(1, 1, 1, 1) |
| Color | color_end | Color(1, 1, 1, 1) |
| ColorMode | color_mode | Geom.COLOR_SINGLE |
| GeomDash | dash | null |
| DiscType | disc_type | Geom.DISC_DISC |
| float | radius | 64.0 |
| ThicknessSpace | radius_space | Geom.SPACE_METERS |
| float | thickness | 8.0 |
| ThicknessSpace | thickness_space | Geom.SPACE_METERS |
Enumerations
enum Geom.ThicknessSpace
- Geom.SPACE_METERS = 0
- Thickness in world units; shrinks on screen with distance.
- Geom.SPACE_PIXELS = 1
- Thickness in screen pixels; constant on-screen size.
- Geom.SPACE_VIEWPORT = 2
- A fraction of the viewport: 100 span its shorter side, so 1 is one percent of it and about 11 pixels at 1080p. The same idea as CSS
vmin. Radii and sizes here are whole-ish numbers; strokes come out below 1, and a stroke that should stay a fixed pixel width wantsSPACE_PIXELSinstead.
enum Geom.ColorMode
- Geom.COLOR_SINGLE = 0
- One flat color.
- Geom.COLOR_RADIAL = 1
- Interpolate
colortocolor_endfrom the center outwards. - Geom.COLOR_ANGULAR = 2
- Interpolate
colortocolor_endaround the sweep.
enum Geom.BlendMode
- Geom.BLEND_OPAQUE = 0
- Writes depth and sorts against other geometry; hard edges, no fade.
- Geom.BLEND_TRANSPARENT = 1
- Standard alpha compositing. The default.
- Geom.BLEND_ADDITIVE = 2
- Brightens what is behind. Good for glows.
- Geom.BLEND_MULTIPLY = 3
- Darkens what is behind. Good for tints.
- Geom.BLEND_SUBTRACT = 4
- Subtracts this color from the background.
- Geom.BLEND_TRANSPARENT_DEPTH = 5
- Transparent, but writing depth so shapes occlude by position.
enum Geom.DiscType
- Geom.DISC_DISC = 0
- Filled circle.
- Geom.DISC_PIE = 1
- Filled circular sector, bounded by the start and end angle.
- Geom.DISC_RING = 2
- Hollow ring.
radiusis to the middle of the wall, not the outer edge. - Geom.DISC_ARC = 3
- A section of a ring, bounded by the start and end angle.
Property descriptions
float angle_end_degrees = 270.0
Sweep end for Pie and Arc. A full turn is promoted to the equivalent unbounded shape, so a 360 degree pie is a disc. The sweep runs forward from the start, wrapping past a full turn, so 350 to 10 is a 20 degree arc across zero.
float angle_start_degrees = 0.0
Sweep start for Pie and Arc, anticlockwise from the +X axis. Degrees here for the inspector's sake; radians everywhere inside the library.
bool arc_end_cap_round = false
Whether an arc's two ends are rounded off.
BlendMode blend_mode = Geom.BLEND_TRANSPARENT
How the shape combines with what is behind it. Transparent Depth is a 3D idea and behaves exactly like Transparent here, a canvas having no depth buffer.
Color color = Color(1, 1, 1, 1)
Fill color, or the wall's color for an outline.
Color color_end = Color(1, 1, 1, 1)
The far end of the gradient. Ignored unless color_mode is something other than Single.
ColorMode color_mode = Geom.COLOR_SINGLE
Single flat color, or a Radial or Angular gradient between color and color_end.
GeomDash dash = null
Assign a GeomDash to dash this shape; leave empty for solid.
DiscType disc_type = Geom.DISC_DISC
Which member of the family: a filled Disc, a Ring outline, a Pie sector, or an Arc.
float radius = 64.0
Center to the shape's edge. For a ring or arc this is to the center of the wall rather than its outer edge, so radius and thickness stay independent of each other.
ThicknessSpace radius_space = Geom.SPACE_METERS
Whether radius is measured in canvas units or in pixels. Canvas units zoom with the view like ordinary 2D content; pixels hold their size on screen through a zoom, which is what a HUD wants. Either way the node's scale multiplies it.
float thickness = 8.0
Wall thickness. Ignored by Disc and Pie, which are solid.
ThicknessSpace thickness_space = Geom.SPACE_METERS
Whether thickness is measured in canvas units or in pixels. Canvas units zoom with the view like ordinary 2D content; pixels hold their size on screen through a zoom, which is what a HUD wants. Either way the node's scale multiplies it.