From d910e2e49d791e5e40241292e3a07a54236ab744 Mon Sep 17 00:00:00 2001 From: serge Date: Mon, 1 Aug 2022 19:05:51 +1000 Subject: [PATCH] animation length --- js/regl/ripplesPass.js | 2 +- shaders/glsl/ripplesPass.frag.glsl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/regl/ripplesPass.js b/js/regl/ripplesPass.js index a5a88d0..deab724 100644 --- a/js/regl/ripplesPass.js +++ b/js/regl/ripplesPass.js @@ -18,7 +18,7 @@ export default ({ regl, config }, inputs) => { tex: inputs.primary, bloomTex: inputs.bloom, intensity: ()=>{ - let inten = 2 - (Date.now() - window.ripples[0])/2000 + let inten = 1 - (Date.now() - window.ripples[0])/4000 if (inten < 0) inten = 0 return inten / 10 }, diff --git a/shaders/glsl/ripplesPass.frag.glsl b/shaders/glsl/ripplesPass.frag.glsl index 2663b65..e76dce0 100644 --- a/shaders/glsl/ripplesPass.frag.glsl +++ b/shaders/glsl/ripplesPass.frag.glsl @@ -14,8 +14,9 @@ void main() { -1. + 2.* gl_FragCoord.x /iResolution.x - centerW, -1. + 2.* gl_FragCoord.y /iResolution.y + centerH ); - float cl = length(cp); - vec2 uv = gl_FragCoord.xy / iResolution.xy + (cp / cl / 4. ) * sin(cl*10. - time * 12.) * intensity*.5; + float cl = length(cp);//*(intensity+1.)*.9; + vec2 uv = gl_FragCoord.xy / iResolution.xy + (cp / cl / 2. ) * sin(cl*15. - time * 10.) * intensity*.5; vec3 col = texture2D(tex, uv).xyz + texture2D(bloomTex, uv).xyz;; + col.y = col.x; col.x = 0.; col.z = 0.; gl_FragColor = vec4(col,1.0); } \ No newline at end of file