当前位置:网站首页>SwiftUI 组件大全之使用 ScrollView 和 GeometryReader 创建动画 3D卡片 滚动效果
SwiftUI 组件大全之使用 ScrollView 和 GeometryReader 创建动画 3D卡片 滚动效果
2022-06-23 03:32:00 【知识大胖】
卡片视图

从卡片开始,我们将创建一个带有颜色和数字的结构视图。这些卡片将RoundedRectangles具有填充颜色和一个Text视图,其中数字堆叠在一个ZStack.
我有一个背景属性,RoundedRectangle它采用白色作为视图。这是因为我为CardView不透明度属性值为 0.3 的对象赋予颜色。如果您使用不透明度值为 1.0 的颜色,则不需要背景颜色。
struct CardView: View {
let num : Int
let color : Color
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: 20)
.fill(self.color)
.shadow(color: self.color.opacity(1), radius: 10)
.background(Color.white)
.frame(width: 230, height: 250)
Text("\(self.num)")
.font(.system(size: 35))
.bold()
}
}
}
内容视图
包含我们发送到的ContentView颜色数组CardView。选择您的颜色或创建另一种类型的数组并使用您将在卡片中包含的内容填充它:
var colors = [Color.re边栏推荐
- Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]
- How to generate code-11 barcode in batch through TXT file
- Application of map function in JS
- [quick view] Analysis on the development status and future development trend of the global and Chinese diamond cultivation industry in 2021 [figure]
- Compile your own openwrt firmware using Tencent cloud lightweight application server
- How to generate IATA barcode in batch through TXT file
- JSON. Function of the stringify() optional parameter
- WPF developer essential control library newbeecoder UI —NbMessageBox
- Golang resource embedding scheme
- Wwdc21 - App store server API practice summary
猜你喜欢
![Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]](/img/81/4d3cb059f700dd9243645e64023be7.jpg)
Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]

Analysis on the development of duty-free industry in Hainan Province in 2021: the implementation of the new policy makes the duty-free market in Hainan more "prosperous" [figure]
![Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]](/img/28/ebfc25ec288627706e15a07e6bdb77.jpg)
Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]

Detailed discussion on modular architecture design of MCU firmware

Analysis on the development of China's graphene industry chain in 2021: with the support of energy conservation and environmental protection policies, the scale of graphene industry will continue to e
![Analysis on demand and market scale of China's steamed stuffed bun industry in 2020 [figure]](/img/4b/dd272f98b89a157180bf68570d2763.jpg)
Analysis on demand and market scale of China's steamed stuffed bun industry in 2020 [figure]
![Analysis on the development prospect of China's brain computer interface industry in 2021: wide application prospect, sustained and rapid growth of market scale [figure]](/img/84/192d152ceb760264b6b555b321f129.jpg)
Analysis on the development prospect of China's brain computer interface industry in 2021: wide application prospect, sustained and rapid growth of market scale [figure]

Analysis on the development of China's satellite navigation industry chain in 2021: satellite navigation is fully integrated into production and life, and the satellite navigation industry is also boo

Fetch request details
![Analysis of China's integrated circuit industry chain in 2021: huge downstream market demand [figure]](/img/de/d73805aaf4345ca3d2a7baf85aab8d.jpg)
Analysis of China's integrated circuit industry chain in 2021: huge downstream market demand [figure]
随机推荐
Drill down into handler, looper, messagequeue
Why not use math random() ?!
The MIUI 13 development version of Xiaomi mobile phone blocks the chrome application and cannot be opened after installation
Goframe framework (RK boot): realize distributed log tracing
QUIC or TCP
Online signature with canvas
YouTube security scenarios
Detailed discussion on modular architecture design of MCU firmware
Flink practice tutorial: advanced 7- basic operation and maintenance
JS event bubble and event capture
Compile your own openwrt firmware using Tencent cloud lightweight application server
Encryption related to returnee of national market supervision public service platform
TRTC zero foundation -- Video subscription on the code
Best practices for building multi architecture mirrors
[quick view] Analysis on the development status and future development trend of the global and Chinese diamond cultivation industry in 2021 [figure]
Record an edusrc vulnerability mining
China's economy has entered the stage of "the third mock examination coexisting", and JD and Shopify have jointly arranged global DTC
What are the advantages of the completely free and open source flutter? How to learn about flutter?
1 approved, edit again
Account protection and use scheme