← Back to the front page Filed
Animated background gradient
LinearGradient(colors: [.purple, .yellow], startPoint: animateGradient ? .topLeading : .bottomLeading, endPoint: animateGradient ? .bottomTrailing : .topTrailing)
.ignoresSafeArea()
.onAppear {
withAnimation(.linear(duration: 10.0).repeatForever(autoreverses: true)) {
animateGradient.toggle()
}
}
■