@@ -142,7 +142,7 @@ extension CollectionViewCellTransitioning {
142142 }
143143
144144 /// Present, Dismiss 때 사용되는 애니메이션
145- private func makeExpandContractAnimator ( of thumbnailView: ThumbnailView , in containerView: UIView , to frame: CGRect ) -> UIViewPropertyAnimator {
145+ private func makeScaleAndPositionAnimator ( of thumbnailView: ThumbnailView , in containerView: UIView , to frame: CGRect ) -> UIViewPropertyAnimator {
146146 /// 애니메이션 설정
147147 let springTiming = UISpringTimingParameters ( dampingRatio: 0.75 , initialVelocity: CGVector ( dx: 0 , dy: 2 ) )
148148 let animator = UIViewPropertyAnimator ( duration: transitionDuration - shrinkDuration, timingParameters: springTiming)
@@ -181,22 +181,25 @@ extension CollectionViewCellTransitioning {
181181
182182 private func moveAndConvert( thumbnailView: ThumbnailView , containerView: UIView , to frame: CGRect , completion: @escaping ( ) -> Void ) {
183183 let shrinkAnimator = makeShrinkAnimator ( of: thumbnailView)
184- let expandContractAnimator = makeExpandContractAnimator ( of: thumbnailView, in: containerView, to: frame)
184+ let scaleAndPositionAnimator = makeScaleAndPositionAnimator ( of: thumbnailView, in: containerView, to: frame)
185185
186186 switch transition {
187187 case . present:
188188 shrinkAnimator. startAnimation ( )
189189
190+ /// 축소 애니메이션 종료 후 확대 애니메이션
190191 shrinkAnimator. addCompletion { _ in
191- expandContractAnimator . startAnimation ( )
192+ scaleAndPositionAnimator . startAnimation ( )
192193 }
193194
194195 case . dismiss:
196+ /// 썸네일 뷰의 위치를 먼저 잡고 축소 애니메이션
195197 thumbnailView. layoutIfNeeded ( )
196- expandContractAnimator . startAnimation ( )
198+ scaleAndPositionAnimator . startAnimation ( )
197199 }
198200
199- expandContractAnimator. addCompletion { _ in
201+ /// 크기, 위치 애니메이션 종료 후
202+ scaleAndPositionAnimator. addCompletion { _ in
200203 completion ( )
201204 }
202205 }
0 commit comments