In breve
Un giornale locale in stile anni Trenta in cui ogni fotografia è un breve film muto. Sulla carta sono immagini ferme; nel visualizzatore 3D si muovono tutte insieme, all’infinito, come un giornale in una fiaba.
Che cosa comporrai
The Wexcombe Lantern, un settimanale balneare inventato del giugno 1933, su una pagina tabloid di 280 × 430 mm in quattro colonne con filetti: una testata condensata, un articolo d’apertura con l’immagine su tre colonne, un secondo su due, tabelle delle maree, piccoli annunci e una pagina sportiva. Ogni immagine è un film in bianco e nero di cinque secondi. In stampa, e nelle pagine piatte sotto il visualizzatore, ognuna è il suo primo fotogramma. Aperte in Folio come un giornale piegato su carta da giornale chiara, le immagini delle pagine aperte si muovono tutte insieme e continuano a muoversi: il sindaco parla, l’aviatrice saluta, il pescatore ride, il portiere si tuffa e si rialza. La pagina non disegna nulla; l’impaginazione è quella di un giornale qualunque, e le clip fanno il resto.
Questa ricetta risponde a
- Come faccio riprodurre insieme su una pagina più video muti in loop, che ripartono ogni volta che si torna a quella pagina?
- Come mostro un giornale nel visualizzatore 3D come fogli piegati, con le pagine economiche su carta salmone?
La risposta breve
// 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 } } });
Ingredienti
- Funzionalità
- Video che si riproducono insiemeTre o più colonneVideo come risorseCopertine dei video: segno di riproduzione e codice QRElementi flottanti su più colonneFormati da quotidianoQuotidiano piegato (Folio)Visualizzatore di libri in 3D (Folio)Carta, rilegatura, scrivania e luce (Folio)Aperture progettateStili di titoloAttributi dei titoliTesto, filetti e riquadri nei progetti di paginaTestatine e folioFiletto tra le colonneRiquadriColonne in un riquadro o nel testoStili di paragrafoRighe di fonte e crediti
- Usa anche
- Riquadri flottantiFigure proprio quiFascia di capitolo a tutta larghezzaColore della cartaTipi di risorsa personalizzatiFigure e tabelle come risorseTestatine per sezioneRiquadri a tutta larghezza
- Tipo
- Libre Caslon Text, Oswald, Courier Prime (SIL OFL 1.1)
- Risorse
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)
Preparazione
#1 · Fai di ogni immagine una clip che gira in loop con le altre
Il codice è la risposta breve qui sopra. Una risorsa video stampa la sua locandina come immagine, così le clip prendono il posto delle fotografie e hanno la didascalia come loro. Tre opzioni del player rendono viva la pagina: autoplay avvia una clip quando la sua pagina è visibile (sempre senza audio, come richiedono i browser), loop la riproduce di nuovo dall’inizio e exclusive: false la lascia girare insieme alle altre clip. Per impostazione predefinita un video è esclusivo: quando lo avvii, mette in pausa tutto ciò che sta suonando, il che va bene per una lezione ma non per una pagina di fotografie in movimento. Il simbolo di riproduzione e il codice QR sono disattivati, così sulla carta le clip si leggono come foto di cronaca.
#2 · Dai a ogni loop il suo posto sulla griglia
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.'),
];
L’impaginazione è layoutType: 'multiple' con columnCount: 4. Il columns di un elemento flottante stabilisce quante colonne prende: il sindaco e il portiere tre, l’aviatrice, la torre dell’orologio, il pescatore e l’attrice due. Un elemento flottante su più colonne prende la testa di una serie di colonne vuote che cominciano alla stessa altezza, oppure il piede della colonna in cui è citato e di quelle vuote che la seguono, quindi è la posizione della riga ::resource a decidere il posto. Il sindaco è citato dopo il primo paragrafo, il che lascia la colonna 1 al testo e mette l’immagine sopra le colonne da 2 a 4.
#3 · Componi la testata e le pagine di sezione
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) } }),
] } };
Il titolo di livello 1 della prima pagina è il nome del giornale, disegnato da uno spazio grafico: due orecchiette sopra, il nome in maiuscole Oswald e una riga della data tra un filetto sottile e uno spesso. Le pagine interne si aprono con un’etichetta di sezione rossa su una barra di 3 pt (la regione pages) e una riga con il numero di pagina in testa a ogni pagina tranne la prima.
#4 · Apri il giornale in Folio
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 posa il giornale su legno di quercia alla luce del giorno: carta da giornale da 45 g/m², attraverso cui si intravede la pagina successiva, e binding.type: 'folded', fogli piegati una volta e infilati uno dentro l’altro senza punti metallici né dorso, come si assembla un giornale. Folio disegna ogni clip della doppia pagina aperta in un’unica texture, fino a otto alla volta, avvia i loop in autoplay ogni volta che una voltata si ferma sulla loro pagina e li ferma quando la pagina viene girata. Un clic su un video esclusivo lo riproduce comunque da solo, con il suo audio, e i loop aspettano che si fermi.
La ricetta completa
// ═══ 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
Lo script.js composto funziona così com’è: incollalo nello script modulo di qualsiasi pagina, oppure apri la ricetta su CodePen. Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)
Varianti
#Lascia che sia il lettore ad avviare ogni clip
Senza autoplay le immagini restano ferme finché il lettore non ne clicca una; una volta avviati, i loop girano comunque insieme.
- player: { autoplay: true, loop: true, muted: true, exclusive: false, controls: false },
+ player: { loop: true, muted: true, exclusive: false, controls: false },#Una clip esclusiva con il suo audio
Un singolo video può mantenere il comportamento predefinito e suonare alle sue condizioni: imposta player: { exclusive: true, muted: false } nel video di quella risorsa: quando lo avvii, i loop restano fermi finché non finisce.
#Un formato lenzuolo su sei colonne
La prima pagina a due colonne compone un giornale più piccolo con fotografie ferme; la stessa griglia prende sei colonne su un formato lenzuolo con sizePreset: 'broadsheet'.
Errori frequenti
Una sezione di giornale è un titolo di livello 1 che apre una pagina, e un elemento flottante non la oltrepassa mai. Un’immagine che non trova posto nell’ultima pagina della sua sezione viene composta su una pagina propria prima della sezione successiva, quindi adatta il testo alla pagina: qui l’articolo sui tram prosegue a pagina 2 invece di spingere l’aviatrice fuori dalla prima pagina.
Crediti
- Ricetta
- Ignacio Ferro
- Testo
- Testo originale, CC BY 4.0
- Immagini
- 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
- Font
- Libre Caslon Text (SIL OFL 1.1) · Oswald (SIL OFL 1.1) · Courier Prime (SIL OFL 1.1)
- Codice
- MIT, come Postext
Modifica questo testo ↗ (si apre in una nuova scheda)Cartella della ricetta su GitHub ↗ (si apre in una nuova scheda)


