add shape picker for backgrounds

This commit is contained in:
Trey t
2022-03-20 02:45:51 -05:00
parent d064cdb3d9
commit 36a688084c
14 changed files with 247 additions and 91 deletions

View File

@@ -0,0 +1,31 @@
//
// DiamondView.swift
// Feels
//
// Created by Trey Tartt on 3/20/22.
//
import SwiftUI
struct Diamond:Shape {
func path(in rect: CGRect) -> Path {
var path = Path()
// get the center of the rect
let center = CGPoint(x: rect.midX, y: rect.midY)
// get the starting of our drawing the right side of our diamond
let startingPoint = CGPoint(x: rect.maxX, y: center.y)
// move our start of drawing to the beggining point
path.move(to: startingPoint)
// distance / 2 is our height
// create all our points
let secondPoint = CGPoint(x: center.x, y: rect.maxY)
let thirdPoint = CGPoint(x: rect.minX , y: center.y)
let fourthPoint = CGPoint(x: center.x, y: rect.minY)
path.addLine(to: secondPoint)
path.addLine(to: thirdPoint)
path.addLine(to: fourthPoint)
path.addLine(to: startingPoint)
return path
}
}