-
Notifications
You must be signed in to change notification settings - Fork 12
SwiftyCreatives Documents
Yuki Kuwashima edited this page Feb 4, 2024
·
4 revisions
- Create your sketch class
class MySketch: Sketch {
override func draw(encoder: SCEncoder) {
// write draw functions here
}
}- Display your sketch with SwiftUI View
struct ContentView: View {
var body: some View {
SketchView(MySketch())
}
}- typealias for
simd_float2,simd_float3,simd_float4,simd_float4x4
Set color. rgba in 0...1.
color(_ r: Float, _ g: Float, _ b: Float, _ a: Float)Draw line with width. boldline is 2d plane geometry, so carefully use this in 3d space.
boldline(_ x1: Float, _ y1: Float, _ z1: Float, _ x2: Float, _ y2: Float, _ z2: Float, width: Float)Draw 3d box.
box(_ x: Float, _ y: Float, _ z: Float, _ scaleX: Float, _ scaleY: Float, _ scaleZ: Float)Draw circle.
circle(_ x: Float, _ y: Float, _ z: Float, _ radX: Float, _ radY: Float)Set fog in the scene. density has to be 0...1.
setFog(color: f4, density: Float)