Skip to content

Instantly share code, notes, and snippets.

View waynedahlberg's full-sized avatar

Wayne Dahlberg waynedahlberg

View GitHub Profile
@Matt54
Matt54 / GlowingLowPolySphere.swift
Last active July 7, 2024 20:07
Sun with rays entity created from many low poly spheres at varying opacity and radius + different rotation animation along each axis
import RealityKit
import SwiftUI
struct GlowingLowPolySphere: View {
@State private var opacity: Float = 1.0
@State private var isForward: Bool = false
@State private var rotationAngles: SIMD3<Float> = [0, 0, 0]
@State private var modulationTimer: Timer?
@State private var time: Double = 0.0
@State private var lastRotationUpdateTime = CACurrentMediaTime()
@davidsteppenbeck
davidsteppenbeck / AnimatingMeshView.swift
Created June 11, 2024 16:41
Animating mesh gradient for iOS 18 using TimelineView
import SwiftUI
struct AnimatingMeshView: View {
let referenceDate: Date
var body: some View {
TimelineView(.animation) { context in
let t = context.date.timeIntervalSince(referenceDate)
MeshGradient(width: 5, height: 4, points: [
@steventroughtonsmith
steventroughtonsmith / V3DViewContainer.swift
Created February 2, 2024 17:14
UIKit proxy for visionOS 3D transforms and effects
//
// V3DViewContainer.swift
// Vision3DUIKit
//
// Created by Steven Troughton-Smith on 02/02/2024.
//
import UIKit
import SwiftUI
@drewolbrich
drewolbrich / MeshEntity+GenerateSolidInteriorModel.swift
Last active June 7, 2024 07:37
A RealityKit ModelEntity extension that replaces its model with a new model with reversed triangle indices
//
// MeshEntity+GenerateSolidInteriorModel.swift
//
// Created by Drew Olbrich on 12/16/23.
// Copyright © 2023 Lunar Skydiving LLC. All rights reserved.
//
// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@Priva28
Priva28 / CRTEffect.metal
Last active July 23, 2024 17:51
SwiftUI CRT effect using metal shaders.
#include <metal_stdlib>
#include <SwiftUI/SwiftUI.h>
using namespace metal;
float2 distort(float2 uv, float strength) {
float2 dist = 0.5 - uv;
uv.x = (uv.x - dist.y * dist.y * dist.x * strength);
uv.y = (uv.y - dist.x * dist.x * dist.y * strength);
return uv;
}
"use client";
import {
Dialog,
DialogContent,
DialogTitle,
DialogTrigger
} from "@/components/ui/dialog";
import useDragDrop from "@/hooks/useDragDrop";
import { cn, formatBytes } from "@/lib/utils";
@phenomen
phenomen / shadcn-flexoki.css
Created October 8, 2023 06:30
Flexoki theme for shadcn/ui and shadcn-svelte
@layer base {
:root {
--flexoki-bg: 48 100% 97%;
--flexoki-bg-2: 51 33% 92%;
--flexoki-ui: 51 21% 88%;
--flexoki-ui-2: 50 14% 83%;
--flexoki-ui-3: 55 10% 79%;
--flexoki-tx: 0 3% 6%;
@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 July 17, 2024 03:27
SwiftUI + Swift.Shader CD
//
// CDView.swift
// CD
//
// Created by Daniel Kuntz on 7/3/23.
//
import SwiftUI
struct ShapeWithHole: Shape {
@jasdev
jasdev / ScrimLoader.swift
Last active April 19, 2024 03:47
Rough sketch of Arc’s scrim loading view.
import SwiftUI
/**
### Exercises for the viewer
- Phase interrupt handling.
- Use Swift concurrency.
- Color scheme awareness.
- Rework animations to be more spring-like à la what shipped in `0.90.0`.