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;
}
}
It works fine with Godot 4 as well without needing to change any of the code.
Rise and Shine, Mr Freeman, rise and shine.