Food App UI Animation IOS
1.0.0
Uplabs / Dribbble / Behance에서 디자인을보십시오
1 단계 : 다음 또는 이전 화살표 아이콘을 사용하여 애니메이션 음식 목록보기
@IBAction func btnClickNext(_ sender: UIButton)
{
if isanimate == true
{
isanimate = false
UIView.animate(withDuration: 1, delay: 0, options: .curveLinear, animations: {
self.imgBurger?.transform = CGAffineTransform(scaleX: 0.001, y: 0.001)
self.imgBurgername?.transform = CGAffineTransform(scaleX: 0.001, y: 0.001)
self.lblPrice?.transform = CGAffineTransform(scaleX: 0.001, y: 0.001)
}, completion: { _ in
self.imgBurger?.transform = CGAffineTransform(scaleX: 0.0, y: 0.0)
self.imgBurger?.image = UIImage(named: "burger")
self.imgBurgername?.transform = CGAffineTransform(scaleX: 0.0, y: 0.0)
self.imgBurgername?.image = UIImage(named: "burgername")
self.lblPrice?.transform = CGAffineTransform(scaleX: 0.0, y: 0.0)
self.lblPrice?.text = "12.99 $"
UIView.animate(withDuration: 1, delay: 0, options: .curveLinear, animations: {
self.imgBurger?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
self.imgBurgername?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
self.lblPrice?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
}, completion: nil)
})
let screenRect: CGRect = UIScreen.main.bounds
var _: CGFloat = screenRect.size.width
UIView.animate(withDuration: 1, delay: 0, options: .curveEaseInOut, animations: {
self.lbltitle?.frame = CGRect(x: screenRect.size.width, y: (self.lbltitle?.frame.origin.y)!, width: (self.lbltitle?.frame.size.width)!, height: (self.lbltitle?.frame.size.height)!)
self.lblSubtitle?.frame = CGRect(x: screenRect.size.width, y: (self.lblSubtitle?.frame.origin.y)!, width: (self.lblSubtitle?.frame.size.width)!, height: (self.lblSubtitle?.frame.size.height)!)
}) { finished in
//position screen left after animation
self.lbltitle?.frame = CGRect(x: -screenRect.size.width, y: (self.lbltitle?.frame.origin.y)!, width: (self.lbltitle?.frame.size.width)!, height: (self.lbltitle?.frame.size.height)!)
self.lblSubtitle?.frame = CGRect(x: -screenRect.size.width, y: (self.lblSubtitle?.frame.origin.y)!, width: (self.lblSubtitle?.frame.size.width)!, height: (self.lblSubtitle?.frame.size.height)!)
// Converted to Swift 4 by Swiftify v4.2.28558 - https://objectivec2swift.com/
UIView.animate(withDuration: 1, delay: 0, options: .curveEaseInOut, animations: {
self.lbltitle?.frame = CGRect(x: self.view.center.x - (self.lbltitle!.frame.size.width/2) , y: (self.lbltitle?.frame.origin.y)!, width: self.lbltitle!.frame.size.width, height: self.lbltitle!.frame.size.height)
self.lblSubtitle?.frame = CGRect(x: self.view.center.x - (self.lblSubtitle!.frame.size.width/2) , y: (self.lblSubtitle?.frame.origin.y)!, width: self.lblSubtitle!.frame.size.width, height: self.lblSubtitle!.frame.size.height)
// self.lbltitle?.center = self.view.center
}) { finished in
//do something after animation
}
}
}
else
{
isanimate = true
UIView.animate(withDuration: 1, delay: 0, options: .curveLinear, animations: {
self.imgBurger?.transform = CGAffineTransform(scaleX: 0.001, y: 0.001)
self.imgBurgername?.transform = CGAffineTransform(scaleX: 0.001, y: 0.001)
self.lblPrice?.transform = CGAffineTransform(scaleX: 0.001, y: 0.001)
}, completion: { _ in
self.imgBurger?.transform = CGAffineTransform(scaleX: 0.0, y: 0.0)
self.imgBurger?.image = UIImage(named: "burger")
self.imgBurgername?.transform = CGAffineTransform(scaleX: 0.0, y: 0.0)
self.imgBurgername?.image = UIImage(named: "burgername")
self.lblPrice?.transform = CGAffineTransform(scaleX: 0.0, y: 0.0)
self.lblPrice?.text = "12.99 $"
UIView.animate(withDuration: 1, delay: 0, options: .curveLinear, animations: {
self.imgBurger?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
self.imgBurgername?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
self.lblPrice?.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
}, completion: nil)
})
let screenRect: CGRect = UIScreen.main.bounds
var _: CGFloat = screenRect.size.width
UIView.animate(withDuration: 1, delay: 0, options: .curveEaseInOut, animations: {
self.lbltitle?.frame = CGRect(x: screenRect.size.width, y: (self.lbltitle?.frame.origin.y)!, width: (self.lbltitle?.frame.size.width)!, height: (self.lbltitle?.frame.size.height)!)
self.lblSubtitle?.frame = CGRect(x: screenRect.size.width, y: (self.lblSubtitle?.frame.origin.y)!, width: (self.lblSubtitle?.frame.size.width)!, height: (self.lblSubtitle?.frame.size.height)!)
}) { finished in
//position screen left after animation
self.lbltitle?.frame = CGRect(x: -screenRect.size.width, y: (self.lbltitle?.frame.origin.y)!, width: (self.lbltitle?.frame.size.width)!, height: (self.lbltitle?.frame.size.height)!)
self.lblSubtitle?.frame = CGRect(x: -screenRect.size.width, y: (self.lblSubtitle?.frame.origin.y)!, width: (self.lblSubtitle?.frame.size.width)!, height: (self.lblSubtitle?.frame.size.height)!)
// Converted to Swift 4 by Swiftify v4.2.28558 - https://objectivec2swift.com/
UIView.animate(withDuration: 1, delay: 0, options: .curveEaseInOut, animations: {
self.lbltitle?.frame = CGRect(x: self.view.center.x - (self.lbltitle!.frame.size.width/2) , y: (self.lbltitle?.frame.origin.y)!, width: self.lbltitle!.frame.size.width, height: self.lbltitle!.frame.size.height)
self.lblSubtitle?.frame = CGRect(x: self.view.center.x - (self.lblSubtitle!.frame.size.width/2) , y: (self.lblSubtitle?.frame.origin.y)!, width: self.lblSubtitle!.frame.size.width, height: self.lblSubtitle!.frame.size.height)
// self.lbltitle?.center = self.view.center
}) { finished in
//do something after animation
}
}
}
}
2 단계 : 특정 음식에 추가 된 좋아하는 토핑에 대한 애니메이션 및 일러스트보기보기
@IBAction func btnClickCrack(_ sender: UIButton)
{
UIView.animate(withDuration: 2, delay: 0, options: [.curveEaseIn], animations: {
self.imgVegetable?.center.y = (self.imgBurger?.frame.origin.y)! + ((self.imgBurger?.frame.height)!/2)
self.imgVegetable?.isHidden = false
self.loadViewIfNeeded()
}) { finished in
self.imgVegetable?.breakGlass(size: GridSize(columns: 15, rows: 21), completion: {
// self.reshowImage()
})
}
}
귀하가 우리의 구성 요소를 사용하는 프로젝트에 대한 링크를 우리에게 보내면 정말 기뻐할 것입니다. [email protected]으로 이메일을 보내고 iOS의 Food App UI 애니메이션에 관한 질문이나 제안이 있으면 알려주십시오.
추신 : 우리는 모든 기술에서 타사 라이브러리, 코딩 표준, 플러그인 등에 더 큰 예를 게시 할 것입니다. 계속 지켜봐!
몇 가지 포트폴리오 링크를 방문하여 작업에 더 익숙해 지십시오.
포트폴리오 | 페이스 북 | 트위터 | LinkedIn | Behance | Instagram | dribbble | 고갈
그들을 따르는 것을 잊지 마십시오.
MIT License
Copyright © 2019 CMARIX TechnoLabs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.