Skip to content

Commit

Permalink
Prevent contributors counting animation from firing on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
woxtu committed Sep 10, 2024
1 parent 2daf030 commit 32177de
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ struct ContributorsCountItem: View {
}

func animate() {
if tracker >= totalContributor { return }

let interval = duration / Double(totalContributor)
Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { time in
tracker += 1
Expand Down

0 comments on commit 32177de

Please sign in to comment.