internal.PopIn is gone. Breadcrumb, NavigationMenu, Pagination, Menubar panels, CommandPalette, Select (and the other selectPanel users), datetime popups, ColorPicker and the StatusBar overflow now style their panel with overlayStyle(c, panel, overlayEnter(c, panel)): one shadow (0 6 18, 16% black, scaled by entry) and one 160 ms entry fade. Snapshots: color_picker and command_palette (light and dark) change only in the panel shadow. ColorPicker loses its 0 4 12 18% shadow for the softer shared one; CommandPalette loses its heavy 0 12 32 30% shadow, and its backdrop now fades by alpha with the panel instead of through the backdrop's opacity. Fade and reduced-motion tests pass unchanged.
20 lines
559 B
Go
20 lines
559 B
Go
package internal
|
|
|
|
import (
|
|
"math"
|
|
"time"
|
|
|
|
"github.com/egoist/mygo/ui"
|
|
)
|
|
|
|
// Ease moves e's background, border and text color fg to their targets over d.
|
|
func Ease(e *ui.Element, d time.Duration, fg ui.Color) *ui.Element {
|
|
if d > 0 {
|
|
e.Transition(ui.ElementTransition{Colors: true, Duration: d})
|
|
}
|
|
ch := func(key string, v uint8) uint8 {
|
|
return uint8(math.Round(float64(e.Animate(key, float32(v), d))))
|
|
}
|
|
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)})
|
|
}
|