Pretty Hip

Add it to a color rect

My attempt at converting https://www.shadertoy.com/view/XsBfRW

Please enjoy

Shader code
shader_type canvas_item;

uniform vec4 fore_color : hint_color = vec4(0.5, 0.75, 1.0, 1.0);
uniform vec4 back_color : hint_color = vec4(1.0, 1.0, 1.0, 1.0);

void fragment()
{
	float aspect = (1.0 / TEXTURE_PIXEL_SIZE).y/(1.0 / TEXTURE_PIXEL_SIZE).x;
	float value;
	vec2 uv = UV.xy / (1.0 / TEXTURE_PIXEL_SIZE).x;
	uv -= vec2(0.5, 0.5*aspect);
	float rot = radians(45.0); // radians(45.0*sin(iTime));
	vec2 part1 = vec2(cos(rot), -sin(rot));
	vec2 part2 = vec2(sin(rot), cos(rot));
	mat2 m = mat2(part1, part2);
	uv = m * uv;
	uv += vec2(0.5, 0.5*aspect);
	uv.y+=0.5*(1.0-aspect);
	vec2 pos = 10.0*uv;
	vec2 rep = fract(pos);
	float dist = 2.0*min(min(rep.x, 1.0-rep.x), min(rep.y, 1.0-rep.y));
	float squareDist = length((floor(pos)+vec2(0.5)) - vec2(5.0) );
	float edge = sin(TIME-squareDist*0.5)*0.5+0.5;
	edge = (TIME-squareDist*0.5)*0.5;
	edge = 2.0*fract(edge*0.5);
	value = fract (dist*2.0);
	value = mix(value, 1.0-value, step(1.0, edge));
	edge = pow(abs(1.0-edge), 2.0);
	value = smoothstep( edge-0.05, edge, 0.95*value);
	value += squareDist*.1;
	COLOR = mix(back_color, fore_color, value);
	//COLOR.a = 0.25*clamp(value, 0.0, 1.0);
}
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from halcyonxero

Electric Noise

Oil Stain

Flaring Star

guest
0 Comments
Inline Feedbacks
View all comments