Skip to content

Instantly share code, notes, and snippets.

@MadebyAe
Created September 25, 2022 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadebyAe/c6d1cae5903bed27a226eb12ebed17cd to your computer and use it in GitHub Desktop.
Save MadebyAe/c6d1cae5903bed27a226eb12ebed17cd to your computer and use it in GitHub Desktop.
// Author: Ae
// License: MIT
uniform vec2 direction; // = vec2(-1.0, 1.0)
const float smoothness = 0.5;
const vec2 center = vec2(0.5, 0.5);
vec4 transition (vec2 uv) {
vec2 v = normalize(direction);
v /= abs(v.x) + abs(v.y);
float d = v.x * center.x + v.y * center.y;
float m = 1.0 - smoothstep(-smoothness, 0.0, v.x * uv.x + v.y * uv.y - (d - 0.5 + progress * (1.0 + smoothness)));
return mix(getFromColor((uv - 0.5) * (1.0 - m) + 0.5), getToColor((uv - 0.5) * m + 0.5), m);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment