shader_type canvas_item;
-uniform vec4 dots_color = vec4(1, 0.86, 0.83, 10);
-uniform vec4 bg_color = vec4(0, 0, 0, 0);
-uniform float grid_size: hint_range(0.0, 200, 0.1) = 100;
-uniform float dot_size: hint_range(0.0, 1.0, 0.01) = 500;
-
-const float angle = 45.0;
-const float RADIANS = angle * 0.0174532;
-const ivec2 reps = ivec2(2, 2);
-const vec2 mid = vec2(0.5);
-const float rad = 0.25;
+uniform vec4 dots_color = vec4(1, 0.86, 0.83, 1);
+uniform vec4 bg_color = vec4(1, 0.95, 0.91, 1);
+uniform float radius: hint_range(0.0, 1.0, 0.01) = .07;
+uniform float grid_size: hint_range(1.0, 200.0, 1.00) = 7.;
+uniform float speed: hint_range(0.0, 1.0, 0.01) = .2;
void fragment() {
- vec2 tile_coord = mod(FRAGCOORD.xy * SCREEN_PIXEL_SIZE.x, vec2(1.0 / grid_size));
-
- vec2 uv = tile_coord * grid_size - mid;
- float len = clamp(length(uv) / dot_size, 0, 1);
-
+ vec2 uv = (FRAGCOORD.xy - (1.0 / SCREEN_PIXEL_SIZE).xy) / min((1.0 / SCREEN_PIXEL_SIZE).x,(1.0 / SCREEN_PIXEL_SIZE).y);
+ uv *= grid_size;
+
+ // movement
+ uv.x -= TIME * speed;
+ uv.y += TIME * speed;
+
+ // Here is where the offset is happening
+ uv.x += step(1., mod(uv.y,2.0)) * .5;
+
+ // circle
+ vec2 fractal = fract(uv);
+ float c = length(.5 - fractal);
+ float min_dist = min(c, 1.);
+
// anti-aliased
- float sharpness = 50.;
- float circ = dot_size * sharpness - length(uv) * sharpness;
-
- if (abs(circ - 50.) > 50.) {
- COLOR = bg_color;
- } else {
- COLOR = dots_color;
- }
+ float d = length(uv);
+ float wd = fwidth(d);
+ float circle = smoothstep(radius + wd, radius - wd, min_dist);
-
-// // the uv.. we are calling it p for pixel
-// vec2 p = FRAGCOORD.xy / SCREEN_PIXEL_SIZE.xy;
-// // account for non square image aspect
-// p.y *= float(SCREEN_PIXEL_SIZE.y)/ float(SCREEN_PIXEL_SIZE.x);
-// //rotating the whole scene
-// mat2 rot = mat2(vec2(cos(RADIANS), -sin(RADIANS)), vec2(sin(RADIANS), cos(RADIANS)));
-// p *= rot;
-//
-//
-// // q is just an offset - .5
-// vec2 q = p - vec2(0.5, 0.5);
-//
-// // creates a repeating 0-1 range
-// vec2 repeat = vec2(fract(q.x * float(reps.x)), fract(q.y * float(reps.y)) );
-//
-// vec2 distFromMid = repeat - mid;
-//
-// // drawing circles based on distance from center of each cell
-// float dist = length(distFromMid);
-//
-// // anti-aliased
-// float sharpness = 50.;
-// float circ = rad * sharpness - dist * sharpness;
-// // for black on white, subtract rad from dist
-//
-// // holds the color
-// vec3 col;
-// if (abs(circ - 50.) > 50.) {
-// col = bg_color;
-// } else {
-// col = dots_color;
-// }
-//
-// COLOR = vec4(col, 1);
+ // colors
+ COLOR = mix(bg_color, dots_color, circle);
}
\ No newline at end of file