Animated Card
A card component with smooth animations and hover effects

Preview

Code
1import SwiftUI23struct AnimatedCardView: View {4 @State private var isHovered = false5 6 var body: some View {7 VStack(alignment: .leading, spacing: 12) {8 Rectangle()9 .fill(LinearGradient(10 colors: [.blue, .purple],11 startPoint: .topLeading,12 endPoint: .bottomTrailing13 ))14 .frame(height: 120)15 .cornerRadius(12)16 17 VStack(alignment: .leading, spacing: 8) {18 Text("Animated Card")19 .font(.headline)20 .fontWeight(.semibold)21 22 Text("Beautiful card with smooth animations")23 .font(.caption)24 .foregroundColor(.secondary)25 }26 }27 .padding(16)28 .background(Color(.systemBackground))29 .cornerRadius(16)30 .shadow(31 color: .black.opacity(isHovered ? 0.2 : 0.1),32 radius: isHovered ? 20 : 10,33 x: 0,34 y: isHovered ? 10 : 535 )36 .scaleEffect(isHovered ? 1.05 : 1.0)37 .animation(.spring(response: 0.3), value: isHovered)38 .onHover { hovering in39 isHovered = hovering40 }41 }42}4344struct AnimatedCardView_Previews: PreviewProvider {45 static var previews: some View {46 AnimatedCardView()47 .padding()48 }49}