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

Function SplashCursor

src/content/Animations/SplashCursor/SplashCursor.jsx:4–1084  ·  view source on GitHub ↗
({
  SIM_RESOLUTION = 128,
  DYE_RESOLUTION = 1440,
  CAPTURE_RESOLUTION = 512,
  DENSITY_DISSIPATION = 3.5,
  VELOCITY_DISSIPATION = 2,
  PRESSURE = 0.1,
  PRESSURE_ITERATIONS = 20,
  CURL = 3,
  SPLAT_RADIUS = 0.2,
  SPLAT_FORCE = 6000,
  SHADING = true,
  COLOR_UPDATE_SPEED = 10,
  BACK_COLOR = { r: 0.5, g: 0, b: 0 },
  TRANSPARENT = true,
  RAINBOW_MODE = true,
  COLOR = '#ff0000'
})

Source from the content-addressed store, hash-verified

2import { useEffect, useRef } from 'react';
3
4function SplashCursor({
5 SIM_RESOLUTION = 128,
6 DYE_RESOLUTION = 1440,
7 CAPTURE_RESOLUTION = 512,
8 DENSITY_DISSIPATION = 3.5,
9 VELOCITY_DISSIPATION = 2,
10 PRESSURE = 0.1,
11 PRESSURE_ITERATIONS = 20,
12 CURL = 3,
13 SPLAT_RADIUS = 0.2,
14 SPLAT_FORCE = 6000,
15 SHADING = true,
16 COLOR_UPDATE_SPEED = 10,
17 BACK_COLOR = { r: 0.5, g: 0, b: 0 },
18 TRANSPARENT = true,
19 RAINBOW_MODE = true,
20 COLOR = '#ff0000'
21}) {
22 const canvasRef = useRef(null);
23 const animationFrameId = useRef(null);
24
25 useEffect(() => {
26 const canvas = canvasRef.current;
27 if (!canvas) return;
28
29 // Track if the effect is still active for cleanup
30 let isActive = true;
31
32 function pointerPrototype() {
33 this.id = -1;
34 this.texcoordX = 0;
35 this.texcoordY = 0;
36 this.prevTexcoordX = 0;
37 this.prevTexcoordY = 0;
38 this.deltaX = 0;
39 this.deltaY = 0;
40 this.down = false;
41 this.moved = false;
42 this.color = [0, 0, 0];
43 }
44
45 let config = {
46 SIM_RESOLUTION,
47 DYE_RESOLUTION,
48 CAPTURE_RESOLUTION,
49 DENSITY_DISSIPATION,
50 VELOCITY_DISSIPATION,
51 PRESSURE,
52 PRESSURE_ITERATIONS,
53 CURL,
54 SPLAT_RADIUS,
55 SPLAT_FORCE,
56 SHADING,
57 COLOR_UPDATE_SPEED,
58 PAUSED: false,
59 BACK_COLOR,
60 TRANSPARENT,
61 RAINBOW_MODE,

Callers

nothing calls this directly

Calls 6

getWebGLContextFunction · 0.70
compileShaderFunction · 0.70
updateKeywordsFunction · 0.70
initFramebuffersFunction · 0.70
updateFrameFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected