かんたんな説明
1930年代風の地方紙で、どの写真も短い無声映画です。紙の上では静止画ですが、3Dビューアーではすべてが同時に、何度でも動きます。おとぎ話に出てくる新聞のようです。
できあがり
『The Wexcombe Lantern』は、1933年6月の号という設定の架空の海辺の週刊紙です。280 × 430 mmのタブロイド判のページを、罫で区切った4段に組みます。長体の題字、3段にまたがる写真を添えたトップ記事、2段の写真を添えたもう1本の記事、潮汐表、案内広告、スポーツ面が入ります。写真はどれも5秒の白黒映画です。印刷では、またビューアーの下の平面のページでは、どれも最初のフレームです。Folioで淡い新聞用紙の折った新聞として開くと、開いたページの写真がいっせいに動き、動き続けます。市長が話し、飛行士が手を振り、漁師が笑い、ゴールキーパーが飛び込んではまた立ち上がります。ページは何も描いていません。レイアウトはふつうの新聞で、動きはクリップが受け持ちます。
このレシピが答える質問
- 1ページにある無音のループ動画をいくつも同時に再生し、そのページを開くたびに始まるようにするには?
- 3Dビューアーで新聞を折った紙として見せ、経済面をサーモンピンクの紙にするには?
手短な答え
// 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 } } });
材料
- 機能
- 同時に再生する動画3段以上の段組みリソースとしての動画動画のポスター:再生マークとQRコード複数段にまたがるフロート新聞の判型折った新聞(Folio)3Dの本のビューアー(Folio)用紙、綴じ、机、照明(Folio)デザインした章扉見出しスタイル見出しの属性ページデザインのテキスト・罫・ボックス柱とノンブル段間罫囲み囲みの中や本文中の段組み段落スタイル出典とクレジット
- 種類
- Libre Caslon Text, Oswald, Courier Prime (SIL OFL 1.1)
- 素材
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)
作り方
#1 · どの写真もほかと一緒にループするクリップにする
コードは前の手短な答えにあります。動画リソースはポスター画像を図版として印刷するので、クリップは写真の代わりになり、写真と同じようにキャプションが付きます。ページを動かすのはプレーヤーの3つのオプションです。autoplayはページが表示されたときにクリップを始め(ブラウザーの要件どおり常にミュート)、loopは最初から再生し直し、exclusive: falseはほかのクリップと並行して再生させます。既定では動画は排他的で、再生を始めるとほかに再生中のものはすべて一時停止します。講義には合っていますが、動く写真を並べたページには向きません。再生マークとQRコードはオフにしてあるので、紙の上のクリップは報道写真として読めます。
#2 · ループごとにグリッド上の位置を決める
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.'),
];
レイアウトはlayoutType: 'multiple'で、columnCount: 4です。フロートのcolumnsが占める段数を決めます。市長とゴールキーパーは3段、飛行士、時計塔、漁師、女優は2段です。複数の段にまたがるフロートは、上端のそろった空いた段の並びの頭に入るか、それを参照した段とそれに続く空いた段の下端に入ります。そのため、::resourceの行をどこに置くかで空き位置が決まります。市長は最初の段落の後で参照されるので、1段目は本文に残り、写真は2段目から4段目の上に入ります。
#3 · 題字と各面の欄名を組む
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) } }),
] } };
第1面のレベル1見出しは新聞の名前で、デザインスロットから描きます。上に2つの耳、Oswaldの大文字の題字、細い罫と太い罫に挟まれた日付行です。中面は3 ptの帯の上の赤い欄名で始まり(pagesリージョン)、第1面を除く各ページの頭にノンブルの行が付きます。
#4 · 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は新聞を昼の光の中でオークの机に置きます。45 g/m²の新聞用紙には次のページが透けて見えます。binding.type: 'folded'は、紙を一度だけ折って一方を他方の中に重ねたもので、ホチキスも背もありません。新聞はこう組まれています。Folioは開いた見開きのクリップをすべて一つのテクスチャーに描き(一度に8本まで)、ページめくりがそのページで止まるたびに自動再生のループを始め、ページがめくられると止めます。排他的な動画をクリックすれば、これまでどおり音声付きで単独で再生され、ループはそれが止まるまで待ちます。
レシピの全体
// ═══ 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
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#クリップを読者に始めさせる
autoplayをなくすと、読者がクリックするまで写真は止まったままです。一度始まれば、ループはやはりそろって再生されます。
- player: { autoplay: true, loop: true, muted: true, exclusive: false, controls: false },
+ player: { loop: true, muted: true, exclusive: false, controls: false },#音声付きの排他的なクリップを1本
1本の動画だけを既定のままにして、単独で再生させることもできます。そのリソースのvideoにplayer: { exclusive: true, muted: false }を設定すると、それを再生し始めたとき、ループはそれが終わるまで止まります。
#6段組みのブロードシート
2段組みの第1面は静止写真で小さめの新聞を組みます。同じグリッドで、sizePreset: 'broadsheet'のブロードシート判に6段を組めます。
よくあるつまずき
新聞のセクションは新しいページを始めるレベル1見出しで、フロートはそれを越えません。セクションの最後のページに空き位置のない写真は、次のセクションの前に単独のページに組まれます。そのため原稿をページに合わせてください。ここでは、飛行士を第1面から押し出す代わりに、路面電車の記事を2ページ目へ送っています。
クレジット
- 本文
- 書き下ろしの文章, CC BY 4.0
- 画像
- 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
- フォント
- Libre Caslon Text (SIL OFL 1.1) · Oswald (SIL OFL 1.1) · Courier Prime (SIL OFL 1.1)


