Advertisement
mivebe

Ex: 6 - Sine Cosine

Nov 21st, 2023
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 300 es
  2. #ifdef GL_ES
  3. precision mediump float;
  4. #endif
  5.  
  6. uniform vec2 u_resolution;
  7. uniform float u_time;
  8. out vec4 outColor;
  9.  
  10. float circeShape(vec2 position, float radius) {
  11.     return step(radius, length(position - vec2(0.5)));
  12. }
  13.  
  14. void main() {
  15.     vec2 coord = gl_FragCoord.xy / u_resolution.x;
  16.     vec3 color = vec3(0.0);
  17.    
  18.     vec2 translate = vec2(sin(u_time / 10.0), cos(u_time));
  19.     coord += translate * 0.5;
  20.    
  21.     color += vec3(circeShape(coord, 0.3));
  22.    
  23.     outColor = vec4(color, 1.0);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement