openvibers/openvibe.games Commits

Motion: Calm reduces, only Off stops (#351)

OP OpenVibers committed 3 days ago · 3e0c126bc9 · 11 files, +37 −42

* Motion: Calm reduces, only Off stops

Bump openvibe-shared to 4.183.0 (apps/server and the pnpm lock) and delete the
reduced-motion rules that stopped the splash ring, the HUD and the chat lines.
Calm now plays them; the engine's motionScale is 0.35 under Calm and 0 only
with motion off, and the splash ring's finished state belongs to Off.

* Pin: name openvibe-shared 4.183.0 in README and STATUS

Changes

ddiff --git a/README.md b/README.md
iindex c4b43eb..83dc86a 100644
---- a/README.md
++++ b/README.md
@@@ -306,6 +306,6 @@ between services.
<!-- versions:start -->
- openvibe-contracts: v0.384.0
- openvibe-sdk: v0.125.0
--- openvibe-shared: v4.179.0
++- openvibe-shared: v4.183.0
- openvibe-publishing: v1.7.0
<!-- versions:end -->
ddiff --git a/STATUS.json b/STATUS.json
iindex 003cbc1..a78a9bf 100644
---- a/STATUS.json
++++ b/STATUS.json
@@@ -6,7 +6,7 @@
"runtime": "node 22, TypeScript (tsx), pnpm workspace; Babylon.js (client) + deterministic Rapier physics; PostgreSQL 18 via openvibe-sdk/db (pg, or embedded PGlite in development); Valkey optional",
"port": 8000,
"domain": "openvibe.games, play.openvibe.games",
-- "contracts": "openvibe-contracts v0.384.0, openvibe-sdk v0.125.0, openvibe-shared v4.179.0, openvibe-publishing v1.7.0 (apps/server/package.json)",
++ "contracts": "openvibe-contracts v0.384.0, openvibe-sdk v0.125.0, openvibe-shared v4.183.0, openvibe-publishing v1.7.0 (apps/server/package.json)",
"capabilities": [
"games.mod.manage",
"games.mod.read",
ddiff --git a/apps/client/casual.html b/apps/client/casual.html
iindex c93eba8..d7ccabd 100644
---- a/apps/client/casual.html
++++ b/apps/client/casual.html
@@@ -106,13 +106,7 @@
transform: translateX(250%);
}
}
-- @media (prefers-reduced-motion: reduce) {
-- .splash-ring::after {
-- animation: none;
-- width: 100%;
-- opacity: 0.6;
-- }
-- }
++ html[data-ov-motion=off] .splash-ring::after{width: 100%;opacity: 0.6}
</style>
</head>
<body>
ddiff --git a/apps/client/src/casual/casual.css b/apps/client/src/casual/casual.css
iindex 903d9b4..ca674a0 100644
---- a/apps/client/src/casual/casual.css
++++ b/apps/client/src/casual/casual.css
@@@ -1732,10 +1732,3 @@
opacity: 0;
}
--@media (prefers-reduced-motion: reduce) {
-- .cg *,
-- .toast {
-- animation: none !important;
-- transition: none !important;
-- }
--}
ddiff --git a/apps/client/src/ui/chat.css b/apps/client/src/ui/chat.css
iindex e95fa17..2d0818b 100644
---- a/apps/client/src/ui/chat.css
++++ b/apps/client/src/ui/chat.css
@@@ -106,8 +106,6 @@
color: var(--g-team-text, #7cc4ff);
}
--@media (prefers-reduced-motion: reduce) {
-- .chat:not(.is-open) .chat-line {
-- animation-timing-function: steps(1, end);
-- }
++html[data-ov-motion=reduced] .chat:not(.is-open) .chat-line {
++ animation-timing-function: steps(1, end);
}
ddiff --git a/apps/client/src/ui/console.css b/apps/client/src/ui/console.css
iindex dee6286..5202b07 100644
---- a/apps/client/src/ui/console.css
++++ b/apps/client/src/ui/console.css
@@@ -29,11 +29,6 @@
opacity: 0;
}
}
--@media (prefers-reduced-motion: reduce) {
-- .ovg-console {
-- animation: none;
-- }
--}
.ovg-console[hidden] {
display: none;
}
ddiff --git a/apps/client/src/ui/styles.css b/apps/client/src/ui/styles.css
iindex 3d7ce78..3b35bab 100644
---- a/apps/client/src/ui/styles.css
++++ b/apps/client/src/ui/styles.css
@@@ -7,7 +7,7 @@
world whatever the theme, so they read on any scene. The display
preferences apply too: text size scales every font size here
(calc(Npx * var(--ov-text-scale, 1))),
-- calm motion stills its animations (html[data-ov-motion=reduced]);
++ motion off stills its animations (html[data-ov-motion=off]), Calm scales them down;
src/ui/theme.ts tells the engine the rest. */
:root {
--g-accent: var(--accent, #f0b040);
ddiff --git a/apps/client/src/ui/theme.test.ts b/apps/client/src/ui/theme.test.ts
iindex dd34aab..f158457 100644
---- a/apps/client/src/ui/theme.test.ts
++++ b/apps/client/src/ui/theme.test.ts
@@@ -19,8 +19,14 @@ describe("the player's OpenVibe display preferences in the engine", () => {
document.documentElement.setAttribute('data-ov-motion', 'reduced') // the theme loader, after a change on any site
await flush()
expect(calm()).toBe(true)
-- expect(motionScale()).toBe(0.2)
++ expect(motionScale()).toBe(0.35)
window.dispatchEvent(new Event('ov:display'))
++ document.documentElement.setAttribute('data-ov-motion', 'off')
++ window.dispatchEvent(new Event('ov:display'))
++ expect(motionScale()).toBe(0)
++ document.documentElement.setAttribute('data-ov-motion', 'full')
++ window.dispatchEvent(new Event('ov:display'))
++ expect(motionScale()).toBe(1)
document.documentElement.removeAttribute('data-ov-motion')
await flush()
expect(motionScale()).toBe(1)
ddiff --git a/apps/client/src/ui/theme.ts b/apps/client/src/ui/theme.ts
iindex bea1155..a405904 100644
---- a/apps/client/src/ui/theme.ts
++++ b/apps/client/src/ui/theme.ts
@@@ -3,7 +3,8 @@
*
* Every page runs the shared theme loader (theme-loader.js), which paints the theme someone picked on any OpenVibe site
* onto <html> (the HUD's CSS reads those tokens: styles.css :root --g-*) and keeps their display preferences: text size
-- * (--ov-text-scale, also read by the CSS) and calm motion (html[data-ov-motion=reduced]). This module is what CSS cannot
++ * (--ov-text-scale, also read by the CSS) and motion (html[data-ov-motion=reduced|off); Calm scales the engine's
++ * motion down, only Off stops it). This module is what CSS cannot
* reach: how much of the engine's own decorative motion to keep (the weapon's bob and sway, the hit wobble), current as
* the person changes it in another tab or on another site, and the theme's colours for anything drawn on a canvas.
*/
@@@ -14,7 +15,9 @@ const listeners = new Set<(calm: boolean) => void>()
function read(): boolean {
if (typeof document === 'undefined') return false
-- if (document.documentElement.getAttribute('data-ov-motion') === 'reduced') return true
++ const attr = document.documentElement.getAttribute('data-ov-motion')
++ if (attr === 'reduced' || attr === 'off') return true
++ if (attr === 'full') return false
try {
return (
typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches
@@@ -24,6 +27,12 @@ function read(): boolean {
}
}
++/** Motion off is the only setting that stops the engine's motion. */
++function offNow(): boolean {
++ if (typeof document === 'undefined') return false
++ return document.documentElement.getAttribute('data-ov-motion') === 'off'
++}
++
function refresh(): void {
const c = read()
if (c === calmNow) return
@@@ -52,15 +61,15 @@ function start(): void {
}
}
--/** Calm motion is on (the OpenVibe setting or the system's reduced-motion setting). */
++/** Calm or Off is on (the OpenVibe setting, or the system's reduced-motion setting with Automatic). */
export function calm(): boolean {
start()
return calmNow
}
--/** How much of the engine's decorative motion to keep: 1, or 0.2 when calm. */
++/** How much of the engine's decorative motion to keep: 1, 0.35 under Calm (shared's --ov-move), 0 with motion off. */
export function motionScale(): number {
-- return calm() ? 0.2 : 1
++ return offNow() ? 0 : calm() ? 0.35 : 1
}
/** Called with the new value whenever calm motion turns on or off; returns a function that stops it. */
ddiff --git a/apps/server/package.json b/apps/server/package.json
iindex fa47f12..117d57f 100644
---- a/apps/server/package.json
++++ b/apps/server/package.json
@@@ -24,7 +24,7 @@
"openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.384.0",
"openvibe-publishing": "https://codeload.github.com/OpenVibers/OpenVibe.Publishing/tar.gz/refs/tags/v1.7.0",
"openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0",
-- "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0",
++ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0",
"pg": "^8.23.0",
"quickjs-emscripten": "0.32.0",
"tsx": "^4.19.3",
ddiff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
iindex 95b1291..fb41aab 100644
---- a/pnpm-lock.yaml
++++ b/pnpm-lock.yaml
@@@ -128,13 +128,13 @@ importers:
version: https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.384.0
openvibe-publishing:
specifier: https://codeload.github.com/OpenVibers/OpenVibe.Publishing/tar.gz/refs/tags/v1.7.0
-- version: https://codeload.github.com/OpenVibers/OpenVibe.Publishing/tar.gz/refs/tags/v1.7.0(openvibe-sdk@https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected]))(openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0)
++ version: https://codeload.github.com/OpenVibers/OpenVibe.Publishing/tar.gz/refs/tags/v1.7.0(openvibe-sdk@https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected]))(openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0)
openvibe-sdk:
specifier: https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0
version: https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected])
openvibe-shared:
-- specifier: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0
-- version: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0
++ specifier: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0
++ version: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0
pg:
specifier: ^8.23.0
version: 8.23.0
@@@ -1449,9 +1449,9 @@ packages:
pg:
optional: true
-- openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0:
-- resolution: {tarball: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0}
-- version: 4.179.0
++ openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0:
++ resolution: {tarball: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0}
++ version: 4.183.0
hasBin: true
@@@ -2935,11 +2935,11 @@ snapshots:
ajv: 8.20.0
ajv-formats: 3.0.1([email protected])
-- openvibe-publishing@https://codeload.github.com/OpenVibers/OpenVibe.Publishing/tar.gz/refs/tags/v1.7.0(openvibe-sdk@https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected]))(openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0):
++ openvibe-publishing@https://codeload.github.com/OpenVibers/OpenVibe.Publishing/tar.gz/refs/tags/v1.7.0(openvibe-sdk@https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected]))(openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0):
dependencies:
openvibe-sdk: https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected])
optionalDependencies:
-- openvibe-shared: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0
++ openvibe-shared: https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0
openvibe-sdk@https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.125.0(@electric-sql/[email protected])([email protected])([email protected]):
optionalDependencies:
@@@ -2947,7 +2947,7 @@ snapshots:
iovalkey: 0.4.0
pg: 8.23.0
-- openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.179.0:
++ openvibe-shared@https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.183.0:
dependencies:
jsonwebtoken: 9.0.3
linkedom: 0.18.14