-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathScrollTransitionsView.swift
44 lines (41 loc) · 1.41 KB
/
ScrollTransitionsView.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
36
37
38
39
40
41
42
43
44
//
// ContentView.swift
// ScrollTransitions
//
// Created by Ganesh on 16/06/23.
//
import SwiftUI
struct ScrollTransitionsView: View {
var body: some View {
ScrollView{
ForEach(0..<20,id: \.self){_ in
ZStack{
RoundedRectangle(cornerRadius: 20)
.fill(LinearGradient(colors: [.color1,.color2,.color3], startPoint: .topLeading, endPoint: .bottomTrailing))
.shadow(color: .color3, radius: 10)
RoundedRectangle(cornerRadius: 20)
.fill(.black)
.padding(5)
.overlay(
Image(uiImage: .visionPro)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 200, height: 200)
.clipShape(Circle())
.shadow(color: .gray, radius: 10)
)
}
.padding(.horizontal,20)
.frame(maxWidth: .infinity)
.frame(height: 250)
.scrollTransition { View, transition in
View.opacity(transition.isIdentity
? 1 : 0.3)
}
}
}
}
}
#Preview {
ScrollTransitionsView()
}