A game no longer writes a host:
- The runtime reads Input itself: focus and keyboard navigation (Tab, arrows, Enter/Space,
autofocus), the pointer (hover, :active, click on release, drag), and scroll boxes with the
wheel, a draggable scrollbar, clipping and scroll-into-view.
- HTML's controls are built in (button, checkbox, radio, range, select, text, key capture), made
of plain parts a stylesheet styles, each reporting with on-change and event.value.
- ludic.ui/render3d.ludic draws with render3d's overlay: textures, named atlases (icon:NAME),
nine-slice border-image, rounded rects and rings, clipping, and a scale.
- Hooks for the program's language, sounds and clock (ui_translator, ui_sounds, ui_clock).
- ui_dev: hot reload, errors on screen, LUDIC_UI_DUMP.
- CSS:
- colours as #rgb / #rrggbbaa / rgb() / rgba() / names;
- border-radius and outline (following the radius), box-shadow, background-image and a tinted
border-image;
- group opacity, @keyframes / animation, transition;
- :focus, :focus-visible and :focus-within.
- HTML mixed content, and boolean attributes.
- render3d gains tex_width / tex_height, and the XML reader keeps text runs in order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.2 KiB
Text
27 lines
1.2 KiB
Text
# ui_anim.ludic — CSS animation and transition on ludic.ui's frame clock (sixty frames a second
|
|
# when the renderer gives no clock of its own): a fade-in from @keyframes, a pulse that loops back
|
|
# and forth, and a transition easing an opacity that changed.
|
|
import "ludic.ui"
|
|
program UiAnim {
|
|
numbers float
|
|
var dim: bool = false
|
|
view Anim {
|
|
dim = dim
|
|
}
|
|
const PAGE: string = "<ui><style>@keyframes fade { from { opacity: 0 } to { opacity: 1 } }\n@keyframes pulse { from { opacity: 1 } to { opacity: 0.5 } }\n.in { animation: fade 1s }\n.beat { animation: pulse 0.5s infinite alternate }\n.soft { transition: opacity 1s }\n.dim { opacity: 0.2 }</style><screen name='a'><p class='in'>a</p><p class='beat'>b</p><p class=\"soft {dim ? 'dim' : ''}\">c</p></screen></ui>"
|
|
function at() -> string {
|
|
ui_show("a", view_anim(), 0.0, 0.0, 200.0, 200.0)
|
|
let r: UiNode = ui_nodes("a", view_anim())
|
|
return `{int(r.children[0].alpha * 100.0)} {int(r.children[1].alpha * 100.0)} {int(r.children[2].alpha * 100.0)}`
|
|
}
|
|
entry {
|
|
ui_load_text(PAGE, "a.xml")
|
|
var out = at()
|
|
for i in 0 .. 29 { at() }
|
|
out = out + " | " + at()
|
|
dim = true
|
|
for i in 0 .. 29 { at() }
|
|
out = out + " | " + at()
|
|
print(out)
|
|
}
|
|
}
|