1
Fork 0
mirror of https://github.com/RGBCube/rgbcube.github.io synced 2025-07-25 16:07:45 +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 = {
down: false,
lastMove: 0,
lastMove: -10_000,
previous: null,
};
@ -207,6 +207,10 @@ const orientation = {
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)
.normalize()
.scale(theta);