2D 그래픽을 그리는데 사용하기 위한 아핀 변환 행렬이다.
UIView.animate(withDuration: 0.5) {
//MARK: - CGAffineTransform(translationX:y:)생성자를 사용하여 ContainerView x,y값 변환
let translate = CGAffineTransform(translationX: 50, y: -100)
self.containerView.transform = translate
}
UIView.animate(withDuration: 0.5) {
//MARK: CGAffineTransform(scale) 생성자를 이용하여 ContainerView를 1.5배 증가
let scale = CGAffineTransform(scaleX: 1.5, y: 1.5)
self.containerView.transform = scale
}
ContainerView가 커지자 버튼이랑 겹치는 현상이 이러나 보기가 싫어지니 한번 바꿔보기로 했다!!
UIView.animate(withDuration: 0.5) {
//MARK: CGAffineTransform(scale) 생성자와 CGAffineTransform(translationX,y)생성자를 결합하여 transform에 반환
let scale = CGAffineTransform(scaleX: 1.5, y: 1.5).concatenating(CGAffineTransform(translationX: 0, y: -100))
self.containerView.transform = scale
}
UIView.animate(withDuration: 0.5) {
//MARK: CGAffineTransform(rotationAngle:) 생성자를 이용하여 View를 180도 회전
let rotate = CGAffineTransform(rotationAngle: .pi)
self.containerView.transform = rotate
}