Skip to content

Instantly share code, notes, and snippets.

@heestand-xyz
Created May 2, 2019 18:57
Show Gist options
  • Save heestand-xyz/95800c23f6577bb24882586a7ff550cf to your computer and use it in GitHub Desktop.
Save heestand-xyz/95800c23f6577bb24882586a7ff550cf to your computer and use it in GitHub Desktop.
Farg - Circle
let cirlce = MetalPIX(res: ._256, uniforms: [
MetalUniform(name: "resx", value: 256),
MetalUniform(name: "resy", value: 256)
], code:
"""
int x = int(u * in.resx);
int y = int(v * in.resy);
int i = y * int(in.resx) + x;
float f = float(i) / (in.resx * in.resy);
pix = float4(cos(f*pi*2)/2+0.5,sin(f*pi*2)/2+0.5,0,1);
"""
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment