Skip to content

Instantly share code, notes, and snippets.

View JaydenIrwin's full-sized avatar
🏠
Working from home

Jayden Irwin JaydenIrwin

🏠
Working from home
View GitHub Profile
@JaydenIrwin
JaydenIrwin / AnimatedWaveText.swift
Created May 15, 2020 17:11
The characters in the string "do the wave"!
import SwiftUI
struct FloatEffect: GeometryEffect {
var animatableData: CGFloat
func effectValue(size: CGSize) -> ProjectionTransform {
ProjectionTransform(CGAffineTransform(translationX: 0, y: sin(animatableData) * 12))
}
}
@JaydenIrwin
JaydenIrwin / rounded_polygon_path
Last active March 8, 2018 02:14 — forked from jonasreinsch/rounded_polygon_path
function to create a UIBezierPath for a (rounded corner) polygon in Swift
// this is a port from the following Objective C code
// http://stackoverflow.com/a/24770675/1269132
func roundedPolygonPath(squareLength: CGFloat, lineWidth: CGFloat, sides: Int, cornerRadius: CGFloat) -> UIBezierPath {
let path = UIBezierPath()
// how much to turn at every corner
let theta = 2.0 * CGFloat.pi / CGFloat(sides)
// offset from which to start rounding corners
let offset = cornerRadius * tan(theta / 2.0)
let sideLength: CGFloat = {