【GLSL】RGBの縞々のリング
See the Pen RGB stripe rings by aadebdeb (@aadebdeb) on CodePen.
#define TWO_PI 6.2831853 precision mediump float; uniform float u_time; uniform vec2 u_mouse; uniform vec2 u_resolution; float wave(in vec2 position, in vec2 center, in float scale, in float offset) { float d = distance(position, center); return (sin(offset + d * scale) + 1.) * .5; } void main(void) { vec2 center = u_resolution / 2.; float radius = 200.; float time = u_time * 0.004; vec2 mouse = u_mouse / u_resolution; vec3 scales = vec3(mouse.x * 0.1, mouse.y * 0.1, (1.0 - (mouse.x + mouse.y) * 2.0) * 0.1); vec3 color = vec3(wave(gl_FragCoord.xy, center + radius * vec2(cos(time), sin(time)), scales.r, time), wave(gl_FragCoord.xy, center + radius * vec2(cos(time + TWO_PI / 3.), sin(time + TWO_PI / 3.)), scales.g, time), wave(gl_FragCoord.xy, center + radius * vec2(cos(time + TWO_PI / 3. * 2.), sin(time + TWO_PI / 3. * 2.)), scales.b, time)); gl_FragColor = vec4(color, 1.0); }