Skip to content

Instantly share code, notes, and snippets.

@dkun7944
dkun7944 / ContentView.swift
Created July 31, 2023 03:36
AirDrop iOS 17 Swift.Shader Animation
//
// ContentView.swift
// Airdrop Demo
//
// Created by Daniel Kuntz on 7/30/23.
//
import SwiftUI
struct ContentView: View {
@dkun7944
dkun7944 / CDView.swift
Last active January 14, 2024 23:45
SwiftUI + Swift.Shader CD
//
// CDView.swift
// CD
//
// Created by Daniel Kuntz on 7/3/23.
//
import SwiftUI
struct ShapeWithHole: Shape {
@dkun7944
dkun7944 / UIView+3DFloatingEffect.swift
Last active February 9, 2021 20:19
Extension to add a cool 3D floating effect to any UIView.
extension UIView {
func add3DFloatingEffect(withDepth depth: Double = 1 / 12, duration: Double = 5) {
let depthAngle = depth * .pi
let rotationAnimationY = CABasicAnimation(keyPath: "transform.rotation.y")
rotationAnimationY.fromValue = NSNumber(floatLiteral: -1 * depthAngle)
rotationAnimationY.toValue = NSNumber(floatLiteral: depthAngle)
rotationAnimationY.duration = duration
rotationAnimationY.repeatCount = Float(Int.max)
rotationAnimationY.autoreverses = true
rotationAnimationY.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)