Crossfade Circle Shader

Crossfade Circle Shader” potrebbe essere la seguente:

“The Crossfade Circle Shader is a visually appealing animation effect that applies a crossfade transition to an image, creating a smooth and captivating animation. The effect is centered around a circular region, gradually blending the image with a customizable color and transparency. The size of the circle and the speed of the animation can be adjusted to achieve different visual effects. The Crossfade Circle Shader is ideal for adding dynamic and eye-catching transitions to visuals in games, interactive applications, or multimedia projects.

Shader code
shader_type canvas_item;

uniform sampler2D texture;
uniform float time;
uniform vec2 resolution;
uniform vec4 dissolveColor;  // Controllo del colore e della trasparenza dell'effetto di dissolvenza
uniform float circleSize;  // Controllo sulla grandezza del cerchio

void fragment() {
    vec2 uv = vec2(SCREEN_UV.x, 1.0 - SCREEN_UV.y);  // Inverti l'asse Y delle coordinate UV
    vec4 color = textureLod(texture, uv, 0.0);

    // Calcola il centro dello schermo
    vec2 center = resolution / 2.0;

    // Calcola la distanza dall'attuale pixel al centro dello schermo
    float distance = distance(uv, center);

    // Calcola la larghezza dell'effetto di dissolvenza basata sulla grandezza del cerchio
    float fadeWidth = circleSize;

    // Calcola la velocità dell'animazione
    float speed = 1.0;

    // Calcola il valore di transizione basato sul tempo e sulla distanza
    float transition = smoothstep(fadeWidth, 0.0, distance) * sin(time * speed);

    // Crea un nuovo colore mescolando l'attuale colore con il colore e la trasparenza personalizzati
    vec4 finalColor = mix(dissolveColor, color, transition);

    // Assegna il colore finale al pixel
    COLOR = finalColor;
}
Tags
2d, aniamtion, crossfade
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 Rpics Studio

Distort Shining

Circle Rainbow

shock wave animation

Related shaders

Circle Shader

“Unit Selected” Oscillating Circle

Circle Rainbow

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments