MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / splat

Function splat

src/tailwind/Animations/SplashCursor/SplashCursor.jsx:821–835  ·  view source on GitHub ↗
(x, y, dx, dy, color)

Source from the content-addressed store, hash-verified

819 }
820
821 function splat(x, y, dx, dy, color) {
822 splatProgram.bind();
823 gl.uniform1i(splatProgram.uniforms.uTarget, velocity.read.attach(0));
824 gl.uniform1f(splatProgram.uniforms.aspectRatio, canvas.width / canvas.height);
825 gl.uniform2f(splatProgram.uniforms.point, x, y);
826 gl.uniform3f(splatProgram.uniforms.color, dx, dy, 0.0);
827 gl.uniform1f(splatProgram.uniforms.radius, correctRadius(config.SPLAT_RADIUS / 100.0));
828 blit(velocity.write);
829 velocity.swap();
830
831 gl.uniform1i(splatProgram.uniforms.uTarget, dye.read.attach(0));
832 gl.uniform3f(splatProgram.uniforms.color, color.r, color.g, color.b);
833 blit(dye.write);
834 dye.swap();
835 }
836
837 function correctRadius(radius) {
838 let aspectRatio = canvas.width / canvas.height;

Callers 2

splatPointerFunction · 0.70
clickSplatFunction · 0.70

Calls 2

correctRadiusFunction · 0.70
bindMethod · 0.45

Tested by

no test coverage detected