Kurz gesagt
Eine Lokalzeitung im Stil der 1930er-Jahre, in der jedes Foto ein kurzer Stummfilm ist. Auf Papier sind es Standbilder; im 3D-Betrachter bewegen sie sich alle zugleich, immer wieder, wie eine Zeitung im Märchen.
Was Sie setzen
The Wexcombe Lantern, eine erfundene Wochenzeitung eines Seebads vom Juni 1933, auf einer Tabloidseite von 280 × 430 mm in vier durch Linien getrennten Spalten: ein schmaler Zeitungskopf, ein Aufmacher mit seinem Bild über drei Spalten, ein zweites Bild über zwei, Gezeitentabellen, Kleinanzeigen und eine Sportseite. Jedes Bild ist ein fünf Sekunden langer Schwarz-Weiß-Film. Im Druck und in den flachen Seiten unter dem Betrachter ist jedes sein erstes Einzelbild. In Folio als gefaltete Zeitung auf hellem Zeitungspapier geöffnet, bewegen sich die Bilder der offenen Seiten auf einmal und hören nicht auf: Der Bürgermeister spricht, die Fliegerin winkt, der Fischer lacht, der Torwart wirft sich und steht wieder auf. Die Seite zeichnet nichts; das Layout ist eine gewöhnliche Zeitung, und die Clips erledigen den Rest.
Dieses Rezept beantwortet
- Wie spiele ich mehrere stumme Videoschleifen gleichzeitig auf einer Seite ab und starte sie jedes Mal neu, wenn die Seite aufgeschlagen wird?
- Wie zeige ich eine Zeitung im 3D-Betrachter als gefaltete Bögen, mit dem Wirtschaftsteil auf lachsfarbenem Papier?
Die kurze Antwort
// A video resource prints its poster (the first frame) on the flat page. In Folio, and in the
// HTML viewer, the poster comes alive: autoplay starts it muted when its page is on show, loop
// keeps it going, and exclusive: false lets it run alongside the other clips instead of
// pausing them, as one exclusive player at a time would.
const videoStyle = {
playMark: { enabled: false }, // a press photograph, not a play button
qr: { enabled: false }, // the clips live on the page, not behind a link
linkPoster: false,
player: { autoplay: true, loop: true, muted: true, exclusive: false, controls: false },
};
const clip = (id, url, [w, h], placement, caption, altText) => ({ id, typeId: 'picture',
kind: 'video', createdAt: 0, updatedAt: 0, caption, altText, placement,
video: { source: 'file', fileId: `${id}-loop.mp4`, url, // url: where the clip plays from
format: 'mp4', width: w, height: h, duration: 5,
poster: { fileId: `${id}-poster.jpg`, format: 'jpeg', width: w, height: h } } });
Zutaten
- Funktionen
- Videos, die nebeneinander laufenDrei oder mehr SpaltenVideos als RessourcenVideo-Vorschaubilder: Abspielzeichen und QR-CodeGleitobjekte über mehrere SpaltenZeitungsformateGefaltete Zeitung (Folio)3D-Buchbetrachter (Folio)Papier, Bindung, Tisch und Licht (Folio)Gestaltete AuftakteÜberschriftenformateÜberschriftenattributeText, Linien und Kästen in SeitengestaltungenKolumnentitel und SeitenzahlenSpaltenlinieKästenSpalten in einem Kasten oder im TextAbsatzformateQuellen- und Bildnachweise
- Nutzt außerdem
- Gleitende KästenAbbildungen genau hierKapitelband über die ganze BreitePapierfarbeEigene RessourcentypenAbbildungen und Tabellen als RessourcenKolumnentitel je AbschnittKästen über die Seite
- Schrift
- Libre Caslon Text, Oswald, Courier Prime (SIL OFL 1.1)
- Dateien
actress-loop.mp4actress-poster.jpgaviator-loop.mp4aviator-poster.jpgclock-loop.mp4clock-poster.jpgfisherman-loop.mp4fisherman-poster.jpgkeeper-loop.mp4keeper-poster.jpgmayor-loop.mp4mayor-poster.jpg- Mrs Edith Rowe speaks at the opening of the Harbour line: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg (Generated With Diffusion Models, CC BY 4.0)
- The first frame of the mayor loop, its printed picture (Generated With Diffusion Models, CC BY 4.0)
- The Guildhall clock tower: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg (Generated With Diffusion Models, CC BY 4.0)
- The first frame of the clock loop, its printed picture (Generated With Diffusion Models, CC BY 4.0)
- Skipper Jacob Hosking with the cod: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg (Generated With Diffusion Models, CC BY 4.0)
- The first frame of the fisherman loop, its printed picture (Generated With Diffusion Models, CC BY 4.0)
- Miss Constance Lacey in the cockpit: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg (Generated With Diffusion Models, CC BY 4.0)
- The first frame of the aviator loop, its printed picture (Generated With Diffusion Models, CC BY 4.0)
- Miss Rosalind Avery on the stage: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg (Generated With Diffusion Models, CC BY 4.0)
- The first frame of the actress loop, its printed picture (Generated With Diffusion Models, CC BY 4.0)
- Tom Rundle in goal: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg (Generated With Diffusion Models, CC BY 4.0)
- The first frame of the keeper loop, its printed picture (Generated With Diffusion Models, CC BY 4.0)
Zubereitung
#1 · Jedes Bild zu einem Clip machen, der mit den anderen läuft
Der Code steht oben in der kurzen Antwort. Eine Videoressource gibt ihr Vorschaubild als Bild aus, sodass die Clips den Platz von Fotos einnehmen und wie diese eine Legende erhalten. Drei Player-Optionen bringen die Seite in Bewegung: autoplay startet einen Clip, wenn seine Seite zu sehen ist (immer stumm, wie es Browser verlangen), loop spielt ihn wieder von vorn, und exclusive: false lässt ihn neben den anderen Clips laufen. Standardmäßig ist ein Video exklusiv: Wird es gestartet, pausiert alles andere, was läuft, und das passt zu einer Vorlesung, aber nicht zu einer Seite bewegter Fotos. Das Wiedergabesymbol und der QR-Code sind abgeschaltet, sodass die Clips auf Papier wie Pressefotos wirken.
#2 · Jeder Schleife ihren Platz im Raster geben
const resources = [
clip('mayor', asset('mayor-loop.mp4'), [640, 480],
{ position: 'top', span: 'column', columns: 3 },
'**Mrs Edith Rowe** speaks from the platform at the foot of Quay Hill before cutting '
+ 'the ribbon.',
'A woman in a dark coat and small hat speaks at a draped podium, one hand raised.'),
clip('clock', asset('clock-loop.mp4'), [480, 640],
{ position: 'top', span: 'column', columns: 2 },
'**Twelve o’clock** on the Guildhall tower, for the first time since 1924.',
'A stone clock tower against clouds, pigeons on its ledge.'),
clip('fisherman', asset('fisherman-loop.mp4'), [640, 480],
{ position: 'auto', span: 'column', columns: 2 },
'**Skipper Jacob Hosking** and the 82-pound cod on the quay.',
'An old fisherman in an oilskin laughs, holding up a huge cod.'),
clip('aviator', asset('aviator-loop.mp4'), [640, 480],
{ position: 'top', span: 'column', columns: 2 },
'**Miss Constance Lacey** waves from the cockpit on Wexcombe Common.',
'A young woman in a flying helmet waves from the open cockpit of a biplane.'),
clip('actress', asset('actress-loop.mp4'), [480, 640],
{ position: 'top', span: 'column', columns: 2 },
'**Miss Rosalind Avery** as Hester Lane, on the garden steps in Act III.',
'An actress in a long gown on a garden stage set, one arm outstretched.'),
clip('keeper', asset('keeper-loop.mp4'), [640, 480],
{ position: 'top', span: 'column', columns: 3 },
'**Tom Rundle** at Gannet Park, before the penalty he saved.',
'A goalkeeper in a flat cap crouches on his line in front of a packed terrace.'),
];
Das Layout ist layoutType: 'multiple' mit columnCount: 4. columns eines Gleitobjekts legt fest, wie viele davon es belegt: Bürgermeister und Torwart drei, Fliegerin, Uhrturm, Fischer und Schauspielerin zwei. Ein Gleitobjekt über mehrere Spalten nimmt den Kopf einer Folge leerer Spalten, die auf gleicher Höhe beginnen, oder den Fuß der Spalte, in der es zitiert wird, und der leeren Spalten danach; wo die Zeile ::resource steht, entscheidet also über den Platz. Der Bürgermeister wird nach dem ersten Absatz zitiert, was Spalte 1 dem Text überlässt und das Bild über die Spalten 2 bis 4 stellt.
#3 · Zeitungskopf und Ressortseiten setzen
const nameplate = { enabled: true, slot: { elements: [
depth(10), // the masthead is ten grid lines deep; the rules and the dateline hang from it
{ kind: 'rule', id: 'foot', thickness: pt(2.5), color: col('ink'),
placement: { ...at('#depth', 'align-bottom', 0, -1.5), size: { width: 'fill' } } },
...[['left', '{attr.issue}'], ['center', '{publishDate}'], ['right', '{attr.price}']].map(
([align, content]) => text(`date-${align}`, content, { ...typed(9, { fontWeight: 700 }),
align }, { ...at('#foot', 'above', 0, -1.6), size: { width: 'fill' } })),
rule('thin', '#date-left', 0.6, 1.8),
text('name', '{titleText}', { ...oswald(66, 700, { textTransform: 'uppercase',
letterSpacing: pt(1.5) }), lineHeight: 1, align: 'center' },
{ ...at('#thin', 'above', 0, -2), size: { width: 'fill' } }),
// Two ears over the name: the paper's age on the left, the weather on the right.
text('since', '{attr.since}', { ...caps(8, 600, 'flag'), align: 'left' },
{ ...at('container', 'top-left', 0, 1), size: { width: mm(90) } }),
text('weather', 'Weather: {attr.weather}', { ...typed(8.5, { italic: true }), align: 'right' },
{ ...at('container', 'top-right', 0, 1), size: { width: mm(110) } }),
] } };
Die Überschrift der Ebene 1 auf der Titelseite ist der Name der Zeitung, gezeichnet aus einem Gestaltungsfeld: zwei Ohren darüber, der Name in Versalien der Oswald und eine Datumszeile zwischen einer dünnen und einer kräftigen Linie. Die Innenseiten beginnen mit einer roten Ressortfahne auf einem 3-pt-Balken (der Bereich pages) und einer Paginazeile am Kopf jeder Seite außer der ersten.
#4 · Die Zeitung in Folio öffnen
const stage = Object.assign(document.createElement('section'),
{ id: 'folio', ariaLabel: 'The newspaper in 3D' });
stage.style.cssText = 'height: min(82vh, 820px); margin: 0 auto; max-width: 1280px';
document.getElementById('pages').before(stage);
createFolioFromDocument(stage, doc, {
// Folio plays each clip from its video.url, muted, while its page is on show.
appearance: { textureBaseUrl: 'https://postext.dev/folio/textures' },
onChange: ({ pages }) => kitStatus(`${doc.pages.length} pages · open at `
+ pages.map((i) => doc.pages[i].pageLabel || i + 1).join('–')),
});
config.folio legt die Zeitung bei Tageslicht auf Eiche: Zeitungspapier mit 45 g/m², durch das die nächste Seite durchscheint, und binding.type: 'folded', einmal gefaltete und ineinandergelegte Bogen ohne Heftklammern und ohne Rücken, wie eine Zeitung zusammengestellt wird. Folio zeichnet jeden Clip der offenen Doppelseite in eine Textur, bis zu acht gleichzeitig, startet die automatisch laufenden Schleifen jedes Mal, wenn ein Umblättern auf ihrer Seite zur Ruhe kommt, und hält sie an, wenn die Seite weggeblättert wird. Ein Klick auf ein exklusives Video spielt es weiterhin allein und mit Ton ab, und die Schleifen warten, bis es endet.
Das ganze Rezept
// ═══ Postext Cookbook · Nº 136 · A living newspaper of video loops ══════════════
// https://postext.dev/en/cookbook/living-newspaper-video-loops
// Code: MIT · Text: original (CC BY 4.0) · Clips: generated with diffusion models (CC BY 4.0)
// Fonts: Oswald, Libre Caslon Text, Courier Prime (SIL OFL 1.1) · Needs postext ≥ 1.28.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { createFolioFromDocument } from 'https://esm.sh/postext-folio';
const LANG = 'en'; // @lang: the language of the sample document ('en')
const RECIPE = 'living-newspaper-video-loops';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: newsprint, a warm black and a dark red for the flags
const palette = {
ink: '#16130f', // text, rules and the nameplate
paper: '#f3efe4', // newsprint, and type reversed out of ink or red
flag: '#8e1b14', // the one accent: section flags, kickers, the jump lines
tint: '#e6dfcf', // the In brief strip
rule: '#8f897c', // hairlines: the column rules
muted: '#5b554b', // bylines, captions' credits, the imprint
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [ // defaults link to 'main-color': point it at the ink, never blue
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'ink (defaults)', value: { hex: palette.ink, model: 'hex' } },
];
// #endregion
const MARGIN = { top: 12, bottom: 12, side: 12 }; // mm: a tabloid's narrow margins
const GUTTER = 4.5; // mm between the four columns
const LEAD = 11.6; // body leading in pt: the baseline grid
const oswald = (size, weight, look = {}) => ({ fontFamily: 'Oswald', fontSize: pt(size),
fontWeight: weight, color: col('ink'), ...look });
const caps = (size, weight, colour = 'ink') => oswald(size, weight, { color: col(colour),
textTransform: 'uppercase', letterSpacing: pt(size * 0.12) });
const typed = (size, look = {}) => ({ fontFamily: 'Courier Prime', fontSize: pt(size),
color: col('ink'), ...look }); // the dateline and the captions: a typewriter
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const text = (id, content, look, placement) => ({ kind: 'text', id, content, align: 'left',
overflow: 'wrap', color: col('ink'), ...look, placement }); // wraps, in a running head too
const rule = (id, under, weight, gap = 0) => ({ kind: 'rule', id, thickness: pt(weight),
color: col('ink'), placement: { ...at(under, 'above', 0, -gap), size: { width: 'fill' } } });
const depth = (lines) => ({ kind: 'box', id: 'depth', style: {}, placement: {
...at('container', 'top-left'), size: { width: 'fill', height: pt(lines * LEAD) } } });
// #region answer: every picture is a clip that loops, autoplays and plays with the others
// A video resource prints its poster (the first frame) on the flat page. In Folio, and in the
// HTML viewer, the poster comes alive: autoplay starts it muted when its page is on show, loop
Das zusammengesetzte script.js läuft unverändert: Fügen Sie es in das Modulskript einer beliebigen Seite ein, oder öffnen Sie das Rezept auf CodePen. Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)
Varianten
#Den Leser jeden Clip starten lassen
Ohne autoplay bleiben die Bilder still, bis der Leser eines anklickt; einmal gestartet, laufen die Schleifen weiterhin gemeinsam.
- player: { autoplay: true, loop: true, muted: true, exclusive: false, controls: false },
+ player: { loop: true, muted: true, exclusive: false, controls: false },#Ein exklusiver Clip mit Ton
Ein einzelnes Video kann den Standard behalten und nach eigenen Regeln laufen: Setzen Sie player: { exclusive: true, muted: false } im video dieser Ressource, und sein Start hält die Schleifen an, bis es endet.
#Ein Großformat in sechs Spalten
Die zweispaltige Titelseite setzt eine kleinere Zeitung mit Standfotos; dasselbe Raster nimmt auf einem großformatigen Endformat mit sizePreset: 'broadsheet' sechs Spalten auf.
Häufige Fehler
Ein Zeitungsressort ist eine Überschrift der Ebene 1, die eine Seite eröffnet, und ein Gleitobjekt überschreitet sie nie. Ein Bild, das auf der letzten Seite seines Ressorts keinen Platz findet, wird vor dem nächsten Ressort auf eine eigene Seite gesetzt, passen Sie den Text also auf die Seite ein: Hier springt die Straßenbahngeschichte auf Seite 2, statt die Fliegerin von der Titelseite zu verdrängen.
Nachweise
- Rezept
- Ignacio Ferro
- Text
- Eigener Text, CC BY 4.0
- Bilder
- Mrs Edith Rowe speaks at the opening of the Harbour line: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg · Generated With Diffusion Models · CC BY 4.0
- The first frame of the mayor loop, its printed picture · Generated With Diffusion Models · CC BY 4.0
- The Guildhall clock tower: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg · Generated With Diffusion Models · CC BY 4.0
- The first frame of the clock loop, its printed picture · Generated With Diffusion Models · CC BY 4.0
- Skipper Jacob Hosking with the cod: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg · Generated With Diffusion Models · CC BY 4.0
- The first frame of the fisherman loop, its printed picture · Generated With Diffusion Models · CC BY 4.0
- Miss Constance Lacey in the cockpit: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg · Generated With Diffusion Models · CC BY 4.0
- The first frame of the aviator loop, its printed picture · Generated With Diffusion Models · CC BY 4.0
- Miss Rosalind Avery on the stage: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg · Generated With Diffusion Models · CC BY 4.0
- The first frame of the actress loop, its printed picture · Generated With Diffusion Models · CC BY 4.0
- Tom Rundle in goal: a black-and-white loop of 5 s, a still generated from a text prompt and animated with the same first and last frame, encoded with ffmpeg · Generated With Diffusion Models · CC BY 4.0
- The first frame of the keeper loop, its printed picture · Generated With Diffusion Models · CC BY 4.0
- Schriften
- Libre Caslon Text (SIL OFL 1.1) · Oswald (SIL OFL 1.1) · Courier Prime (SIL OFL 1.1)
- Code
- MIT, wie Postext
Diesen Text bearbeiten ↗ (öffnet sich in einem neuen Tab)Ordner des Rezepts auf GitHub ↗ (öffnet sich in einem neuen Tab)


