generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💫 :: [#87] ConfirmationDialog / Dialog 등장 시 Animation
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Projects/Feature/ConfirmationDialogFeature/Sources/Scene/Anim/ModalAnim.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Anim | ||
import UIKit | ||
|
||
struct ModalAnim: Anim { | ||
func animate(view: UIView, completion: @escaping () -> Void) { | ||
let scaleAffineTransform = CGAffineTransform(scaleX: 0.8, y: 0.8) | ||
|
||
let transformFrom = view.transform | ||
let transformTo = view.transform.concatenating(scaleAffineTransform) | ||
UIView.performWithoutAnimation { | ||
view.transform = transformTo | ||
} | ||
|
||
let springTimingParameters = UISpringTimingParameters( | ||
mass: 0.2, | ||
stiffness: 98.4, | ||
damping: 4.95, | ||
initialVelocity: .init(dx: 0, dy: 0) | ||
) | ||
let animator = UIViewPropertyAnimator(duration: 0.2, timingParameters: springTimingParameters) | ||
animator.addAnimations { | ||
view.transform = transformFrom | ||
} | ||
animator.addCompletion { _ in | ||
completion() | ||
} | ||
animator.startAnimation() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters