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:
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 = {
|
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue