Style2D#
A shared 2D style datablock: how a quad, sprite or panel is drawn by the canvas's distance shader. Colours are #RRGGBB; distances are world units. A rounded rectangle is the shape's signed distance, so Radius, StrokeWidth, GlowRadius, the shadow and Expand all follow from it; a sprite's own alpha still cuts its fill. Editing a style changes every use at once.
public sealed record Style2D(string Id, string Name)Record properties#
| Property | Type | Access | Constructor default |
|---|---|---|---|
Id | string | get; init; | required |
Name | string | get; init; | required |
Members: Expand · Fill · FillEnd · Glow · GlowOpacity · GlowRadius · GradientAngle · Margin · Mask · MaskSpriteId · Opacity · Radius · Shadow · ShadowBlur · ShadowOpacity · ShadowX · ShadowY · Stroke · StrokeOpacity · StrokeWidth
Expand#
public float Expand { get; init; }Grows (positive) or shrinks (negative) the shape by this many world units.
Fill#
public string Fill { get; init; }Initial value: "#FFFFFF"
FillEnd#
public string? FillEnd { get; init; }When set, the fill grades from Fill to this colour along GradientAngle.
Glow#
public string Glow { get; init; }Initial value: "#FFFFFF"
GlowOpacity#
public float GlowOpacity { get; init; }Initial value: 1
GlowRadius#
public float GlowRadius { get; init; }GradientAngle#
public float GradientAngle { get; init; }Initial value: 90
Degrees; 90 grades bottom to top, 0 left to right.
Margin#
public float Margin { get; }How far beyond the quad the style draws (shadow, glow, half the stroke, expand), in world units.
Mask#
[System.Text.Json.Serialization.JsonIgnore]
public SpritePixels? Mask { get; init; }MaskSpriteId#
public string? MaskSpriteId { get; init; }A sprite whose alpha, stretched over the element's rectangle (or a label's frame), multiplies everything the style draws: a soft vignette, a shaped fill, a fade. Stored by ID; Mask is the resolved pixels.
Opacity#
public float Opacity { get; init; }Initial value: 1
Radius#
public float Radius { get; init; }Corner radius in world units (half the smaller side makes a circle or pill).
Shadow#
public string Shadow { get; init; }Initial value: "#000000"
ShadowBlur#
public float ShadowBlur { get; init; }ShadowOpacity#
public float ShadowOpacity { get; init; }ShadowX#
public float ShadowX { get; init; }ShadowY#
public float ShadowY { get; init; }Stroke#
public string Stroke { get; init; }Initial value: "#000000"
StrokeOpacity#
public float StrokeOpacity { get; init; }Initial value: 1
StrokeWidth#
public float StrokeWidth { get; init; }Related types#
Source#
- RuntimeWorld.cs