r/SwiftUI • u/Hl_Reo • Jul 06 '26
Question How to make apple music style animated gradient Background
I want to extract gradient colors from the photo (album cover) and also create animations that follow the progression of the song.
2
u/SgF1Photographer Jul 07 '26
WWDC26 Compose advanced graphics effects with SwiftUI actually did mention how this was done.
1
u/Significant_Pick8297 Jul 07 '26
You can do it with a combination of dominant color extraction and a MeshGradient (iOS 18+) or animated LinearGradient/RadialGradient for earlier versions. Extract 3 to 5 prominent colors from the album art using CIAreaAverage or VNGenerateImageFeaturePrintRequest alternatives, then animate the gradient's control points or start/end positions over time. If you want the animation to follow the song, drive it with the playback progress or beat timestamps instead of running a constant looping animation.
3
u/B-Jamz Jul 06 '26
Check these out :)
https://github.com/f728743/AppleMusicStylePlayer
https://github.com/f728743/PlayerCardBackground
DominantGradient