Creative coding framework for Swift.
Using Metal directly for rendering.
Geometry | Other Features |
---|---|
Rectangle (with hit test) | Perspective Camera |
Circle | Orthographic Camera |
Triangle | BlendMode(normal, add, alphaBlend) |
Line | Lighting |
Box (with hit test) | push/pop matrix |
3D Model | can be used as UIView / NSView |
Image (with hit test) | can be used as SwiftUI View |
Text | Post Processing |
UIViewObject (3d view with interactive button) | User-defined shaders |
import SwiftyCreatives
final class SampleSketch: Sketch {
override func draw(encoder: SCEncoder) {
let count = 20
for i in 0...count {
color(1, Float(i) / 20, 0, 1)
pushMatrix()
rotateY(Float.pi * 2 / Float(count) * Float(i))
translate(10, 0, 0)
box(1, 1, 1)
popMatrix()
}
}
}
ZStack {
SketchView(SampleSketch())
}
.background(.black)
link |
Stars: 46 |
Last commit: 5 hours ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics