1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-07-30 20:47:46 +00:00

cube: make impulseIdle a global

This commit is contained in:
RGBCube 2025-06-03 04:02:33 +03:00
parent 217f19841f
commit 2ccbbf3a17
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M

View file

@ -141,6 +141,7 @@
let velocity = Vec.ZERO;
let impulseThisFrame = Vec.ZERO;
let impulseIdle = Vec(0.7, 0.7, -0.7);
const handleUp = () => {
mouse.down = false;
@ -254,8 +255,7 @@
}
if (globalThis.performance.now() - mouse.lastMove > screensaverTimeoutMs) {
const impulse = Vec(0.7, 0.7, -0.7);
velocity = Vec.sum(impulse.scale(effectiveDelta * 3), velocity);
velocity = Vec.sum(impulseIdle.scale(effectiveDelta * 3), velocity);
}
const axis = Vec(velocity.x, velocity.y, velocity.z)