Skip to content

heestand-xyz/MetalUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetalUI

Install

.package(url: "https://github.com/heestand-xyz/MetalUI", from: "0.0.1")

Green Screen

| | |

import SwiftUI
import MetalUI

struct ContentView: View {
    var body: some View {
        ZStack {
            Color.blue
                .ignoresSafeArea()
            Image("Superman")
                .resizable()
                .aspectRatio(contentMode: .fit)
                .chromaKey(color: Color(red: 0.0,
                                        green: 1.0,
                                        blue: 0.0))
        }
    }
}

#Preview {
    ContentView()
}

Kaleidoscope

MetalUI.Kaleidoscope.mov
import SwiftUI
import MetalUI

struct ContentView: View {
    
    @State var value: CGFloat = 0.0
    
    var body: some View {
        VStack {
            Color.red
            Color.green
            Color.blue
        }
        .frame(width: 200, height: 200)
        .kaleidoscope(count: 12, angle: .degrees(180))
    }
}

#Preview {
    ContentView()
}

Circle Blur

import SwiftUI
import MetalUI

struct ContentView: View {
    
    @State var value: CGFloat = 0.0
    
    var body: some View {
        VStack {
            Text("Hello World")
                .padding()
                .border(Color.black)
                .circleBlur(value * 10)
            Slider(value: $value)
        }
        .padding()
        .frame(width: 250)
    }
}

#Preview {
    ContentView()
}

Feedback

import SwiftUI
import MetalUI

struct ContentView: View {
    
    var body: some View {
        Text("Hello, World!")
            .foregroundStyle(.white)
            .frame(maxWidth: .infinity,
                   maxHeight: .infinity)
            .feedback { source, loop in
                ZStack {
                    source
                        .opacity(0.1)
                    loop
                        .scaleEffect(1.01)
                        .opacity(0.99)
                }
            }
    }
}

#Preview {
    ContentView()
}

Edge

import SwiftUI
import MetalUI

struct ContentView: View {
    
    var content: some View {
        
    }
    
    var body: some View {
        HStack {
            Image(systemName: "globe")
            Text("Hello, World!")
        }
        .font(.system(size: 50, weight: .bold))
        .padding()
        .edge()
    }
}

#Preview {
    ContentView()
}

Pixelate

import SwiftUI
import MetalUI

struct ContentView: View {
    
    var body: some View {
        VStack {
            Text("Hello, World!")
            Text("Hello, World!")
                .pixelate()
            Text("Hello, World!")
                .quickPixelate()
        }
        .font(.largeTitle)
    }
}

#Preview {
    ContentView()
}

Noise

import SwiftUI
import MetalUI

struct ContentView: View {
    
    var body: some View {
        Noise()
    }
}

#Preview {
    ContentView()
}