Animations have a speed setting rather than an on/off toggle

This commit is contained in:
James Babcock committed 2026-10-03 14:40:52 -07:00
1 parent 682a8e964d
commit 9b0bf77d79
15 files changed
+110 -45

No files matched your search

+11 -8
View File
@@ -1,18 +1,21 @@
import { scaleAnimationDuration, type AnimationSpeed } from "./animation-speed";
/**
* Whether menus and icon grids animate on the glasses (Settings > Customization >
* How fast menus and icon grids animate on the glasses (Settings > Customization >
* Animations > Menu animation). The motion classes can't read the settings
* store themselves (it is native, and they load under Node in unit tests),
* so ui/menu.ts installs a reader in each isolate that paints menus. Without
* one, menus animate.
* one, menus animate at Normal speed.
*/
export const MENU_ANIMATION_KEY = "display.menuAnimation";
export const MENU_ANIMATION_KEY = "display.menuAnimationSpeed";
let readMenuAnimation: () => boolean = () => true;
let readMenuAnimationSpeed: () => AnimationSpeed = () => "normal";
export function menuAnimationEnabled(): boolean {
return readMenuAnimation();
/** A menu animation's Normal-speed duration at the configured speed; 0 when menu animation is disabled. */
export function menuAnimationDurationMs(normalMs: number): number {
return scaleAnimationDuration(normalMs, readMenuAnimationSpeed());
}
export function setMenuAnimationReader(read: () => boolean): void {
readMenuAnimation = read;
export function setMenuAnimationReader(read: () => AnimationSpeed): void {
readMenuAnimationSpeed = read;
}