animation??

This commit is contained in:
neon443 committed 2026-04-30 10:17:32 +01:00
1 parent 1cbe3d7506
commit b1b0ae0746
1 file changed
+23
@@ -31,6 +31,9 @@ struct EmojiCollectionView: UIViewRepresentable {
func updateUIView(_ uiView: UICollectionView, context: Context) { func updateUIView(_ uiView: UICollectionView, context: Context) {
context.coordinator.hoarder = hoarder context.coordinator.hoarder = hoarder
context.coordinator.edit = edit context.coordinator.edit = edit
if edit {
context.coordinator.spinAnimation()
}
context.coordinator.onRemove = onRemove context.coordinator.onRemove = onRemove
if items != context.coordinator.items || context.coordinator.pack != pack { if items != context.coordinator.items || context.coordinator.pack != pack {
context.coordinator.items = items context.coordinator.items = items
@@ -66,6 +69,7 @@ struct EmojiCollectionView: UIViewRepresentable {
var edit: Bool var edit: Bool
var onRemove: ((String) -> Void)? var onRemove: ((String) -> Void)?
let initDate = Date.now
var layout = UICollectionViewFlowLayout() var layout = UICollectionViewFlowLayout()
init( init(
@@ -148,6 +152,25 @@ struct EmojiCollectionView: UIViewRepresentable {
@objc @objc
func deleteTapped() { func deleteTapped() {
print(UUID()) print(UUID())
spinAnimation()
}
func spinAnimation() {
guard edit else {
UIView.animate(withDuration: 0.1, delay: 0, options: .curveEaseInOut) {
for cell in self.collectionView.visibleCells {
cell.transform = CGAffineTransform.identity
}
}
return
}
UIView.animate(withDuration: 0.1, delay: 0, options: [.curveLinear]) {
for cell in self.collectionView.visibleCells {
cell.transform = CGAffineTransform(rotationAngle: ((sin(self.initDate.timeIntervalSinceNow*20)*4)/360)*2*CGFloat.pi)
}
} completion: { _ in
self.spinAnimation()
}
} }
func collectionView( func collectionView(
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.