Skip to content

Instantly share code, notes, and snippets.

View oscartrevio's full-sized avatar
🛰️

Oscar Treviño oscartrevio

🛰️
View GitHub Profile
@oscartrevio
oscartrevio / DistortionTransition.metal
Created February 23, 2026 05:11 — forked from radiofun/DistortionTransition.metal
DistortionTransition.metal
[[ stitchable ]] half4 distortionWithScale(float2 pos, SwiftUI::Layer l, float4 boundingRect, float2 dragp, float progress) {
float2 delta = pos - dragp;
float dist = length(delta);
// Define the influence of the "force" from the drag point
float radius = 155.0; // Radius of effect
float strength = 0.8; // How much it pulls
// Influence peaks at 0.5, is 0 at 0.3 and 1.0 - you can customize these values.
float progressinfluence = smoothstep(0.3, 0.5, progress) * (1.0 - smoothstep(0.5, 1.0, progress));