Revert "protect zaps from webgl occasionally being unavailable"

This reverts commit b5828cdf94.
This commit is contained in:
keyan 2023-11-01 11:57:17 -05:00
parent b5bf3299f2
commit 8881b19e45
1 changed files with 17 additions and 22 deletions

View File

@ -57,26 +57,22 @@ export function Ghost ({ onDone }) {
const texture = textureRef.current
if (canvas.ghost) return
try {
canvas.ghost = new GhostCanvas(canvas, texture, {
size: getRandom(0.025, 0.075),
tail: {
dotsNumber: 25, // Math.floor(getRandom(10, 50)),
spring: 1.4, // getRandom(1, 1.8),
friction: 0.25, // getRandom(0.1, 0.25),
maxGravity: 250,
gravity: getRandom(5, 250)
},
smile: 1,
mainColor: [getRandom(0.8, 1), getRandom(0.8, 1), getRandom(0.8, 1)],
borderColor: [getRandom(0, 0.2), getRandom(0, 0.2), getRandom(0, 0.2)], // [0.2, 0.5, 0.7],
isFlatColor: false,
onDone
})
} catch (e) {
console.error(e)
}
}, [canvasRef, textureRef, onDone])
canvas.ghost = new GhostCanvas(canvas, texture, {
size: getRandom(0.025, 0.075),
tail: {
dotsNumber: 25, // Math.floor(getRandom(10, 50)),
spring: 1.4, // getRandom(1, 1.8),
friction: 0.25, // getRandom(0.1, 0.25),
maxGravity: 250,
gravity: getRandom(5, 250)
},
smile: 1,
mainColor: [getRandom(0.8, 1), getRandom(0.8, 1), getRandom(0.8, 1)],
borderColor: [getRandom(0, 0.2), getRandom(0, 0.2), getRandom(0, 0.2)], // [0.2, 0.5, 0.7],
isFlatColor: false,
onDone
})
}, [])
return (
<>
@ -141,7 +137,6 @@ const GhostCanvas = (canvas, texture, params) => {
let uniforms
const gl = initShader()
if (!gl) return
function generateRandomPath () {
const startPoint = {
@ -172,7 +167,7 @@ const GhostCanvas = (canvas, texture, params) => {
const path = generateRandomPath()
let currentPathIndex = 0
let pathStartTime = null
const segmentDuration = getRandom(750, 1500) // How long each Bezier segment should take
const segmentDuration = getRandom(750, 3000) // How long each Bezier segment should take
function evaluateBezier (bezier, t) {
const [p0, p1, p2, p3] = bezier