Skip to content

Instantly share code, notes, and snippets.

@muhammadabbas001
Last active November 20, 2023 11:52
Show Gist options
  • Save muhammadabbas001/d0164f3281b75a0abdb4928ec99e8c08 to your computer and use it in GitHub Desktop.
Save muhammadabbas001/d0164f3281b75a0abdb4928ec99e8c08 to your computer and use it in GitHub Desktop.
ZStack {
ForEach(0..<views.count) { i in
self.views[i]
.frame(width: 300, height: getHeight(i))
.animation(.interpolatingSpring(stiffness: 300, damping: 30, initialVelocity: 10))
.background(.white)
.cornerRadius(15)
.opacity(getOpacity(i))
.offset(x: getOffset(i))
.animation(.interpolatingSpring(stiffness: 300, damping: 30, initialVelocity: 10))
}
}
.gesture(
DragGesture()
.updating($dragState) { drag, state, transaction in
state = .dragging(translation: drag.translation)
}
.onEnded(onDragEnded)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment