Rotate the background with every track
The poster behind the frame was one of two, picked by hand and then left there all night. It now turns over on every track change the way the animations do, and never as the same picture twice: a shuffle bag over whatever images sit in assets/, each shown at a random zoom between 1.15 and 1.9 and cropped around a randomly chosen point of the poster. The list is read from the directory rather than written out in config.js. The old one named two files that are no longer there, which is the failure mode a hand-kept list has; now a poster joins the rotation, with its own button on the queue page, by being dropped in the folder. Zoom never goes below 1.15. These are portrait prints and the screen is wide, so cover fits the poster's full width and crops vertically — at 1 the paper margin shows as a grey stripe down both sides. 1.15 cuts at least 13% off the width of every crop a 1920x1080 screen can produce. The crop is drawn into a screen-sized canvas rather than handed to CSS as an object-fit rule on a full-size <img>. The scans are 3508x4950, which is a 70MB texture per layer and two of them composited for the length of the fade; instead each pick is fetched, resized off the main thread to roughly screen resolution, drawn once, and closed. A swap costs about 400ms of async work, all of it before the fade begins, and no full-size bitmap is held anywhere. Nothing about the posters' resolution reaches the compositor, so assets/ can keep the 300 dpi originals. Backgrounds pin and unpin like animations: DEFAULT_BACKGROUND is now the auto cycle, the queue page's row leads with Auto, and isBackground() guards the socket handler and the restored queue.json against a key that no longer names a file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H9v2Xoa6eoeGYpK6gp95k9
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { connect, formatDuration } from '/shared/socket.js';
|
||||
import { BACKGROUNDS, ANIMATIONS, AUTO_ANIMATION } from '/config.js';
|
||||
import { BACKGROUNDS, AUTO_BACKGROUND, ANIMATIONS, AUTO_ANIMATION } from '/config.js';
|
||||
|
||||
let state = { items: [], currentId: null, background: 'pink', animation: AUTO_ANIMATION };
|
||||
let state = { items: [], currentId: null, background: AUTO_BACKGROUND, animation: AUTO_ANIMATION };
|
||||
// Last playhead report, kept with its arrival time so the countdown can be
|
||||
// extrapolated smoothly between the 1 Hz updates.
|
||||
let progress = { id: null, currentTime: 0, at: 0 };
|
||||
@@ -209,15 +209,18 @@ function buildSwitcher(box, options, type, currentKey) {
|
||||
};
|
||||
}
|
||||
|
||||
// Auto leads in both rows: it is the normal party setting, the named ones are
|
||||
// for holding still on one while you look at it.
|
||||
const renderBackground = buildSwitcher(
|
||||
backgroundBox,
|
||||
Object.entries(BACKGROUNDS).map(([key, { label }]) => [key, label]),
|
||||
[
|
||||
[AUTO_BACKGROUND, 'Auto'],
|
||||
...Object.entries(BACKGROUNDS).map(([key, { label }]) => [key, label]),
|
||||
],
|
||||
'setBackground',
|
||||
() => state.background,
|
||||
);
|
||||
|
||||
// Auto leads: it is the normal party setting, the named ones are for testing
|
||||
// a single animation without waiting for the cycle to land on it.
|
||||
const renderAnimation = buildSwitcher(
|
||||
animationBox,
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user