1
Fork 0
mirror of https://github.com/RGBCube/rgbcube.github.io synced 2025-07-27 00:47:44 +00:00

Spin cube if no mouse event in the last 10 seconds

This commit is contained in:
RGBCube 2023-12-19 20:20:35 +03:00
parent 2373215028
commit 9207036cb9
No known key found for this signature in database

View file

@ -111,7 +111,7 @@ const orientation = {
{ {
const mouse = { const mouse = {
down: false, down: false,
lastMove: 0, lastMove: -10_000,
previous: null, previous: null,
}; };
@ -207,6 +207,10 @@ const orientation = {
velocity.z = 0; velocity.z = 0;
} }
if (window.performance.now() - mouse.lastMove > 10_000) {
velocity = new Vec3(1, 1, -1);
}
const axis = new Vec3(velocity.x, velocity.y, velocity.z) const axis = new Vec3(velocity.x, velocity.y, velocity.z)
.normalize() .normalize()
.scale(theta); .scale(theta);