//
// ViewController.swift
// CoreAniStudy
//
// Created by LIMGAUI on 2022/06/25.
//
import UIKit
class ViewController: UIViewController {
lazy var burgerView = BurgerView(frame: view.bounds)
override func viewDidLoad() {
super.viewDidLoad()
}
}
class BurgerView: UIView {
override func draw(_ rect: CGRect) {
let bread = UIBezierPath(
roundedRect:
CGRect(
x: bounds.width * 0.1,
y: bounds.height * 0.8,
width: bounds.width * 0.8,
height: bounds.height * 0.1),
cornerRadius: 5)
bread.lineWidth = 5
UIColor.systemBrown.set()
bread.stroke()
let pati = UIBezierPath()
pati.lineWidth = 20
pati.lineCapStyle = .round
pati.move(to: CGPoint(x: bounds.width * 0.1, y: bounds.height * 0.7))
pati.addLine(to: CGPoint(x: bounds.width * 0.9, y: bounds.height * 0.7))
pati.stroke()
let yangsangchu = UIBezierPath()
UIColor.systemGreen.set()
yangsangchu.lineWidth = 10
yangsangchu.lineCapStyle = .round
yangsangchu.move(to: CGPoint(x: bounds.width * 0.1, y: bounds.height * 0.6))
var width: CGFloat = 0.2
for i in 0...7 {
if i % 2 == 0 {
yangsangchu.addQuadCurve(to: CGPoint(x: bounds.width * width, y: bounds.height * 0.6),
controlPoint: CGPoint(x: bounds.width * (width - 0.05), y: bounds.height * 0.65))
} else {
yangsangchu.addQuadCurve(to: CGPoint(x: bounds.width * width, y: bounds.height * 0.6),
controlPoint: CGPoint(x: bounds.width * (width - 0.05), y: bounds.height * 0.55))
}
width += 0.1
}
yangsangchu.stroke()
let tomato = UIBezierPath()
UIColor.systemRed.set()
tomato.lineWidth = 15
tomato.move(to: CGPoint(x: bounds.width * 0.1, y: bounds.height * 0.5))
tomato.addLine(to: CGPoint(x: bounds.width * 0.45, y: bounds.height * 0.5))
tomato.move(to: CGPoint(x: bounds.width * 0.55, y: bounds.height * 0.5))
tomato.addLine(to: CGPoint(x: bounds.width * 0.9, y: bounds.height * 0.5))
tomato.stroke()
let sauce = UIBezierPath()
sauce.lineWidth = 3
UIColor.systemOrange.set()
sauce.move(to: CGPoint(x: <#T##Int#>, y: <#T##Int#>))
sauce.stroke()
}
}

'iOS' 카테고리의 다른 글
기술스택(RxSwift, SwiftUI, UIkit) 고민 (0) | 2022.07.03 |
---|---|
[iOS] ♻️ Localization(지역화) 가능한 요소 구현해보기 (0) | 2022.06.29 |
[작성중] CoreData 2편(Update&Delete 코드 구현) (0) | 2022.06.27 |
[iOS] CoreData 1편(Create&Read 코드 구현) (0) | 2022.06.27 |
[iOS] Core Animation (feat. Layer, CABasicAnimation) (0) | 2022.06.21 |