diff --git a/config.js b/config.js index 394608c..4053f3a 100644 --- a/config.js +++ b/config.js @@ -121,9 +121,14 @@ const IMAGE_TYPES = new Set(['.jpg', '.jpeg', '.png', '.webp', '.avif']); const LOGO_FILE = 'logo.png'; export const LOGO_SRC = `/assets/${LOGO_FILE}`; -// How much of the screen's width the logo spans, centred. +// How much of the screen's width the logo spans. export const LOGO_WIDTH = 0.6; +// The lettering does not sit in the middle of its own image, so centring the +// image leaves the logo looking pushed to one side. This nudges it back, as a +// fraction of the logo's width — positive moves it right. +export const LOGO_OFFSET = 0.1; + function readBackgrounds() { let files; try { diff --git a/public/player/backdrop.js b/public/player/backdrop.js index 2fb9e3c..6d6136c 100644 --- a/public/player/backdrop.js +++ b/public/player/backdrop.js @@ -19,20 +19,23 @@ import { BACKGROUND_MAX_OVERSAMPLE, LOGO_SRC, LOGO_WIDTH, + LOGO_OFFSET, } from '/config.js'; import { createPicker } from './motion.js'; const KEYS = Object.keys(BACKGROUNDS); /** - * Point the logo overlay at the configured file and size it against the - * screen. The element is in the page from the start — only the two values that - * belong to the config are set here. + * Point the logo overlay at the configured file, size it against the screen + * and nudge it off centre. The element is in the page from the start — only + * the values that belong to the config are set here. The offset is a fraction + * of the logo's own width, which is what a percentage in the translate means. */ export function showLogo(element) { if (!element) return; element.src = LOGO_SRC; element.style.width = `${LOGO_WIDTH * 100}vw`; + element.style.setProperty('--logo-shift', `${LOGO_OFFSET * 100}%`); } /** diff --git a/public/player/player.css b/public/player/player.css index 485426d..c2ed036 100644 --- a/public/player/player.css +++ b/public/player/player.css @@ -49,7 +49,10 @@ body { position: fixed; top: 50%; left: 50%; - translate: -50% -50%; + /* Centred, then nudged sideways by LOGO_OFFSET, which backdrop.js writes + onto the element. */ + --logo-shift: 0%; + translate: calc(-50% + var(--logo-shift)) -50%; height: auto; /* Only bites on a screen too short for the width above — on the projector the width is what decides. */