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:
parent
2373215028
commit
9207036cb9
1 changed files with 5 additions and 1 deletions
6
cube.js
6
cube.js
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue