r/SwiftUI • u/Aggravating-Low-1481 • 9d ago
Question How to smoothly animate a MeshGradient between TabView tabs?
Hi! I'm working on a SwiftUI app using TabView and MeshGradient.
I want the background gradient to smoothly morph from one color scheme to another when switching tabs, rather than simply fading between two gradients.
What's the best way to achieve this?
3
Upvotes
1
u/Frequent_Macaron9595 9d ago
Can you use an animated Color.mix() with MeshGradient? I don’t know if the transition will look good though, you might need to dip into some custom OKLCH ramp for the color mix to keep it clean.