Skip to content

Commit

Permalink
✨[feat]: 카로셀 swipe 가중치
Browse files Browse the repository at this point in the history
  • Loading branch information
Byeonjinha committed Jan 2, 2024
1 parent 529bf91 commit dc46eeb
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public struct SnapCarousel<Content: View, T: Identifiable> : View{
})
.onEnded({value in
let offsetX = value.translation.width
let progress = -offsetX / width

//MARK: - 가중치
let progress = (-offsetX / width) * 1.2
let roundIndex = progress.rounded()
currentIndex = max(min(currentIndex + Int(roundIndex),list.count - 1 ), 0 )
currentIndex = index
Expand Down

0 comments on commit dc46eeb

Please sign in to comment.