Warning: Undefined variable $post_id in /var/www/godotshaders.com/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(663) : eval()'d code on line 7

Motion Lines

Simple Godot 3 motion lines.

Put it on a ColorRect.

Parameters:
– speedScale: The speed which the lines move.
– clipPosition: The distance from the center that the lines appear.

It has colour support by changing the rect’s colour!

Shader code
shader_type canvas_item;

uniform float speedScale = 16.0;
uniform float clipPosition = 0.2;

float random (vec2 uv) {
    return fract(sin(dot(uv.xy,
        vec2(12.9898,78.233))) * 43758.5453123);
}

void fragment() {
	COLOR.a = 0.0;
	
	vec2 pos = UV - vec2(0.5);
	float theta = round(64.0 * atan(pos.y, pos.x));
	float dist = sqrt(pow(pos.x, 2) + pow(pos.y, 2));
	
	float distValue = round(dist * 4.0 + TIME * -speedScale + 8.0 * random(vec2(theta)));
	if (dist > clipPosition + random(vec2(theta)) * 0.3 && random(vec2(theta, distValue)) < 0.02) {
		COLOR.a = 1.0;
	}
}
Live Preview

Warning: Undefined variable $post in /var/www/godotshaders.com/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(663) : eval()'d code on line 26

Warning: Attempt to read property "ID" on null in /var/www/godotshaders.com/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(663) : eval()'d code on line 26
Tags
godot 3
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 Haizlbliek

Related shaders

guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Steampunkdemon
1 year ago

It works fine with Godot 4 as well without needing to change any of the code.

Mauppi1
Mauppi1
1 year ago

Rise and Shine, Mr Freeman, rise and shine.