where goo wins¶
things goo makes easy by removing the need for markup and stylesheets
color from data¶
goo:
new Container
{
BackgroundColor = Color.Lerp(Color.Green, Color.Red, 1f - hp / maxHp),
}
- razor + scss: lerp lives in
@code, bound viastyle="background-color: @LerpedColor.Hex"or a css custom property. - goo: typed
Color, assigned in place. no markup split, no string round-trip.
radial selection wheel¶
goo (Code/Demo/RadialWheelUI.cs):
for (int i = 0; i < SlotCount; i++)
{
float theta = i * MathF.Tau / SlotCount - MathF.PI / 2f;
float cx = WheelSize / 2f + MathF.Cos(theta) * LabelRadius;
float cy = WheelSize / 2f + MathF.Sin(theta) * LabelRadius;
wheel.Children.Add(new Container
{
Key = $"label-{i}",
Position = PositionMode.Absolute,
Left = cx - LabelBox / 2f,
Top = cy - LabelBox / 2f,
Width = LabelBox,
Height = LabelBox,
Children = { new Text(Labels[i]) },
});
}
- razor + scss:
@forover markup, position values inline-bound instyle="...", sibling scss forposition: absolute. - goo: typed
Lengthvalues, init-property block, no@code/ markup split.
more examples to be filled in