我想创建一个无限的DragGesture水平滚动,其中水平虚线根据您的手势速度进行无限滚动,这会增加其上方的文本数。
struct ContentView: View {
var body: some View {
ZStack {
Color(#colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)).edgesIgnoringSafeArea(.all)
VStack(spacing: 10) {
Text("120 BPM")
.font(.system(size: 40, weight: .heavy, design: .rounded))
.foregroundColor(Color(#colorLiteral(red: 0.6000000238, green: 0.6000000238, blue: 0.6000000238, alpha: 1)))
}
Path {path in
path.move(to: CGPoint(x: 0, y: 500))
path.addLine(to: CGPoint(x: screen.width, y: 500))
}
.stroke(style: StrokeStyle.init(lineWidth: 3, lineCap: .square, lineJoin: .bevel, dash: [5,15]))
.foregroundColor(Color.white)
.animation(.easeInOut)
.gesture(
DragGesture().onChanged { value in
}
.onEnded { value in
}
)
}
}
}