# 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 state UiAnimState { dim: bool = false } view Anim (ui_anim_st: UiAnimState) { dim = ui_anim_st.dim } const PAGE: string = "

a

b

c

" function at(ui_st: mut UiState) -> string { ui_show(ui_st, "a", view_anim(), 0.0, 0.0, 200.0, 200.0) let r: UiNode = ui_nodes(ui_st, "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_anim_st: mut UiAnimState, ui_st: mut UiState) { ui_load_text(ui_st, PAGE, "a.xml") var out = at(ui_st) for i in 0 .. 29 { at(ui_st) } out = out + " | " + at(ui_st) ui_anim_st.dim = true for i in 0 .. 29 { at(ui_st) } out = out + " | " + at(ui_st) print(out) } }