Handwritten notebook style template for Polylux

Randomize post-its, improve heading underline

+58 -43
+53 -43
lib.typ
··· 47 47 context box( 48 48 curve( 49 49 stroke: (thickness: .05em, cap: "round", paint: text.fill), 50 - curve.move((0em, 0em)), 51 50 curve.quad((.8em, -.9em), (1em, -2em)), 52 51 ), 53 52 ) ··· 62 61 let w = measure(header).width 63 62 curve( 64 63 stroke: (thickness: .05em, cap: "round", paint: text.fill), 65 - curve.move((0em, 0em)), 66 64 curve.quad((.25 * w, -.3em), (1.2 * w, 0em)), 67 65 ) 68 66 } ··· 86 84 move( 87 85 dy: -.8em, 88 86 curve( 89 - stroke: (thickness: .05em, cap: "round", paint: text.fill), 90 - curve.move((0em, 0em)), 87 + stroke: (thickness: .04em, cap: "round", paint: text.fill), 88 + fill: text.fill, 91 89 curve.quad((.75 * w, -.5em), (w, 0em)), 90 + curve.quad((w + .05em, .03em), (w, .06em)), 91 + curve.quad((.75 * w, -.495em), (0em, 0em)), 92 92 ), 93 93 ) 94 94 }) ··· 129 129 130 130 #let len2int(l) = int.from-bytes(l.pt().to-bytes()) 131 131 #let hasher(acc, val) = acc.bit-xor(val) 132 + #let hashed-position() = { 133 + let (x, y) = here().position() 134 + let n = counter("logical-slide").get() 135 + (len2int(x), len2int(y), ..n).reduce(hasher) 136 + } 132 137 133 138 #let framed-block( 134 139 body, ··· 148 153 let (width: w, height: h) = measure(..sz, blocked-body) 149 154 let deflect = sloppiness * (w + h) / 2 150 155 151 - let pos = here().position() 152 - let hash-components = ( 153 - pos.page, 154 - len2int(pos.x), 155 - len2int(pos.y), 156 - len2int(w), 157 - len2int(h), 158 - ) 159 - let hash = hash-components.reduce(hasher) 156 + let hash = (hashed-position(), len2int(w), len2int(h)).reduce(hasher) 160 157 let rng = suiji.gen-rng-f(hash) 161 158 let (rng, c1) = suiji.random-f(rng) 162 159 let (rng, c2) = suiji.random-f(rng) ··· 169 166 170 167 let c(p) = curve( 171 168 stroke: stroke(thickness: .1em, cap: "round", paint: p), 172 - curve.move((0pt, 0pt)), 173 169 curve.quad((c1 * w, s1 * deflect), (w + deflect / 3, 0pt)), 174 170 curve.move((w - deflect / 3, -deflect / 3)), 175 171 curve.quad((w + s2 * deflect, c2 * h), (w - deflect / 3, h + deflect / 3)), ··· 182 178 blocked-body 183 179 }) 184 180 185 - #let post-it(body, fill: rgb("#FDE85F"), angle: -10deg) = rotate( 186 - angle, 187 - reflow: true, 188 - { 189 - place( 190 - dx: .0em, 191 - dy: .0em, 192 - umbra.shadow-path( 193 - (1cm, 1cm), 194 - (1cm, 5cm), 195 - (5cm, 5cm), 196 - (5cm, 4.9cm), 197 - (4cm, 1cm), 198 - correction: 10deg, 199 - closed: false, 200 - ), 201 - ) 202 - place( 203 - curve( 204 - fill: fill, 205 - curve.line((5cm, 0cm)), 206 - curve.quad((5cm, 2.5cm), (5.2cm, 5cm)), 207 - curve.quad((2.5cm, 5.2cm), (.1cm, 5cm)), 208 - curve.quad((0cm, 2.5cm), (0cm, 0cm)), 209 - ), 210 - ) 211 - box(inset: .5em, width: 5cm, height: 5cm, clip: true, body) 212 - }, 213 - ) 181 + #let post-it( 182 + body, 183 + fill: rgb("#FDE85F"), 184 + angle: -10deg, 185 + sloppiness: .2, 186 + ) = context { 187 + let hash = hashed-position() 188 + let rng = suiji.gen-rng-f(hash) 189 + let (rng, angle-deviation) = suiji.uniform-f(rng, low: -1, high: 1) 190 + let angle = (1 + sloppiness * angle-deviation) * angle 191 + let (rng, color-deviation) = suiji.uniform-f(rng, low: -1, high: 1) 192 + let fill = fill.darken(sloppiness * color-deviation * 40%) 193 + 194 + rotate( 195 + angle, 196 + reflow: false, 197 + { 198 + place( 199 + dx: .0em, 200 + dy: .0em, 201 + umbra.shadow-path( 202 + (1cm, 1cm), 203 + (1cm, 5cm), 204 + (5cm, 5cm), 205 + (5cm, 4.9cm), 206 + (4cm, 1cm), 207 + correction: 10deg, 208 + closed: false, 209 + ), 210 + ) 211 + place( 212 + curve( 213 + fill: fill, 214 + curve.line((5cm, 0cm)), 215 + curve.quad((5cm, 2.5cm), (5.2cm, 5cm)), 216 + curve.quad((2.5cm, 5.2cm), (.1cm, 5cm)), 217 + curve.quad((0cm, 2.5cm), (0cm, 0cm)), 218 + ), 219 + ) 220 + box(inset: .5em, width: 5cm, height: 5cm, clip: true, body) 221 + }, 222 + ) 223 + }
+5
template/slides.typ
··· 72 72 #slide[ 73 73 = Highlighting content 74 74 75 + // #framed-block and #post-it accept a sloppiness parameter that determine how 76 + // randomized they are. 77 + // #framed-block also accepts inset, width, and height like the standard 78 + // #block. 79 + 75 80 #toolbox.side-by-side[ 76 81 #grid( 77 82 columns: 2,