Swiftpack.co - Package - hexagons/SwiftFX

Powered by Metal through PixelKit

Example

import SwiftUI
import SwiftFX
struct ContentView: View {
    @State var value: CGFloat = 0.5
    var body: some View {
        VStack {
            Text("Hello, World!")
                .font(.system(size: 50, weight: .bold, design: .rounded))
                .fxEdge()
                .fxBlur(style: .zoom, radius: $value)
            Slider(value: $value)
        }
    }
}

| | | | | --- | --- | --- | | Text("Hello, World!") | .fxEdge() | .fxBlur(style: .zoom) |

Install

.package(url: "https://github.com/hexagons/SwiftFX.git", from: "0.1.1")

Setup

#if os(iOS)
fxMetalLib(url: Bundle.main.url(forResource: "PixelKitShaders-iOS", withExtension: "metallib")!)
#elseif os(macOS)
fxMetalLib(url: URL(fileURLWithPath: "/path/to/PixelKitShaders-macOS.metallib"))
#endif

You can find the latest Metal library from PixelKit here.

Effects


func fxBlur(style, radius, angle, position, quality) -> FX

func fxEdge(strength, distance) -> FX

func fxDisplace(distance, view) -> FX

func fxDisplaceNoise(distance, octaves, zPosition) -> FX

func fxRainbowBlur(_) -> FX

func fxClamp(low, high) -> FX

func fxKaleidoscope(divisions, mirror) -> FX

func fxBrightness(_) -> FX

func fxDarkness(_) -> FX

func fxContrast(_) -> FX

func fxGamma(_) -> FX

func fxInvert() -> FX

func fxOpacity(_) -> FX

func fxQuantize(fraction) -> FX

func fxSharpen(_) -> FX

func fxSlope(_) -> FX

func fxThreshold(_) -> FX

func fxTwirl(_) -> FX

func fxRange(inLow, inHigh, outLow, outHigh) -> FX

func fxSaturation(_) -> FX

func fxMonochrome() -> FX

func fxHue(_) -> FX

func fxSepia(color) -> FX

func fxFlipX() -> FX

func fxFlipY() -> FX

func fxFlopLeft() -> FX

func fxFlopRight() -> FX

Github

link
Stars: 11

Used By

Total: 0

Releases

PixelKit Update - 2020-05-23 14:19:53