fix:(game) Fixed constant refresh rate behavior

This commit is contained in:
Alex committed 2024-01-24 11:02:05 +01:00
1 parent 7daaf262aa
commit f5ebee224c
13 files changed
+598 -124

No files matched your search

+4 -4
View File
@@ -25,18 +25,18 @@ export const FlameParticle = ({ position, png, turboColor, delay = 0 }) => {
return geom;
}, [position]);
useFrame(({clock}) => {
useFrame(({clock}, delta) => {
if (!initialized) return;
pointsRef.current.position.y += 0.03;
pointsRef.current.position.z += 0.06;
pointsRef.current.position.y += 0.03 * delta * 144;
pointsRef.current.position.z += 0.06 * delta * 144;
if(pointsRef.current.position.y > 0.4) {
pointsRef.current.position.y = 0;
pointsRef.current.position.z = 0;
setOpacity(1);
}
if(opacity > 0) {
setOpacity((opacity) => opacity - 0.05);
setOpacity((opacity) => opacity - 0.05 * delta * 144);
}
});