Sha256: fcf0f19cb423e6ccecf28f3636ad952e92531cfb28afc937b4dab38a310b4af5

Contents?: true

Size: 1.33 KB

Versions: 21

Compression:

Stored size: 1.33 KB

Contents

#version 330 core

#ifdef GL_ES
precision mediump float;
#endif

#extension GL_OES_standard_derivatives : enable

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
out vec4 color_out;

#define PI 3.141592653589793
#define TWOPI 6.283185307179586

float rand(vec2 co) { 
  float a = 12.9898; 
  float b = 78.233; 
  float c = 43758.5453; 
  float dt= dot(co.xy ,vec2(a,b)); 
  float sn= mod(dt,3.14); 
  return fract(sin(sn) * c);
}

vec2 rotate(float theta, vec2 v) {
  float s = sin(theta);
  float c = cos(theta);
  mat2 R = mat2(c, s, -s, c);
  return R * v;
}

void main(void) {
  vec2 pos = gl_FragCoord.xy * 2. - resolution;
  pos /= max(resolution.x, resolution.y);

  pos *= 5.;

  float l = length(pos);
  pos = rotate(-pow(l, .5), pos);

  pos *= .5;

  vec3 mask = vec3(0.0);

  const int len = 3;
  for (int i = 0; i < len; i++) {
    float theta = mod(-time, TWOPI) - PI * 2. * float(i) / float(len);
    float phi = atan(pos.y, pos.x);

    float delta = phi - theta;
    delta = mod(delta + PI, TWOPI);

    float r = smoothstep(0., TWOPI / float(len), abs(delta));

    mask += vec3(pos, 1.) * vec3(1. - r);
  }

  vec4 color = vec4(mask.xy * pos, mask.z, 1.0);

  float c = length(color.xy);
  color.rg = rotate(1. + pow(c,1.2), color.rg);
	
  color.gr = sin(color.rg * 10.);
	
	color *= step(vec4(.5), color);

  color_out = color;
}

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pixo-0.4.5 ext/pixo/patterns/blades.glsl
pixo-0.4.4 ext/pixo/patterns/blades.glsl
pixo-0.4.3 ext/pixo/patterns/blades.glsl
pixo-0.4.2 ext/pixo/patterns/blades.glsl
pixo-0.4.1 ext/pixo/patterns/blades.glsl
pixo-0.4.0 ext/pixo/patterns/blades.glsl
pixo-0.3.2 ext/pixo/patterns/blades.glsl
pixo-0.3.1 ext/pixo/patterns/blades.glsl
pixo-0.3.0 ext/pixo/patterns/blades.glsl
pixo-0.2.6 ext/pixo/patterns/blades.glsl
pixo-0.2.5 ext/pixo/patterns/blades.glsl
pixo-0.2.4 ext/pixo/patterns/blades.glsl
pixo-0.2.3 ext/pixo/patterns/blades.glsl
pixo-0.2.2 ext/pixo/patterns/blades.glsl
pixo-0.2.1 ext/pixo/patterns/blades.glsl
pixo-0.2.0 ext/pixo/patterns/blades.glsl
pixo-0.1.4 ext/pixo/patterns/blades.glsl
pixo-0.1.3 ext/pixo/patterns/blades.glsl
pixo-0.1.2 ext/pixo/patterns/blades.glsl
pixo-0.1.1 ext/pixo/patterns/blades.glsl