【GLSL】回転するチェッカーパターン
See the Pen rotating checker pattern by aadebdeb (@aadebdeb) on CodePen.
#define PI 3.14 precision mediump float; uniform float u_time; uniform vec2 u_mouse; uniform vec2 u_resolution; void main(void) { vec2 pos = gl_FragCoord.xy - u_resolution / 2.0; float size = 30.0; vec2 st = pos / (size * 2.0); float angle = u_mouse.x / u_resolution.x; angle -= length(pos) * abs(u_mouse.y - u_resolution.y / 2.0) * 0.00001; mat2 rot = mat2(cos(angle), -sin(angle), sin(angle), cos(angle)); st = rot * st; float c = abs(step(0.5, fract(st.x)) - step(0.5, fract(st.y))); gl_FragColor = vec4(vec3(c), 1.0); }
