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

Function SplashCursor

src/tailwind/Animations/SplashCursor/SplashCursor.jsx:4–1072  ·  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
24 useEffect(() => {
25 const canvas = canvasRef.current;
26 if (!canvas) return;
27
28 function pointerPrototype() {
29 this.id = -1;
30 this.texcoordX = 0;
31 this.texcoordY = 0;
32 this.prevTexcoordX = 0;
33 this.prevTexcoordY = 0;
34 this.deltaX = 0;
35 this.deltaY = 0;
36 this.down = false;
37 this.moved = false;
38 this.color = [0, 0, 0];
39 }
40
41 let config = {
42 SIM_RESOLUTION,
43 DYE_RESOLUTION,
44 CAPTURE_RESOLUTION,
45 DENSITY_DISSIPATION,
46 VELOCITY_DISSIPATION,
47 PRESSURE,
48 PRESSURE_ITERATIONS,
49 CURL,
50 SPLAT_RADIUS,
51 SPLAT_FORCE,
52 SHADING,
53 COLOR_UPDATE_SPEED,
54 PAUSED: false,
55 BACK_COLOR,
56 TRANSPARENT,
57 RAINBOW_MODE,
58 COLOR
59 };
60
61 let pointers = [new pointerPrototype()];

Callers

nothing calls this directly

Calls 12

getWebGLContextFunction · 0.70
compileShaderFunction · 0.70
updateKeywordsFunction · 0.70
initFramebuffersFunction · 0.70
scaleByPixelRatioFunction · 0.70
updatePointerDownDataFunction · 0.70
clickSplatFunction · 0.70
generateColorFunction · 0.70
updateFrameFunction · 0.70
updatePointerMoveDataFunction · 0.70
updatePointerUpDataFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected