Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

【GLSL】縞々のリング

See the Pen stripe rings by aadebdeb (@aadebdeb) on CodePen.

precision mediump float;

uniform float u_time;
uniform vec2 u_mouse;
uniform vec2 u_resolution;

void main(void) {
  float d = sqrt(pow(gl_FragCoord.x - u_resolution.x / 2.0, 2.0) + pow(gl_FragCoord.y - u_resolution.y / 2.0, 2.0));
  float v = (sin(d * u_mouse.x / u_resolution.y * 0.3 - u_time * u_mouse.y / u_resolution.y * 0.1) + 1.0) * 0.5;
  gl_FragColor = vec4(v, v, v, 1.0);
}
f:id:aa_debdeb:20170327205120p:plain