Shadow
Shadow gives an element a soft drop shadow that follows its corner radius. Set it on the element's .custom field.
Example
static void raised_card(void) {
Column("Card", .layout = { .padding = PadAll(16) },
.backgroundColor = ColorHex(0x2A2D34),
.cornerRadius = RadiusAll(8),
.custom = Shadow(.offset = { 0, 4 }, .blur = 12)) {
Text("Floating above the page");
}
}
Reference
| Name | Form | What it does | Page |
|---|---|---|---|
Shadow | .custom = Shadow(.offset, .blur, .spread, .color) | Drop shadow behind an element, following its .cornerRadius. Default color Color(0,0,0,64). Can't share an element with a Draw callback. | Styling |
CC_ShadowOpts | struct { CC_Vector2 offset; float blur; float spread; CC_Color color; } | Fields for Shadow. | Styling |
CC_Shadow | CC_CustomElementConfig (CC_ShadowOpts opts) | What Shadow calls. | |
CC_ShadowSlot, CC_SHADOW_TAG, CC_SHADOW_POOL_SIZE | Pool entry, its render tag (-2), and pool size (128 per frame). For custom renderers. | Styling |