-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathScrollTransitionView.swift
35 lines (32 loc) · 1.19 KB
/
ScrollTransitionView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// ContentView.swift
// ScrollTransition
//
// Created by Ganesh on 16/06/23.
//
import SwiftUI
struct ScrollTransitionView: View {
var body: some View {
ScrollView(.vertical){
VStack(spacing: 10){
ForEach(1..<30,id: \.self){ index in
Text("Cell \(index)")
.frame(maxWidth: .infinity)
.frame(height: 200)
.cornerRadius(20)
.foregroundColor(.white)
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 10))
.overlay(.white.opacity(0.5), in: RoundedRectangle(cornerRadius: 10).stroke(style: .init()))
.padding(.horizontal,20)
.scrollTransition { emptyVisualEffect, scrollTransitionPhase in
emptyVisualEffect.scaleEffect(scrollTransitionPhase.isIdentity ? 1 : 0.8)
}
}
}
}
.background(LinearGradient(gradient: Gradient(colors: [.pink, .green,.blue]), startPoint: .topLeading, endPoint: .bottomTrailing))
}
}
#Preview {
ScrollTransitionView()
}