简单来说
一本厚厚的纸板书,讲林中散步。每一张纸页上都有一个比前一个稍小的圆孔,从封面一直能看到最后一页。
成品一览
Into the Wood(西班牙语版《Al fondo del bosque》),二十张纸板、150毫米见方的隧道书。每个右页是一层画出来的树林(橡树、毛地黄、知更鸟、蕨丛里的狐狸、猫头鹰、白桦),每层都开一个比前一个稍小的圆窗,圆心相同。最后一层是完整的:林间空地上,母鹿和小鹿在水塘边。从封面望进去,视线穿过十九个窗直到鹿,纸板的切口像树干一样围着隧道。每张纸页背面有一行诗,说出对面那一层。交给印厂的PDF把所有窗都放在模切色版上。
这道食谱解答
- 怎样做一本孔洞能看穿二十页的隧道书?
- 怎样在PDF里把模切线放在单独的色版上交给模切版制作者?
简短回答
// Leaf k (pages 2k − 1 and 2k) is cut with a circle of radius R1 · Q^(k − 1) round the
// same centre: 58 mm on the cover down to 12 mm on leaf 19. Leaf 20, the clearing, is
// whole, so from the cover the eye goes through nineteen windows to the far plane.
const [CX, CY, R1, Q] = [75, 66, 58, 0.9162];
const radius = (k) => R1 * Q ** (k - 1);
const leaves = Array.from({ length: 19 }, (_, i) => i + 1);
const dieCuts = {
shapes: leaves.map((k) => ({ id: `w${k}`, name: `${t({ en: 'Window', es: 'Ventana' })} ${k}`,
shape: 'circle', x: mm(CX - radius(k)), y: mm(CY - radius(k)),
width: mm(2 * radius(k)), height: mm(2 * radius(k)) })),
pages: leaves.map((k) => ({ pages: String(2 * k - 1), die: `w${k}` })), // recto of leaf k
corners: { radius: mm(4), edges: 'fore' },
};
用料
- 功能
- 模切孔PDF中的模切线圆角与异形书3D书本查看器(Folio)标题样式页面设计中的图片页面设计中的文字、线条和框文档元数据段落样式出血与裁切标记CMYK与灰度PDF导出PDF作为资源的图和表语义调色板在Canvas上绘制页面
- 类型
- Cormorant Garamond, Lora(SIL OFL 1.1)
- 素材
plane01.jpgplane02.jpgplane03.jpgplane04.jpgplane05.jpgplane06.jpgplane07.jpgplane08.jpgplane09.jpgplane10.jpgplane11.jpgplane12.jpgplane13.jpgplane14.jpgplane15.jpgplane16.jpgplane17.jpgplane18.jpgplane19.jpgplane20.jpg- Plane 1 of the wood (Generated With Diffusion Models, 原创)
- Plane 2 of the wood (Generated With Diffusion Models, 原创)
- Plane 3 of the wood (Generated With Diffusion Models, 原创)
- Plane 4 of the wood (Generated With Diffusion Models, 原创)
- Plane 5 of the wood (Generated With Diffusion Models, 原创)
- Plane 6 of the wood (Generated With Diffusion Models, 原创)
- Plane 7 of the wood (Generated With Diffusion Models, 原创)
- Plane 8 of the wood (Generated With Diffusion Models, 原创)
- Plane 9 of the wood (Generated With Diffusion Models, 原创)
- Plane 10 of the wood (Generated With Diffusion Models, 原创)
- Plane 11 of the wood (Generated With Diffusion Models, 原创)
- Plane 12 of the wood (Generated With Diffusion Models, 原创)
- Plane 13 of the wood (Generated With Diffusion Models, 原创)
- Plane 14 of the wood (Generated With Diffusion Models, 原创)
- Plane 15 of the wood (Generated With Diffusion Models, 原创)
- Plane 16 of the wood (Generated With Diffusion Models, 原创)
- Plane 17 of the wood (Generated With Diffusion Models, 原创)
- Plane 18 of the wood (Generated With Diffusion Models, 原创)
- Plane 19 of the wood (Generated With Diffusion Models, 原创)
- Plane 20 of the wood (Generated With Diffusion Models, 原创)
做法
#1 · 同一轴心上的十九个窗
代码见上方的简短回答。窗由循环生成:第k张纸页得到一个半径为R1 · Q^(k − 1)、圆心相同的圆,dieCuts.pages把它放在第2k − 1页,即这张纸页的右页。孔会切穿纸页两面,所以背面有同一个窗,左右镜像。Q = 0.9162让半径分十八步从58毫米降到12毫米。
#2 · 与窗对准的分层画面
// The plane pictures were scaled so each painting's opening meets its window, centred on
// (CX, CY), over a softened copy of itself; the window's centre is flat, the die takes it.
const SHEET = { width: mm(TRIM + 2 * BLEED), height: mm(TRIM + 2 * BLEED) };
const painting = { kind: 'image', id: 'painting', resourceId: '{attr.picture}', fit: 'cover',
placement: at('page', 'top-left', -BLEED, -BLEED, SHEET) };
const full = (elements) => ({ enabled: true, minHeight: mm(TRIM - TOP), slot: { elements } });
const plate = { kind: 'box', id: 'plate', placement: at('page', 'top-left', 25, 129,
{ width: mm(100), height: mm(17) }), style: { backgroundColor: col('forest') } };
const line = (id, content, y, size, color, extra) => ({ kind: 'text', id, content,
fontFamily: DISPLAY, fontSize: pt(size), lineHeight: 1.1, color: col(color),
align: 'center', placement: at('page', 'top-left', 25, y, { width: mm(100) }), ...extra });
const headingStyles = [
{ id: 'cover', numbered: false, toc: false, advancedDesign: full([painting, plate,
line('title', '{title}', 131, 21, 'cream', { fontWeight: 600 }),
line('subtitle', '{subtitle}', 139.5, 10.5, 'moss', { italic: true })]) },
{ id: 'plane', numbered: false, breakBefore: { enabled: true, parity: 'odd' },
advancedDesign: full([painting]) },
];
每幅画都有自己雾蒙蒙的中空处,所以图片进书前先缩放:在每幅画上以像素量出树叶占圆环一半的半径,再把画缩放到这个半径正好落在本页的窗上。从封面看,每层只露出窗外一圈细细的树叶,层层叠成隧道。每个模切去掉的中心是纯色,几乎不占文件大小。
#3 · Die色版上的十九个圆
print: { standard: 'pdfx4', outputProfile: 'fogra51', convertImages: false,
dieLine: { output: 'page', ink: 'Die', width: pt(0.5) } },
PDF把每个窗以及切口一侧圆角的每张纸页描在叠印、从不上墨的Die分色上。用convertImages: false,四十页画面的文件不到1.5兆字节。
#4 · 拿在手里的隧道
folio: {
tilt: 40, yaw: -30,
paper: { type: 'board', shade: '#f4ecd6' },
binding: { type: 'hardcover', cover: 'pages', coverMaterial: 'paper' },
surface: { type: 'oak' },
lighting: { environment: 'daylight', intensity: 1.1 },
},
二十张纸板叠成厚厚一块,Folio把每个窗都切穿:合着的书显出隧道,切口的侧壁一级级向下通到林间空地。
#5 · 平面页上的二十层
// `beneath` paints the page two on, which paints the page two on from it, and so on to
// the clearing: page 1 shows all twenty planes. Each canvas is painted once and reused.
const under = new Map();
const beneath = (i) => {
if (!under.has(i) && doc.pages[i]) {
const canvas = document.createElement('canvas');
under.set(i, canvas);
renderPageToCanvas(doc.pages[i], doc, canvas, { scale: 1, beneath });
}
return under.get(i);
};
beneath用它自己的beneath去画后面第二页:封面的窗露出第3页,第3页的窗露出第5页,一直到第39页。每页只画一次,之后重复使用。
完整食谱
// ═══ Postext Cookbook · Nº 195 · A tunnel book twenty leaves deep ═══════════════════════
// https://postext.dev/en/cookbook/forest-tunnel-book
// Code: MIT · Text: original (CC BY 4.0) · Paintings: generated with diffusion models
// Fonts: Cormorant Garamond, Lora (SIL OFL 1.1) · Needs postext ≥ 1.84.0
//
// Twenty board leaves, each printed with one plane of a wood and cut with a round window a
// little smaller than the one before. From the cover you look down the whole tunnel, past
// oaks, foxgloves, an owl and a fox, to a doe and her fawn at a pool in the clearing.
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';
import { createFolioFromDocument } from 'https://esm.sh/postext-folio';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'forest-tunnel-book';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
// #region palette: a deep forest green behind the words, cream type
const palette = {
forest: '#1c2a1e', // the versos, and the plate under the cover title
cream: '#f4ecd6', // all the type
moss: '#a9b98a', // the subtitle and the colophon
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
{ id: 'main-color', name: 'moss (defaults)', value: { hex: palette.moss, model: 'hex' } },
];
// #endregion
const [TRIM, BLEED] = [150, 3]; // mm: a square board book, and its bleed
const [TOP, SIDE] = [128, 14]; // the words on each verso sit under its window
const [DISPLAY, TEXT] = ['Cormorant Garamond', 'Lora'];
const at = (to, edge, x = 0, y = 0, size) => ({ anchor: { to, edge },
offset: { x: mm(x), y: mm(y) }, ...(size && { size }) });
// #region answer: nineteen windows, each smaller than the last, all on one axis
// Leaf k (pages 2k − 1 and 2k) is cut with a circle of radius R1 · Q^(k − 1) round the
// same centre: 58 mm on the cover down to 12 mm on leaf 19. Leaf 20, the clearing, is
// whole, so from the cover the eye goes through nineteen windows to the far plane.
const [CX, CY, R1, Q] = [75, 66, 58, 0.9162];
const radius = (k) => R1 * Q ** (k - 1);
const leaves = Array.from({ length: 19 }, (_, i) => i + 1);
const dieCuts = {
shapes: leaves.map((k) => ({ id: `w${k}`, name: `${t({ en: 'Window', es: 'Ventana' })} ${k}`,
shape: 'circle', x: mm(CX - radius(k)), y: mm(CY - radius(k)),
width: mm(2 * radius(k)), height: mm(2 * radius(k)) })),
pages: leaves.map((k) => ({ pages: String(2 * k - 1), die: `w${k}` })), // recto of leaf k
组合好的script.js可以直接运行:把它粘贴到任何页面的模块脚本中,或在CodePen上打开这道食谱。 GitHub上的食谱文件夹 ↗ (在新标签页中打开)
变化
#圆角方窗
用roundRect,圆角半径取半宽的三分之一,看起来像剪纸,更柔和。
- shape: 'circle', x: mm(CX - radius(k)), y: mm(CY - radius(k)),
+ shape: 'roundRect', radius: mm(radius(k) / 3), x: mm(CX - radius(k)), y: mm(CY - radius(k)),#四角都切圆
给小手用的纸板书,每张纸页四个角都切圆。
- corners: { radius: mm(4), edges: 'fore' },
+ corners: { radius: mm(8), edges: 'all' },致谢
- 文本
- The verse of the walk and the colophon · Postext Cookbook · CC BY 4.0
- 图片
- Plane 1 of the wood · Generated With Diffusion Models · 原创
- Plane 2 of the wood · Generated With Diffusion Models · 原创
- Plane 3 of the wood · Generated With Diffusion Models · 原创
- Plane 4 of the wood · Generated With Diffusion Models · 原创
- Plane 5 of the wood · Generated With Diffusion Models · 原创
- Plane 6 of the wood · Generated With Diffusion Models · 原创
- Plane 7 of the wood · Generated With Diffusion Models · 原创
- Plane 8 of the wood · Generated With Diffusion Models · 原创
- Plane 9 of the wood · Generated With Diffusion Models · 原创
- Plane 10 of the wood · Generated With Diffusion Models · 原创
- Plane 11 of the wood · Generated With Diffusion Models · 原创
- Plane 12 of the wood · Generated With Diffusion Models · 原创
- Plane 13 of the wood · Generated With Diffusion Models · 原创
- Plane 14 of the wood · Generated With Diffusion Models · 原创
- Plane 15 of the wood · Generated With Diffusion Models · 原创
- Plane 16 of the wood · Generated With Diffusion Models · 原创
- Plane 17 of the wood · Generated With Diffusion Models · 原创
- Plane 18 of the wood · Generated With Diffusion Models · 原创
- Plane 19 of the wood · Generated With Diffusion Models · 原创
- Plane 20 of the wood · Generated With Diffusion Models · 原创
- 字体
- Cormorant Garamond (SIL OFL 1.1) · Lora (SIL OFL 1.1)


