on master help sign in
Animate button shadow when transitioning from disabled to enabled
commit10b423c8fb3d7c46e8574c09942aeb2e899cd79c authoriko <mail@iko.soy> dateSun 19 Apr 2026, 20:39 (6 months ago) parentf8f0401
1 file changed+4
client/Buttons.fs+4
client/Buttons.fs+4
@@ -37,9 +37,13 @@ module Buttons =
3737 let private textButton fontSize pressOffset restOffset margin priority (text: string) (msg: 'msg) disabled =
3838 Component($"{text}-{disabled}") {
3939 let! pressed = Context.State(false)
40+ let! animatedIn = Context.State(false)
4041
4142 let offset =
4243 if disabled then 0.
44+ elif not animatedIn.Current then
45+ Avalonia.Threading.Dispatcher.UIThread.Post(fun () -> animatedIn.Set true)
46+ 0.
4347 elif pressed.Current then pressOffset
4448 else restOffset
4549