Navigation: review r2 fixes

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 13:04:05 -04:00
1 parent cfdccfec5c
commit 01f5c1ca08
16 files changed
+196 -31

No files matched your search

+12
View File
@@ -17,3 +17,15 @@ func Ease(e *ui.Element, d time.Duration, fg ui.Color) *ui.Element {
}
return e.TextColor(ui.Color{R: ch("mujica.fg.r", fg.R), G: ch("mujica.fg.g", fg.G), B: ch("mujica.fg.b", fg.B), A: ch("mujica.fg.a", fg.A)})
}
// PopIn fades popup e in over d from the frame it appeared and returns the progress, 0 to 1.
func PopIn(c *ui.Context, e *ui.Element, d time.Duration) float32 {
born := ui.Local(e, "mujica.popin", func() time.Time { return c.Now() })
p := float32(1)
if t := float32(c.Now().Sub(*born)) / float32(max(d, 1)); d > 0 && t < 1 {
p = ui.EaseOut(t)
c.AnimationFrame()
}
e.Opacity(p)
return p
}