Skip to content

Releases: NakaokaRei/MetalCanvas

MetalCanvas 0.1.0

27 Jul 01:46

Choose a tag to compare

🎉 Initial Release

MetalCanvas is a Swift library that provides an easy-to-use interface for rendering Metal shaders on macOS and iOS, inspired by glsl-canvas.

✨ Features

  • 🎨 SwiftUI Integration - Native SwiftUI views for macOS and iOS
  • Automatic Shader Compilation - Built-in uniforms (time, resolution, mouse, date)
  • ⏯️ Timer Controls - Play, pause, and reset animations
  • 🖼️ Texture Support - Load and manage textures with TextureManager
  • 🖱️ Mouse/Touch Tracking - Interactive shader effects with input tracking
  • 📱 Cross-Platform - Works on both macOS and iOS
  • 📚 DocC Documentation - Comprehensive API documentation
  • 🧪 Swift Testing - Modern testing with Swift Testing framework

📦 Installation

Add MetalCanvas to your project using Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/NakaokaRei/MetalCanvas", from: "0.1.0")
]

🚀 Getting Started

import MetalCanvas
import SwiftUI

struct ContentView: View {
    @State private var shaderCode: String? = """
        return float4(uv.x, uv.y, 0.5, 1.0);
    """
    
    var body: some View {
        MetalCanvasView(fragmentShader: $shaderCode)
    }
}

📱 Example Apps

The repository includes example apps for both macOS and iOS demonstrating various shader effects including:

  • Gradient animations
  • Plasma effects
  • Mandelbrot fractals
  • Voronoi patterns
  • Texture rendering with sparkle effects
  • Interactive mouse/touch tracking

🙏 Acknowledgments

Inspired by glsl-canvas and similar shader playground tools.