Portals
I want these portals to move in my game. i want them to have a vortex kind of move to them as well as particles
Shader code
shader_type canvas_item;
uniform vec4 portal_color : source_color = vec4(0.9, 0.05, 0.08, 1.0);
uniform float rotation_speed = 0.8;
uniform float vortex_strength = 3.0;
uniform float swirl_detail = 5.0;
uniform float glow_strength = 1.5;
void fragment() {
// Center UV around 0,0
vec2 uv = UV - vec2(0.5);
float radius = length(uv);
float angle = atan(uv.y, uv.x);
// Don't draw outside the circular portal
if (radius > 0.48) {
discard;
}
// Time-based rotation
float time = TIME * rotation_speed;
// Stronger twisting toward the center
float twist = (1.0 - radius) * vortex_strength;
angle += time + twist;
// Convert back into coordinates
vec2 vortex_uv = vec2(
cos(angle),
sin(angle)
) * radius;
// Create spiral waves
float spiral =
sin(
angle * swirl_detail
- radius * 20.0
- TIME * 4.0
);
spiral = spiral * 0.5 + 0.5;
// Inner energy
float inner_energy =
smoothstep(0.48, 0.05, radius);
// Outer ring
float ring =
smoothstep(0.46, 0.40, radius);
// Combine
float energy =
spiral * 0.55 +
inner_energy * 0.45 +
ring * 0.5;
// Strong glowing center
float center =
smoothstep(0.18, 0.0, radius);
energy += center * 0.8;
// Final color
vec3 color = portal_color.rgb * energy;
// Soft glow
color += portal_color.rgb *
pow(1.0 - radius / 0.48, 3.0)
* glow_strength;
COLOR = vec4(color, energy);
}
