- July 15, 2025
- Mins Read
import AnimatedGradient
struct ContentView: View {
var body: some View {
AnimatedLinearGradient(colors: [.red, .green, .blue])
}
}
import AnimatedGradient
struct ContentView: View {
var body: some View {
AnimatedLinearGradient(colors: [.red, .green, .blue])
.numberOfSimultaneousColors(2)
.setAnimation(.linear(duration: 5))
.gradientPoints(start: .bottomLeading, end: .topTrailing)
}
}
colors
– An array of colors between which the gradient will transitionnumberOfSimultaneousColors(Int)
– Number of colors on screen at any given time, can be more, equal or less than colors in the arraysetAnimation(Animation)
– Animation of the transition of one color to anothergradientPoints(start:end:)
– Standard linear gradient control pointsYou can use preselected colors from GradientPreset for a quick start
To try AnimatedGradient examples:
https://github.com/exyte/AnimatedGradient.git
AnimatedGradientExample.xcodeproj
dependencies: [
.package(url: “https://github.com/exyte/AnimatedGradient.git”)
]