Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float udRoundBox( vec2 p, vec2 b, float r )
- {
- return length(max(abs(p)-b+r,0.0))-r;
- }
- void mainImage( out vec4 fragColor, in vec2 fragCoord )
- {
- // setup
- float t = 0.2 + 0.2 * sin(mod(iTime, 2.0 * PI) - 0.5 * PI);
- float iRadius = min(iResolution.x, iResolution.y) * (0.05 + t);
- vec2 halfRes = 0.5 * iResolution.xy;
- // compute box
- float b = udRoundBox( fragCoord.xy - halfRes, halfRes, iRadius );
- // colorize (red / black )
- vec3 c = mix( vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0,1.0,b) );
- fragColor = vec4( c, 1.0 );
- }
- float udRoundBox( float2 p, float2 b, float r )
- {
- return length(max(abs(p)-b+r,0.0))-r;
- }
- float4 cornerRadius(sampler_h src) {
- float2 greenCoord = src.coord(); // this is alreay in relative coords; no need to devide by image size
- float t = 0.5;
- float iRadius = min(greenCoord.x, greenCoord.y) * (t);
- float2 halfRes = float2(greenCoord.x * 0.5, greenCoord.y * 0.5);
- float b = udRoundBox( float2(greenCoord.x - halfRes.x, greenCoord.y - halfRes.y), halfRes, iRadius );
- float3 c = mix(float3(1.0,0.0,0.0), float3(0.0,0.0,0.0), smoothstep(0.0,1.0,b) );
- return float4(c, 1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement