lengthen Now Playing gradient animation + standardize anim durations
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/cenkalti/dominantcolor"
|
"github.com/cenkalti/dominantcolor"
|
||||||
"github.com/dweymouth/supersonic/backend"
|
"github.com/dweymouth/supersonic/backend"
|
||||||
@@ -321,7 +320,7 @@ func (a *NowPlayingPage) onImageLoaded(img image.Image, err error) {
|
|||||||
// despite not being marked as such
|
// despite not being marked as such
|
||||||
// TODO: if this changes, use fyne.Do
|
// TODO: if this changes, use fyne.Do
|
||||||
anim := canvas.NewColorRGBAAnimation(
|
anim := canvas.NewColorRGBAAnimation(
|
||||||
a.background.StartColor, c, 75*time.Millisecond, func(c color.Color) {
|
a.background.StartColor, c, myTheme.AnimationDurationMedium, func(c color.Color) {
|
||||||
a.background.StartColor = c
|
a.background.StartColor = c
|
||||||
a.background.Refresh()
|
a.background.Refresh()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import (
|
|||||||
"github.com/dweymouth/supersonic/ui/widgets"
|
"github.com/dweymouth/supersonic/ui/widgets"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/canvas"
|
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/lang"
|
"fyne.io/fyne/v2/lang"
|
||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
@@ -359,7 +358,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
|||||||
// dismissal animation
|
// dismissal animation
|
||||||
searchEntry.Scroll = container.ScrollNone
|
searchEntry.Scroll = container.ScrollNone
|
||||||
searchEntry.SetPlaceHolder("")
|
searchEntry.SetPlaceHolder("")
|
||||||
fyne.NewAnimation(canvas.DurationShort, func(f float32) {
|
fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||||
f = 1 - f
|
f = 1 - f
|
||||||
w := (200-minW)*f + minW
|
w := (200-minW)*f + minW
|
||||||
searchEntry.SetMinWidth(w)
|
searchEntry.SetMinWidth(w)
|
||||||
@@ -375,7 +374,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
|||||||
buttonRow.Objects[3] = searchEntry
|
buttonRow.Objects[3] = searchEntry
|
||||||
searchEntry.SetMinWidth(minW)
|
searchEntry.SetMinWidth(minW)
|
||||||
fyne.CurrentApp().Driver().CanvasForObject(a).Focus(searchEntry)
|
fyne.CurrentApp().Driver().CanvasForObject(a).Focus(searchEntry)
|
||||||
fyne.NewAnimation(canvas.DurationShort, func(f float32) {
|
fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||||
w := (200-minW)*f + minW
|
w := (200-minW)*f + minW
|
||||||
searchEntry.SetMinWidth(w)
|
searchEntry.SetMinWidth(w)
|
||||||
// re-layout container (without unneeded full refresh)
|
// re-layout container (without unneeded full refresh)
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/dweymouth/supersonic/backend"
|
"github.com/dweymouth/supersonic/backend"
|
||||||
"github.com/dweymouth/supersonic/res"
|
"github.com/dweymouth/supersonic/res"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/canvas"
|
||||||
"fyne.io/fyne/v2/theme"
|
"fyne.io/fyne/v2/theme"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,6 +32,10 @@ const (
|
|||||||
SizeNameSubSubHeadingText fyne.ThemeSizeName = "subSubHeadingText" // in between Text and SubHeadingText
|
SizeNameSubSubHeadingText fyne.ThemeSizeName = "subSubHeadingText" // in between Text and SubHeadingText
|
||||||
SizeNameSubText fyne.ThemeSizeName = "subText" // in between Text and Caption
|
SizeNameSubText fyne.ThemeSizeName = "subText" // in between Text and Caption
|
||||||
SizeNameSuffixText fyne.ThemeSizeName = "suffixText" // a tiny bit smaller than subText
|
SizeNameSuffixText fyne.ThemeSizeName = "suffixText" // a tiny bit smaller than subText
|
||||||
|
|
||||||
|
AnimationDurationShort = canvas.DurationShort
|
||||||
|
AnimationDurationMedium = 225 * time.Millisecond
|
||||||
|
AnimationDurationLong = canvas.DurationStandard
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
+2
-1
@@ -12,13 +12,14 @@ import (
|
|||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
"fyne.io/fyne/v2/theme"
|
"fyne.io/fyne/v2/theme"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
|
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||||
"github.com/dweymouth/supersonic/ui/util"
|
"github.com/dweymouth/supersonic/ui/util"
|
||||||
"github.com/dweymouth/supersonic/ui/widgets"
|
"github.com/dweymouth/supersonic/ui/widgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
toastAutoDismissalTime = 3 * time.Second
|
toastAutoDismissalTime = 3 * time.Second
|
||||||
toastAnimationDuration = 100 * time.Millisecond
|
toastAnimationDuration = myTheme.AnimationDurationShort
|
||||||
)
|
)
|
||||||
|
|
||||||
type ToastOverlay struct {
|
type ToastOverlay struct {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
"slices"
|
"slices"
|
||||||
"time"
|
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
@@ -200,7 +199,7 @@ func (a *coverImage) MouseIn(*desktop.MouseEvent) {
|
|||||||
a.updateFavoriteIcon(false)
|
a.updateFavoriteIcon(false)
|
||||||
|
|
||||||
firstTick := true
|
firstTick := true
|
||||||
a.mouseInAnim = fyne.NewAnimation(225*time.Millisecond, func(f float32) {
|
a.mouseInAnim = fyne.NewAnimation(myTheme.AnimationDurationMedium, func(f float32) {
|
||||||
a.playbtn.Hidden = false
|
a.playbtn.Hidden = false
|
||||||
a.favoriteButton.Hidden = !a.EnableFavorite
|
a.favoriteButton.Hidden = !a.EnableFavorite
|
||||||
a.bottomPanel.Hidden = false
|
a.bottomPanel.Hidden = false
|
||||||
@@ -235,7 +234,7 @@ func (a *coverImage) MouseOut() {
|
|||||||
a.mouseInAnim.Stop()
|
a.mouseInAnim.Stop()
|
||||||
a.mouseInAnim = nil
|
a.mouseInAnim = nil
|
||||||
}
|
}
|
||||||
gridViewMouseOutAnim = fyne.NewAnimation(canvas.DurationShort, func(f float32) {
|
gridViewMouseOutAnim = fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||||
t := 1 - f
|
t := 1 - f
|
||||||
setPlayBtnTranslucency(t * float32(playBtnOpacity))
|
setPlayBtnTranslucency(t * float32(playBtnOpacity))
|
||||||
a.moreButton.Translucency = float64(f)
|
a.moreButton.Translucency = float64(f)
|
||||||
@@ -265,7 +264,7 @@ func (a *coverImage) MouseMoved(e *desktop.MouseEvent) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if in {
|
if in {
|
||||||
fyne.NewAnimation(canvas.DurationShort, func(f float32) {
|
fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||||
t := (1-playBtnOpacity)*f + playBtnOpacity
|
t := (1-playBtnOpacity)*f + playBtnOpacity
|
||||||
setPlayBtnTranslucency(t)
|
setPlayBtnTranslucency(t)
|
||||||
delta := playBtnHoveredSize.Subtract(playBtnSize)
|
delta := playBtnHoveredSize.Subtract(playBtnSize)
|
||||||
@@ -273,7 +272,7 @@ func (a *coverImage) MouseMoved(e *desktop.MouseEvent) {
|
|||||||
a.playbtn.Refresh()
|
a.playbtn.Refresh()
|
||||||
}).Start()
|
}).Start()
|
||||||
} else {
|
} else {
|
||||||
fyne.NewAnimation(canvas.DurationShort, func(f float32) {
|
fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||||
t := 1 - (1-playBtnOpacity)*f
|
t := 1 - (1-playBtnOpacity)*f
|
||||||
setPlayBtnTranslucency(t)
|
setPlayBtnTranslucency(t)
|
||||||
delta := playBtnHoveredSize.Subtract(playBtnSize)
|
delta := playBtnHoveredSize.Subtract(playBtnSize)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
|
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -41,7 +42,7 @@ func (i *ImagePopUp) Show() {
|
|||||||
canvSize.Width/2,
|
canvSize.Width/2,
|
||||||
canvSize.Height/2,
|
canvSize.Height/2,
|
||||||
))
|
))
|
||||||
anim := fyne.NewAnimation(canvas.DurationShort, func(f float32) {
|
anim := fyne.NewAnimation(myTheme.AnimationDurationShort, func(f float32) {
|
||||||
if f == 1 {
|
if f == 1 {
|
||||||
i.Content.(*canvas.Image).ScaleMode = canvas.ImageScaleSmooth
|
i.Content.(*canvas.Image).ScaleMode = canvas.ImageScaleSmooth
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user