이전코드
withAnimation(.spring(response: 0.3, dampingFraction: 0.4, blendDuration: 0.5)) {
emailIconBounce.toggle()
}
withAnimation(.spring(response: 0.3, dampingFraction: 0.4, blendDuration: 0.5).delay(0.15)) {
emailIconBounce.toggle()
}
Swift
복사
변경 코드
withAnimation(.spring(response: 0.3, dampingFraction: 0.4, blendDuration: 0.5)) {
emailIconBounce.toggle()
print("DEBUG: \(emailIconBounce)")
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
withAnimation(.spring(response: 0.3, dampingFraction: 0.4, blendDuration: 0.5)) {
emailIconBounce.toggle()
}
}
Swift
복사
왜인지 모르겠지만 .delay 메서드가 들어 먹질 않았다.
추가
Rotating the colors that make up the glow is a small and distinct animation that can delight your users, but prove to be computationally expensive. Hence, it's best to make sure that our color rotating animation does not last longer than 10 seconds.
애니메이션은 컴퓨터적으로 자원을 많이 소모함
10초이상의 컬러 애니메이션은 좋지 않다