Healthbar
View fullpage shaderEditor
#define PI 3.1415926535
#define BPM 130.0
varying vec2 v_uv;
uniform float u_time;
uniform vec2 u_resolution;
/// https://iquilezles.org/articles/distfunctions2d/
float sdBox( in vec2 p, in vec2 b )
{
vec2 d = abs(p)-b;
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
}
float i_lerp(float value, float min_val, float max_val)
{
return (value - min_val) / (max_val - min_val);
}
float remap(float value, float in_min, float in_max, float out_min, float out_max)
{
float t = i_lerp(value, in_min, in_max);
return mix(out_min, out_max, t);
}
void main()
{
vec2 pixel_coords = (v_uv - 0.5) * u_resolution;
float hbar_length = (u_resolution.x / 2.0) / 100.0 * 80.0;
float hbar_height = (u_resolution.y / 2.0) / 100.0 * 10.0;
vec3 color = vec3(0.3, 0.5, 0.9);
float time = u_time * (BPM * 0.01);
float glow_outline = 32.0;
/// healthbar bg