Skip to content

Instantly share code, notes, and snippets.

View AchrafKassioui's full-sized avatar

Achraf Kassioui AchrafKassioui

View GitHub Profile
@AchrafKassioui
AchrafKassioui / SpeedUpRecording.swift
Created October 31, 2026 00:16
Swift command-line program wiremen by GPT Sol 6.1 to speed up a specific part of a video.
import AVFoundation
import Foundation
@main
struct SpeedUpRecording {
static func main() async throws {
guard CommandLine.arguments.count == 3 else {
print("Usage: speed-up input.mov output.mov")
return
@AchrafKassioui
AchrafKassioui / SpriteKitCameraComparison.swift
Last active October 14, 2026 17:00
Comparing SKCameraNode with a manual camera setup, using Core Image filters and texture snapshot. Article: https://www.achrafkassioui.com/blog/cameras-in-spritekit-part-1/
/**
# SKCameraNode vs Manual Camera: Fiters & Snapshots
A scene that compares SKCameraNode with a manual camera setup.
https://gist.github.com/AchrafKassioui/9f23cef667aba3ca45c4fc21d48c4acf
## Dependencies
- SpriteKit Inertial Camera: https://www.achrafkassioui.com/spritekit-inertial-camera/
@AchrafKassioui
AchrafKassioui / SKLight.swift
Created July 2, 2026 18:05
A sample scene using SpriteKit built-in lighting and hard shadows.
/**
# SKLight
A sample scene using SpriteKit built-in lighting and hard shadows.
Achraf Kassioui
Created 27 Jun 2026
Updated 2 Jul 2026
@AchrafKassioui
AchrafKassioui / SKRendererMetalShader.swift
Last active July 5, 2026 15:58
Apply Metal Shaders to specific SpriteKit scene layers using SKRenderer and MetalKit.
/**
# SKRenderer + Metal Shader
This experiment applies a Metal shader to a specific layer in the scene.
Achraf Kassioui
Created 1 Jul 2026
Updated 5 Jul 2026
@AchrafKassioui
AchrafKassioui / SKRendererMetalKit.swift
Last active July 4, 2026 13:55
Render SpriteKit with SKRenderer and a MetalKit view.
/**
# SKRenderer + MetalKit View
A minimal setup to render a SpriteKit scene with SKRenderer and MTKView.
The same scene can run in two modes:
- Presented with SpriteView/SKView.
- Rendered manually with SKRenderer and MTKView.
@AchrafKassioui
AchrafKassioui / SpriteMotionBlur.swift
Last active June 21, 2026 00:46
SpriteKit motion blur shader experiment. This is the SpriteKit version of https://github.com/alexwidua/zoom-motion-blur
/**
# Sprite Motion Blur
This scene implements per-sprite motion blur with a fragment shader.
The sprite is larger than the visible shape, so the shader has transparent drawing room around the circle.
Each fragment samples the sprite texture several times along the current movement direction, then averages those samples into one final color.
The scene updates the blur direction and length from the sprite physics velocity.
@AchrafKassioui
AchrafKassioui / SpriteKitLineShader.swift
Last active June 18, 2026 02:27
A minimal setup to start with SpriteKit shaders. This shader draws a line from point A to point B.
/**
# Line Shader
A minimal setup to start with SpriteKit shaders.
This setup uses a sprite as a drawing canvas.
A shader draws a line from point A to point B.
Touching the scene anywhere updates the point B location and the shader's drawing.
@AchrafKassioui
AchrafKassioui / SKDeterminism.swift
Last active June 18, 2026 02:28
SpriteKit Physics Determinism
/**
# SpriteKit Physics Determinism
Is SpriteKit's physics engine deterministic?
In some cases, the physics-based behavior is quite repeatable.
In other cases, the simulation yields a different outcome every run.
This is a setup to explore such behaviors.
Press one of the buttons to play a sequence.
@AchrafKassioui
AchrafKassioui / ManualCamera.swift
Last active June 18, 2026 02:28
Code sample for manual camera setup in SpriteKit.
/**
Code sample for manual camera setup in SpriteKit.
Achraf Kassioui
Created 27 August 2025
Updated 28 August 2025
*/
import SpriteKit
@AchrafKassioui
AchrafKassioui / MemoryBuildUp.swift
Created November 23, 2024 05:01
Testing memory build up of a SpriteKit scene when it is presented again and again.
/**
# SpriteKit Memory Buildup
Testing memory build up of a SpriteKit scene when it is presented again and again.
Achraf Kassioui
Created 23 November 2024
Updated 23 November 2024