{"id":13340111,"url":"https://github.com/yukiny0811/swifty-creatives","last_synced_at":"2025-04-13T02:32:03.166Z","repository":{"id":64829224,"uuid":"576011506","full_name":"yukiny0811/swifty-creatives","owner":"yukiny0811","description":"Creative coding framework for Swift. Built on Apple's Metal. Inspired by Processing. Supports visionOS.","archived":false,"fork":false,"pushed_at":"2024-02-22T05:06:41.000Z","size":2431,"stargazers_count":141,"open_issues_count":21,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-23T23:06:53.296Z","etag":null,"topics":["3d","3d-graphics-engine","apple-metal","creative-coding","generative-art","ios","macos","media-art","metal","metalapi","processing","shaders","swift","swift-package-manager","swiftui","visionos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yukiny0811.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-08T20:04:21.000Z","updated_at":"2024-06-14T12:43:26.473Z","dependencies_parsed_at":"2024-02-22T01:29:30.774Z","dependency_job_id":"55d47736-af54-4f18-bd55-97726bba0291","html_url":"https://github.com/yukiny0811/swifty-creatives","commit_stats":{"total_commits":167,"total_committers":1,"mean_commits":167.0,"dds":0.0,"last_synced_commit":"d2d69931e812da3e8d375614f5c838ab5178380d"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukiny0811%2Fswifty-creatives","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukiny0811%2Fswifty-creatives/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukiny0811%2Fswifty-creatives/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukiny0811%2Fswifty-creatives/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yukiny0811","download_url":"https://codeload.github.com/yukiny0811/swifty-creatives/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657793,"owners_count":21140842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d","3d-graphics-engine","apple-metal","creative-coding","generative-art","ios","macos","media-art","metal","metalapi","processing","shaders","swift","swift-package-manager","swiftui","visionos"],"created_at":"2024-07-29T19:22:07.804Z","updated_at":"2025-04-13T02:32:03.156Z","avatar_url":"https://github.com/yukiny0811.png","language":"Swift","funding_links":[],"categories":["Open Source"],"sub_categories":["Libraries"],"readme":"# SwiftyCreatives\n\n[![Release](https://img.shields.io/github/v/release/yukiny0811/swifty-creatives)](https://github.com/yukiny0811/swifty-creatives/releases/latest)\n[![Swift Compatibility](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fyukiny0811%2Fswifty-creatives%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/yukiny0811/swifty-creatives)\n[![Platform Compatibility](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fyukiny0811%2Fswifty-creatives%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/yukiny0811/swifty-creatives)\n[![License](https://img.shields.io/github/license/yukiny0811/swifty-creatives)](https://github.com/yukiny0811/swifty-creatives/blob/main/LICENSE)\n\n__Creative coding framework for Swift.__   \nUsing Metal directly for rendering. Inspired by Processing. Supports visionOS.    \n\n![outputFinalfinal](https://github.com/yukiny0811/swifty-creatives/assets/28947703/52d2d3f5-f69b-48f0-b77f-5db910615010)\n\n## AI Documentation (Q\u0026A)\n\nhttps://chatgpt.com/g/g-67a4bd5b2f6c81918311ea49989be5d5-swifty-creatives-q-a\n\n## Requirements\n\n- Swift5.9\n\n## Supported Platforms\n\n- macOS v14\n- iOS v17\n- visionOS v1\n- tvOS v17\n\n## Key Features\n\n### Processing-like Syntax\n\nYou can easily create your graphics, using Swift Programming Language with the intuitive essence of Processing.    \nI like how ```push()``` and ```pop()``` became super simple using Swift's trailing closure.\n\n```.swift\nimport SwiftyCreatives\n\nfinal class MySketch: Sketch {\n    override func draw(encoder: SCEncoder) {\n        let count = 20\n        for i in 0..\u003ccount {\n            color(0.75, Float(i) / 40, 1, 0.5)\n            push {\n                rotateY(Float.pi * 2 / Float(count) * Float(i))\n                translate(10, 0, 0)\n                box(0, 0, 0, 1, 1, 1)\n            }\n        }\n    }\n}\n\nstruct ContentView: View {\n    var body: some View {\n        SketchView(MySketch())\n    }\n}\n```\n![スクリーンショット 2024-02-04 5 38 56](https://github.com/yukiny0811/swifty-creatives/assets/28947703/1d506879-6b23-460f-b7de-eb8a379bf2d1)\n\n### Apple Vision Pro - Immersive Space\n\nSupports visionOS! You can dive in to your sketch with Immersive Space rendering!\n\n```.swift\nImmersiveSpace(id: \"ImmersiveSpace\") {\n    CompositorLayer(configuration: ContentStageConfiguration()) { layerRenderer in\n        let renderer = RendererBase.BlendMode.normalBlend.getRenderer(sketch: SampleSketch(), layerRenderer: layerRenderer)\n        renderer.startRenderLoop()\n    }\n}\n```\n\n![ddd](https://github.com/yukiny0811/swifty-creatives/assets/28947703/e700c630-9f49-4f2e-99be-8963484edcc2)\n\n\n### xib to 3D Space!\n\nCreate UIView with xib, and place it in 3D scene!    \nUIButton can be connected with IBAction, and can be tapped in 3d space.\n\n![outout](https://github.com/yukiny0811/swifty-creatives/assets/28947703/fbee6220-13f6-42d3-accf-3f43270d7251)\n\n## Installation\n\nUse Swift Package Manager.\n\n```.swift\ndependencies: [\n    .package(url: \"https://github.com/yukiny0811/swifty-creatives.git\", branch: \"main\")\n]\n```\n```.swift\n.product(name: \"SwiftyCreatives\", package: \"swifty-creatives\")\n```\n\n### Features\n- [x] Geometries\n    - [x] Rectangle\n    - [x] Circle\n    - [x] Box\n    - [x] Triangle\n    - [x] Line\n    - [x] BoldLine\n    - [x] 3D Model (obj)\n    - [x] Image\n    - [x] Text\n    - [x] 3D Text\n    - [x] UIView Object (3d view created from xib, with interactive button)\n    - [x] Mesh\n    - [x] Vertex Buffer\n    - [x] SVG\n- [x] Geometries with Hit Test (you can click or hover on it)\n    - [x] HitTestableRect\n    - [x] HitTestableBox\n    - [x] HitTestableImg\n- [x] Effects\n    - [x] Color\n    - [x] Fog\n    - [x] Bloom\n    - [x] Post Process (you can create your own)\n- [x] Transforms\n    - [x] Translate\n    - [x] Rotate\n    - [x] Scale\n    - [x] Push \u0026 Pop\n- [x] Rendering\n    - [x] Normal rendering with depth test\n    - [x] Add blend rendering\n    - [x] Transparent rendering with depth test\n- [x] Animation\n    - [x] SCAnimatable property wrapper for animations\n- [x] Audio\n    - [x] Audio Input\n    - [x] FFT\n- [x] Camera\n    - [x] Perspective Camera\n    - [x] Orthographic Camera\n    - [x] Customizable fov\n- [x] View\n    - [x] SwiftUI View\n    - [x] UIKit View\n    - [x] visionOS Immersive Space\n- [x] Others\n    - [x] Creating original geomery class\n    - [x] Font Rendering\n\n## Events\n```.swift\nopen func setupCamera(camera: MainCamera) {}\nopen func preProcess(commandBuffer: MTLCommandBuffer) {}\nopen func update(camera: MainCamera) {}\nopen func draw(encoder: SCEncoder) {}\nopen func afterCommit(texture: MTLTexture?) {}\nopen func postProcess(texture: MTLTexture, commandBuffer: MTLCommandBuffer) {}\n\n#if os(macOS)\nopen func mouseMoved(camera: MainCamera, location: f2) {}\nopen func mouseDown(camera: MainCamera, location: f2) {}\nopen func mouseDragged(camera: MainCamera, location: f2) {}\nopen func mouseUp(camera: MainCamera, location: f2) {}\nopen func mouseEntered(camera: MainCamera, location: f2) {}\nopen func mouseExited(camera: MainCamera, location: f2) {}\nopen func keyDown(with event: NSEvent, camera: MainCamera, viewFrame: CGRect) {}\nopen func keyUp(with event: NSEvent, camera: MainCamera, viewFrame: CGRect) {}\nopen func viewWillStartLiveResize(camera: MainCamera, viewFrame: CGRect) {}\nopen func resize(withOldSuperviewSize oldSize: NSSize, camera: MainCamera, viewFrame: CGRect) {}\nopen func viewDidEndLiveResize(camera: MainCamera, viewFrame: CGRect) {}\nopen func scrollWheel(with event: NSEvent, camera: MainCamera, viewFrame: CGRect) {}\n#endif\n\n#if os(iOS)\nopen func onScroll(delta: CGPoint, camera: MainCamera, view: UIView, gestureRecognizer: UIPanGestureRecognizer) {}\nopen func touchesBegan(camera: MainCamera, touchLocations: [f2]) {}\nopen func touchesMoved(camera: MainCamera, touchLocations: [f2]) {}\nopen func touchesEnded(camera: MainCamera, touchLocations: [f2]) {}\nopen func touchesCancelled(camera: MainCamera, touchLocations: [f2]) {}\n#endif\n```\n\n## Other Examples\n\n![ExampleMacOSApp 2023年-02月-24日 17 11 06](https://user-images.githubusercontent.com/28947703/221126530-c362018e-325c-4747-8e57-c5e18ab7085d.gif)\n\n![CheckMacOS 2023年-03月-01日 6 46 57](https://user-images.githubusercontent.com/28947703/221993495-7840a9e0-4de7-4c6c-8fef-ef3b9f53677f.gif)\n\n![QuickTime Player - 画面収録 2023-02-10 1 53 14 mov 2023年-02月-10日 2 55 14](https://user-images.githubusercontent.com/28947703/217897685-7a83bedf-5624-45e2-b566-9a05aab7c103.gif)\n\n![stable fluids](https://user-images.githubusercontent.com/28947703/210088675-e4605442-db10-4620-b154-0fd4288c1445.gif)\n\n## Credits\n- swifty-creatives library is created by Yuki Kuwashima\n- twitter: [@yukiny_sfc](https://twitter.com/yukiny_sfc)\n- [email](yukiny0811@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukiny0811%2Fswifty-creatives","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyukiny0811%2Fswifty-creatives","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukiny0811%2Fswifty-creatives/lists"}