【GLSL】RGBの円
See the Pen RGB circles by aadebdeb (@aadebdeb) on CodePen.
precision mediump float; uniform float u_time; uniform vec2 u_mouse; uniform vec2 u_resolution; float circle(in vec2 _position, in vec2 _center, in float _radius) { float d = distance(_position, _center); return 1. - smoothstep(_radius * 0.8, _radius * 1.8, d); } void main(void) { vec2 center = u_resolution / 2.; float radius = 200.; float angle = u_time * 0.001; float r = circle(gl_FragCoord.xy, center + radius * vec2(cos(angle), sin(angle)), 50.); float g = circle(gl_FragCoord.xy, center + radius * vec2(cos(angle * 2.), sin(angle * 2.)), 50.); float b = circle(gl_FragCoord.xy, center + radius * vec2(cos(angle * 4.), sin(angle * 4.)), 50.); gl_FragColor = vec4(r, g, b, 1.); // gl_FragColor = vec4(r - 1., g - 1., b - 1., 1.); }