From f8d3a32f4f995eeb7e162b0702998b0565c11e4e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:10:40 -0300 Subject: sketchbook: a scene file says its page colour (background) --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index ba6598a..6062e60 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,14 @@ in; `SKETCHBOOK_FONT="JetBrains Mono"` in the environment puts an installed family before it. On the web it is the page's `monospace`, 8 px a character. +`f.textIn(face, x, y, scale, bytes, color)` is the same line in another +face of the Go family, all six bundled in the binary (`sk.Face`): `.mono`, +`.mono_bold`, `.mono_italic` for data and code, `.sans`, `.sans_medium`, +`.sans_bold` for what is said about it; `f.host.textSizeIn(face, scale, +bytes)` measures it. The three mono faces advance alike (0.6 em: whole +pixels at 25, 30, 35, 45 and 60 px and at their doubles), so columns of +text need no measuring. The web host draws every face as its one. + `f.openFile("open", .{ .pattern = "wav;flac" })` shows the system's file dialog; the answer comes back as the console line `open `, so it reaches the sketch's `command` like anything typed there. `f.run(line)` @@ -170,8 +178,10 @@ A `Pen` is plain data (`fill: ?Color`, `stroke: ?Color`, `width`, `join`, `cap`, `xf: Affine`), so it can be a `const`, a State field, or a copy changed for one call. A null fill is `noFill()`, a null stroke `noStroke()`. `circle`, `line`, `polyline` (Processing's `beginShape()` / -`endShape()`, open), `polygon` (`endShape(CLOSE)`), `rect` and `point` (a -dot `width` across, Processing's `point`) tessellate into `f.scratch` and +`endShape()`, open), `polygon` (`endShape(CLOSE)`), `rect`, `point` (a +dot `width` across, Processing's `point`) and `dashed` (a polyline in +dashes, `.{ on, off }` along the path, each dash whole round a corner; +`Tessellation.strokeDashes` underneath) tessellate into `f.scratch` and emit a shape for the fill and one for the stroke; out of memory, they log and drop it, as `emit` does. Joins are `.miter` (bevelled past 4 half-widths), `.round` or `.bevel`, caps `.butt`, `.round` or `.square`; @@ -429,7 +439,9 @@ returns a handle. Animations are methods of the handle: `write`, `create`, options are `.seconds`, `.ease` (any `fn (f32) f32`) and `.lag` (manim's lag ratio). `wait` moves time on, `pause()` holds the player there until a click, like a slide. Positions are scene units: 1280x720 of them show at -camera zoom 1, the origin in the middle, y down. +camera zoom 1, the origin in the middle, y down. The page behind them is +the scene file's `pub const background = 0xRRGGBB` (manim's grey without +one). A scene is one of two kinds, which share every call: -- cgit v1.3