@20baht/stickers 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +48 -0
- package/README.md +173 -2
- package/dist/all.d.ts +4 -0
- package/dist/all.js +7 -0
- package/dist/element.d.ts +103 -0
- package/dist/element.js +181 -0
- package/dist/graph.d.ts +172 -0
- package/dist/graph.js +374 -0
- package/dist/icons/access-point.d.ts +2 -0
- package/dist/icons/access-point.js +34 -0
- package/dist/icons/ai-agent.d.ts +2 -0
- package/dist/icons/ai-agent.js +50 -0
- package/dist/icons/alarm-clock.d.ts +2 -0
- package/dist/icons/alarm-clock.js +46 -0
- package/dist/icons/all-in-one.d.ts +2 -0
- package/dist/icons/all-in-one.js +37 -0
- package/dist/icons/angpao.d.ts +2 -0
- package/dist/icons/angpao.js +46 -0
- package/dist/icons/badge-reader.d.ts +2 -0
- package/dist/icons/badge-reader.js +51 -0
- package/dist/icons/baht-note.d.ts +2 -0
- package/dist/icons/baht-note.js +42 -0
- package/dist/icons/bamboo.d.ts +2 -0
- package/dist/icons/bamboo.js +57 -0
- package/dist/icons/banana-leaf.d.ts +2 -0
- package/dist/icons/banana-leaf.js +87 -0
- package/dist/icons/banana-tree.d.ts +2 -0
- package/dist/icons/banana-tree.js +75 -0
- package/dist/icons/bear.d.ts +2 -0
- package/dist/icons/bear.js +39 -0
- package/dist/icons/blade-chassis.d.ts +2 -0
- package/dist/icons/blade-chassis.js +43 -0
- package/dist/icons/bond.d.ts +2 -0
- package/dist/icons/bond.js +48 -0
- package/dist/icons/books.d.ts +2 -0
- package/dist/icons/books.js +44 -0
- package/dist/icons/bts-card.d.ts +2 -0
- package/dist/icons/bts-card.js +47 -0
- package/dist/icons/budget-jar.d.ts +2 -0
- package/dist/icons/budget-jar.js +43 -0
- package/dist/icons/cactus.d.ts +2 -0
- package/dist/icons/cactus.js +42 -0
- package/dist/icons/calculator.d.ts +2 -0
- package/dist/icons/calculator.js +46 -0
- package/dist/icons/calendar-month.d.ts +2 -0
- package/dist/icons/calendar-month.js +66 -0
- package/dist/icons/campfire.d.ts +2 -0
- package/dist/icons/campfire.js +63 -0
- package/dist/icons/cctv.d.ts +2 -0
- package/dist/icons/cctv.js +38 -0
- package/dist/icons/certificate.d.ts +2 -0
- package/dist/icons/certificate.js +50 -0
- package/dist/icons/cha-yen.d.ts +2 -0
- package/dist/icons/cha-yen.js +68 -0
- package/dist/icons/chedi.d.ts +2 -0
- package/dist/icons/chedi.js +56 -0
- package/dist/icons/classic-phone.d.ts +2 -0
- package/dist/icons/classic-phone.js +32 -0
- package/dist/icons/clipboard.d.ts +2 -0
- package/dist/icons/clipboard.js +61 -0
- package/dist/icons/cloud.d.ts +2 -0
- package/dist/icons/cloud.js +28 -0
- package/dist/icons/coins.d.ts +2 -0
- package/dist/icons/coins.js +34 -0
- package/dist/icons/compare.d.ts +2 -0
- package/dist/icons/compare.js +33 -0
- package/dist/icons/confetti.d.ts +2 -0
- package/dist/icons/confetti.js +72 -0
- package/dist/icons/convenience-bag.d.ts +2 -0
- package/dist/icons/convenience-bag.js +51 -0
- package/dist/icons/cooling.d.ts +2 -0
- package/dist/icons/cooling.js +46 -0
- package/dist/icons/copy-files.d.ts +2 -0
- package/dist/icons/copy-files.js +37 -0
- package/dist/icons/core-switch.d.ts +2 -0
- package/dist/icons/core-switch.js +48 -0
- package/dist/icons/cursor.d.ts +2 -0
- package/dist/icons/cursor.js +27 -0
- package/dist/icons/database.d.ts +2 -0
- package/dist/icons/database.js +24 -0
- package/dist/icons/desktop-tower.d.ts +2 -0
- package/dist/icons/desktop-tower.js +41 -0
- package/dist/icons/disc-image.d.ts +2 -0
- package/dist/icons/disc-image.js +54 -0
- package/dist/icons/dollar-note.d.ts +2 -0
- package/dist/icons/dollar-note.js +44 -0
- package/dist/icons/electric-bill.d.ts +2 -0
- package/dist/icons/electric-bill.js +51 -0
- package/dist/icons/email.d.ts +2 -0
- package/dist/icons/email.js +57 -0
- package/dist/icons/empty-state.d.ts +2 -0
- package/dist/icons/empty-state.js +75 -0
- package/dist/icons/expense.d.ts +2 -0
- package/dist/icons/expense.js +36 -0
- package/dist/icons/export-file.d.ts +2 -0
- package/dist/icons/export-file.js +35 -0
- package/dist/icons/eyedropper.d.ts +2 -0
- package/dist/icons/eyedropper.js +69 -0
- package/dist/icons/face-id.d.ts +2 -0
- package/dist/icons/face-id.js +51 -0
- package/dist/icons/file.d.ts +2 -0
- package/dist/icons/file.js +15 -0
- package/dist/icons/finance-b-coins.d.ts +8 -0
- package/dist/icons/finance-b-coins.js +14 -0
- package/dist/icons/finance-tray.d.ts +11 -0
- package/dist/icons/finance-tray.js +41 -0
- package/dist/icons/fingerprint.d.ts +2 -0
- package/dist/icons/fingerprint.js +45 -0
- package/dist/icons/firewall.d.ts +2 -0
- package/dist/icons/firewall.js +76 -0
- package/dist/icons/floating-ip.d.ts +2 -0
- package/dist/icons/floating-ip.js +59 -0
- package/dist/icons/flower.d.ts +2 -0
- package/dist/icons/flower.js +49 -0
- package/dist/icons/food.d.ts +6 -0
- package/dist/icons/food.js +18 -0
- package/dist/icons/freelance.d.ts +2 -0
- package/dist/icons/freelance.js +51 -0
- package/dist/icons/fuel.d.ts +2 -0
- package/dist/icons/fuel.js +46 -0
- package/dist/icons/goal.d.ts +2 -0
- package/dist/icons/goal.js +51 -0
- package/dist/icons/gold-bar.d.ts +2 -0
- package/dist/icons/gold-bar.js +60 -0
- package/dist/icons/hard-drive.d.ts +2 -0
- package/dist/icons/hard-drive.js +42 -0
- package/dist/icons/highlighter.d.ts +2 -0
- package/dist/icons/highlighter.js +75 -0
- package/dist/icons/home-router.d.ts +2 -0
- package/dist/icons/home-router.js +32 -0
- package/dist/icons/hot-drink.d.ts +2 -0
- package/dist/icons/hot-drink.js +33 -0
- package/dist/icons/hsm.d.ts +2 -0
- package/dist/icons/hsm.js +54 -0
- package/dist/icons/id-card.d.ts +2 -0
- package/dist/icons/id-card.js +36 -0
- package/dist/icons/income.d.ts +2 -0
- package/dist/icons/income.js +28 -0
- package/dist/icons/index.d.ts +185 -0
- package/dist/icons/index.js +366 -0
- package/dist/icons/interest.d.ts +2 -0
- package/dist/icons/interest.js +66 -0
- package/dist/icons/iot-sensor.d.ts +2 -0
- package/dist/icons/iot-sensor.js +35 -0
- package/dist/icons/ip-phone.d.ts +2 -0
- package/dist/icons/ip-phone.js +47 -0
- package/dist/icons/ipad-gen8.d.ts +2 -0
- package/dist/icons/ipad-gen8.js +58 -0
- package/dist/icons/iphone-17.d.ts +2 -0
- package/dist/icons/iphone-17.js +37 -0
- package/dist/icons/iso.d.ts +2 -0
- package/dist/icons/iso.js +3 -0
- package/dist/icons/kaprao.d.ts +2 -0
- package/dist/icons/kaprao.js +70 -0
- package/dist/icons/key-pair.d.ts +2 -0
- package/dist/icons/key-pair.js +54 -0
- package/dist/icons/key.d.ts +3 -0
- package/dist/icons/key.js +37 -0
- package/dist/icons/keyboard.d.ts +2 -0
- package/dist/icons/keyboard.js +35 -0
- package/dist/icons/kite.d.ts +2 -0
- package/dist/icons/kite.js +53 -0
- package/dist/icons/kvm.d.ts +2 -0
- package/dist/icons/kvm.js +53 -0
- package/dist/icons/lamp.d.ts +2 -0
- package/dist/icons/lamp.js +49 -0
- package/dist/icons/laptop.d.ts +2 -0
- package/dist/icons/laptop.js +44 -0
- package/dist/icons/load-balancer.d.ts +2 -0
- package/dist/icons/load-balancer.js +50 -0
- package/dist/icons/lock-screen.d.ts +2 -0
- package/dist/icons/lock-screen.js +44 -0
- package/dist/icons/long-tail-boat.d.ts +2 -0
- package/dist/icons/long-tail-boat.js +66 -0
- package/dist/icons/lottery.d.ts +2 -0
- package/dist/icons/lottery.js +51 -0
- package/dist/icons/lotus.d.ts +2 -0
- package/dist/icons/lotus.js +70 -0
- package/dist/icons/mac-mini.d.ts +2 -0
- package/dist/icons/mac-mini.js +31 -0
- package/dist/icons/macbook-air.d.ts +2 -0
- package/dist/icons/macbook-air.js +41 -0
- package/dist/icons/mailbox-thai.d.ts +2 -0
- package/dist/icons/mailbox-thai.js +66 -0
- package/dist/icons/mango-sticky-rice.d.ts +2 -0
- package/dist/icons/mango-sticky-rice.js +41 -0
- package/dist/icons/marigold.d.ts +2 -0
- package/dist/icons/marigold.js +69 -0
- package/dist/icons/market-basket.d.ts +2 -0
- package/dist/icons/market-basket.js +69 -0
- package/dist/icons/media-player.d.ts +2 -0
- package/dist/icons/media-player.js +71 -0
- package/dist/icons/metrics.d.ts +2 -0
- package/dist/icons/metrics.js +58 -0
- package/dist/icons/mini-pc.d.ts +2 -0
- package/dist/icons/mini-pc.js +26 -0
- package/dist/icons/modem.d.ts +2 -0
- package/dist/icons/modem.js +37 -0
- package/dist/icons/monitor.d.ts +2 -0
- package/dist/icons/monitor.js +40 -0
- package/dist/icons/monstera.d.ts +2 -0
- package/dist/icons/monstera.js +47 -0
- package/dist/icons/moon.d.ts +2 -0
- package/dist/icons/moon.js +55 -0
- package/dist/icons/motorbike-taxi.d.ts +2 -0
- package/dist/icons/motorbike-taxi.js +42 -0
- package/dist/icons/music-note.d.ts +2 -0
- package/dist/icons/music-note.js +63 -0
- package/dist/icons/nas-2bay.d.ts +2 -0
- package/dist/icons/nas-2bay.js +49 -0
- package/dist/icons/nas.d.ts +2 -0
- package/dist/icons/nas.js +41 -0
- package/dist/icons/nature-iso.d.ts +29 -0
- package/dist/icons/nature-iso.js +74 -0
- package/dist/icons/noodle-soup.d.ts +2 -0
- package/dist/icons/noodle-soup.js +52 -0
- package/dist/icons/notebook.d.ts +2 -0
- package/dist/icons/notebook.js +44 -0
- package/dist/icons/object-drum.d.ts +18 -0
- package/dist/icons/object-drum.js +63 -0
- package/dist/icons/otp.d.ts +2 -0
- package/dist/icons/otp.js +46 -0
- package/dist/icons/over-budget.d.ts +2 -0
- package/dist/icons/over-budget.js +48 -0
- package/dist/icons/pad-see-ew.d.ts +2 -0
- package/dist/icons/pad-see-ew.js +56 -0
- package/dist/icons/palm-tree.d.ts +2 -0
- package/dist/icons/palm-tree.js +52 -0
- package/dist/icons/paper-boat.d.ts +2 -0
- package/dist/icons/paper-boat.js +67 -0
- package/dist/icons/paper.d.ts +3 -0
- package/dist/icons/paper.js +45 -0
- package/dist/icons/password.d.ts +2 -0
- package/dist/icons/password.js +45 -0
- package/dist/icons/patch-panel.d.ts +2 -0
- package/dist/icons/patch-panel.js +41 -0
- package/dist/icons/pdu.d.ts +2 -0
- package/dist/icons/pdu.js +40 -0
- package/dist/icons/phone-topup.d.ts +2 -0
- package/dist/icons/phone-topup.js +55 -0
- package/dist/icons/photo.d.ts +2 -0
- package/dist/icons/photo.js +48 -0
- package/dist/icons/phuang-malai.d.ts +2 -0
- package/dist/icons/phuang-malai.js +59 -0
- package/dist/icons/pie-chart.d.ts +2 -0
- package/dist/icons/pie-chart.js +36 -0
- package/dist/icons/piggy-bank.d.ts +2 -0
- package/dist/icons/piggy-bank.js +64 -0
- package/dist/icons/plant-kit.d.ts +23 -0
- package/dist/icons/plant-kit.js +112 -0
- package/dist/icons/plastic-stool.d.ts +2 -0
- package/dist/icons/plastic-stool.js +67 -0
- package/dist/icons/pointer.d.ts +1 -0
- package/dist/icons/pointer.js +12 -0
- package/dist/icons/pos.d.ts +2 -0
- package/dist/icons/pos.js +59 -0
- package/dist/icons/potted-plant.d.ts +2 -0
- package/dist/icons/potted-plant.js +31 -0
- package/dist/icons/power-pole.d.ts +2 -0
- package/dist/icons/power-pole.js +60 -0
- package/dist/icons/power-station.d.ts +2 -0
- package/dist/icons/power-station.js +56 -0
- package/dist/icons/printer.d.ts +2 -0
- package/dist/icons/printer.js +46 -0
- package/dist/icons/qr-code.d.ts +2 -0
- package/dist/icons/qr-code.js +45 -0
- package/dist/icons/rack.d.ts +2 -0
- package/dist/icons/rack.js +39 -0
- package/dist/icons/rain-cloud.d.ts +2 -0
- package/dist/icons/rain-cloud.js +31 -0
- package/dist/icons/rainbow.d.ts +2 -0
- package/dist/icons/rainbow.js +46 -0
- package/dist/icons/receipt.d.ts +2 -0
- package/dist/icons/receipt.js +56 -0
- package/dist/icons/redmi-note-9s-pro.d.ts +2 -0
- package/dist/icons/redmi-note-9s-pro.js +37 -0
- package/dist/icons/register.d.ts +2 -0
- package/dist/icons/register.js +40 -0
- package/dist/icons/remote-desktop.d.ts +2 -0
- package/dist/icons/remote-desktop.js +62 -0
- package/dist/icons/remote-folder.d.ts +2 -0
- package/dist/icons/remote-folder.js +55 -0
- package/dist/icons/rent.d.ts +2 -0
- package/dist/icons/rent.js +50 -0
- package/dist/icons/rock.d.ts +2 -0
- package/dist/icons/rock.js +80 -0
- package/dist/icons/router.d.ts +2 -0
- package/dist/icons/router.js +59 -0
- package/dist/icons/salary.d.ts +2 -0
- package/dist/icons/salary.js +54 -0
- package/dist/icons/saving-streak.d.ts +2 -0
- package/dist/icons/saving-streak.js +66 -0
- package/dist/icons/scan-slip.d.ts +2 -0
- package/dist/icons/scan-slip.js +53 -0
- package/dist/icons/scissors.d.ts +2 -0
- package/dist/icons/scissors.js +52 -0
- package/dist/icons/server-cabinet.d.ts +2 -0
- package/dist/icons/server-cabinet.js +49 -0
- package/dist/icons/server.d.ts +2 -0
- package/dist/icons/server.js +41 -0
- package/dist/icons/shared.d.ts +8 -0
- package/dist/icons/shared.js +18 -0
- package/dist/icons/shield.d.ts +3 -0
- package/dist/icons/shield.js +28 -0
- package/dist/icons/shooting-star.d.ts +2 -0
- package/dist/icons/shooting-star.js +37 -0
- package/dist/icons/shopping-box.d.ts +2 -0
- package/dist/icons/shopping-box.js +46 -0
- package/dist/icons/sky-kit.d.ts +19 -0
- package/dist/icons/sky-kit.js +72 -0
- package/dist/icons/smart-tv.d.ts +2 -0
- package/dist/icons/smart-tv.js +39 -0
- package/dist/icons/smartphone.d.ts +2 -0
- package/dist/icons/smartphone.js +30 -0
- package/dist/icons/sms.d.ts +2 -0
- package/dist/icons/sms.js +45 -0
- package/dist/icons/snapshots.d.ts +2 -0
- package/dist/icons/snapshots.js +45 -0
- package/dist/icons/snip.d.ts +2 -0
- package/dist/icons/snip.js +63 -0
- package/dist/icons/spirit-house.d.ts +2 -0
- package/dist/icons/spirit-house.js +73 -0
- package/dist/icons/ssl-certificate.d.ts +2 -0
- package/dist/icons/ssl-certificate.js +56 -0
- package/dist/icons/star.d.ts +2 -0
- package/dist/icons/star.js +16 -0
- package/dist/icons/stock.d.ts +2 -0
- package/dist/icons/stock.js +62 -0
- package/dist/icons/storage-array.d.ts +2 -0
- package/dist/icons/storage-array.js +40 -0
- package/dist/icons/storm.d.ts +2 -0
- package/dist/icons/storm.js +43 -0
- package/dist/icons/street-food-cart.d.ts +2 -0
- package/dist/icons/street-food-cart.js +66 -0
- package/dist/icons/street-kit.d.ts +19 -0
- package/dist/icons/street-kit.js +67 -0
- package/dist/icons/street-sign.d.ts +2 -0
- package/dist/icons/street-sign.js +42 -0
- package/dist/icons/studio-monitors.d.ts +2 -0
- package/dist/icons/studio-monitors.js +67 -0
- package/dist/icons/sun.d.ts +2 -0
- package/dist/icons/sun.js +40 -0
- package/dist/icons/support.d.ts +2 -0
- package/dist/icons/support.js +48 -0
- package/dist/icons/switch.d.ts +2 -0
- package/dist/icons/switch.js +34 -0
- package/dist/icons/tablet.d.ts +2 -0
- package/dist/icons/tablet.js +44 -0
- package/dist/icons/tape-library.d.ts +2 -0
- package/dist/icons/tape-library.js +48 -0
- package/dist/icons/temple-donation.d.ts +2 -0
- package/dist/icons/temple-donation.js +60 -0
- package/dist/icons/tent.d.ts +2 -0
- package/dist/icons/tent.js +66 -0
- package/dist/icons/terminal.d.ts +2 -0
- package/dist/icons/terminal.js +56 -0
- package/dist/icons/thai-house.d.ts +2 -0
- package/dist/icons/thai-house.js +85 -0
- package/dist/icons/thai-lantern.d.ts +2 -0
- package/dist/icons/thai-lantern.js +61 -0
- package/dist/icons/thinkpad-l380.d.ts +2 -0
- package/dist/icons/thinkpad-l380.js +54 -0
- package/dist/icons/timer.d.ts +2 -0
- package/dist/icons/timer.js +59 -0
- package/dist/icons/train-ticket.d.ts +2 -0
- package/dist/icons/train-ticket.js +57 -0
- package/dist/icons/trash.d.ts +2 -0
- package/dist/icons/trash.js +62 -0
- package/dist/icons/tree.d.ts +2 -0
- package/dist/icons/tree.js +40 -0
- package/dist/icons/tuk-tuk.d.ts +2 -0
- package/dist/icons/tuk-tuk.js +45 -0
- package/dist/icons/tulip.d.ts +2 -0
- package/dist/icons/tulip.js +56 -0
- package/dist/icons/tunnel.d.ts +2 -0
- package/dist/icons/tunnel.js +50 -0
- package/dist/icons/two-factor.d.ts +2 -0
- package/dist/icons/two-factor.js +81 -0
- package/dist/icons/ups.d.ts +2 -0
- package/dist/icons/ups.js +37 -0
- package/dist/icons/usb-drive.d.ts +2 -0
- package/dist/icons/usb-drive.js +35 -0
- package/dist/icons/verified.d.ts +2 -0
- package/dist/icons/verified.js +32 -0
- package/dist/icons/virtual-machine.d.ts +2 -0
- package/dist/icons/virtual-machine.js +66 -0
- package/dist/icons/volume.d.ts +6 -0
- package/dist/icons/volume.js +35 -0
- package/dist/icons/vpn-gateway.d.ts +2 -0
- package/dist/icons/vpn-gateway.js +51 -0
- package/dist/icons/wake-on-lan.d.ts +2 -0
- package/dist/icons/wake-on-lan.js +40 -0
- package/dist/icons/wallet.d.ts +3 -0
- package/dist/icons/wallet.js +55 -0
- package/dist/icons/water-jar.d.ts +2 -0
- package/dist/icons/water-jar.js +72 -0
- package/dist/icons/wooden-window.d.ts +2 -0
- package/dist/icons/wooden-window.js +65 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/iso.d.ts +32 -0
- package/dist/iso.js +64 -0
- package/dist/load.d.ts +197 -0
- package/dist/load.js +197 -0
- package/dist/motions.d.ts +68 -0
- package/dist/motions.js +446 -0
- package/dist/sticker.d.ts +269 -0
- package/dist/sticker.js +1009 -0
- package/package.json +101 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Vec } from '../sticker.js';
|
|
2
|
+
import type { V3 } from '../iso.js';
|
|
3
|
+
/** How tall a level circle looks on screen per unit of radius under ISO (the 30 degree pitch). */
|
|
4
|
+
export declare const FLAT = 0.5;
|
|
5
|
+
/** Drops points that repeat the one before (and a last one repeating the first), which poly() cannot fillet. */
|
|
6
|
+
export declare const clean: (pts: readonly Vec[]) => Vec[];
|
|
7
|
+
/** A level disc at c (a pond, a soil top, a lid), as a filled ellipse. */
|
|
8
|
+
export declare const disc: (c: V3, r: number) => string;
|
|
9
|
+
/**
|
|
10
|
+
* The outline of a solid turned about the vertical through c, from a profile of [radius, height] rings, bottom
|
|
11
|
+
* first: up the left side, over the back of the top ring, down the right side, round the front of the bottom ring.
|
|
12
|
+
*/
|
|
13
|
+
export declare function lathe(c: V3, profile: readonly (readonly [number, number])[]): string;
|
|
14
|
+
/** The front half of a ring round the solid at c: a moulding, a node, a seam line. */
|
|
15
|
+
export declare const band: (c: V3, r: number, z: number) => string;
|
|
16
|
+
/** The front of the solid between two rings, filled: a painted belt. */
|
|
17
|
+
export declare const belt: (c: V3, r1: number, z1: number, r2: number, z2: number) => string;
|
|
18
|
+
/** A line running up the front of the solid at angle t (0 is the right edge, pi/2 the nearest point). */
|
|
19
|
+
export declare const seam: (c: V3, profile: readonly (readonly [number, number])[], t: number) => string;
|
|
20
|
+
/**
|
|
21
|
+
* A leaf blade on screen from o, pointing at `ang` radians (0 right, positive down), `len` long and `w` wide at the
|
|
22
|
+
* middle, its midrib bending down by `droop` of its length (negative bends it up). Returns the outline and the midrib.
|
|
23
|
+
*/
|
|
24
|
+
export declare function blade(o: Vec, ang: number, len: number, w: number, droop: number): {
|
|
25
|
+
d: string;
|
|
26
|
+
rib: Vec[];
|
|
27
|
+
};
|
|
28
|
+
/** How far a 3d point sits from the viewer under ISO; draw the larger first. */
|
|
29
|
+
export declare const farness: ([x, y]: V3) => number;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Helpers the 2.5d nature stickers share: round solids turned on a vertical axis (pots, stupas, lanterns, stalks),
|
|
2
|
+
// level discs, belts and seams on those solids, leaf blades, and a back-to-front sort for parts placed in 3d.
|
|
3
|
+
import { ellipse, line, poly } from '../sticker.js';
|
|
4
|
+
import { add, ISO } from '../iso.js';
|
|
5
|
+
/** How tall a level circle looks on screen per unit of radius under ISO (the 30 degree pitch). */
|
|
6
|
+
export const FLAT = 0.5;
|
|
7
|
+
const STEPS = 14;
|
|
8
|
+
const ringAt = (c, r, z, t) => {
|
|
9
|
+
const [x, y] = ISO(add(c, [0, 0, z]));
|
|
10
|
+
return [x + r * Math.cos(t), y + r * FLAT * Math.sin(t)];
|
|
11
|
+
};
|
|
12
|
+
const sweep = (from, to, n = STEPS) => Array.from({ length: n + 1 }, (_, i) => from + ((to - from) * i) / n);
|
|
13
|
+
/** Drops points that repeat the one before (and a last one repeating the first), which poly() cannot fillet. */
|
|
14
|
+
export const clean = (pts) => pts.filter((p, i) => {
|
|
15
|
+
const q = i ? pts[i - 1] : pts[pts.length - 1];
|
|
16
|
+
return !q || Math.hypot(p[0] - q[0], p[1] - q[1]) > 0.5;
|
|
17
|
+
});
|
|
18
|
+
/** A level disc at c (a pond, a soil top, a lid), as a filled ellipse. */
|
|
19
|
+
export const disc = (c, r) => {
|
|
20
|
+
const [x, y] = ISO(c);
|
|
21
|
+
return ellipse(x, y, r, r * FLAT);
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The outline of a solid turned about the vertical through c, from a profile of [radius, height] rings, bottom
|
|
25
|
+
* first: up the left side, over the back of the top ring, down the right side, round the front of the bottom ring.
|
|
26
|
+
*/
|
|
27
|
+
export function lathe(c, profile) {
|
|
28
|
+
const first = profile[0] ?? [0, 0];
|
|
29
|
+
const last = profile[profile.length - 1] ?? first;
|
|
30
|
+
const pts = profile.map(([r, z]) => ringAt(c, r, z, Math.PI));
|
|
31
|
+
if (last[0] > 0)
|
|
32
|
+
pts.push(...sweep(Math.PI, 2 * Math.PI)
|
|
33
|
+
.slice(1, -1)
|
|
34
|
+
.map((t) => ringAt(c, last[0], last[1], t)));
|
|
35
|
+
pts.push(...[...profile].reverse().map(([r, z]) => ringAt(c, r, z, 0)));
|
|
36
|
+
pts.push(...sweep(0, Math.PI)
|
|
37
|
+
.slice(1, -1)
|
|
38
|
+
.map((t) => ringAt(c, first[0], first[1], t)));
|
|
39
|
+
return poly(clean(pts));
|
|
40
|
+
}
|
|
41
|
+
/** The front half of a ring round the solid at c: a moulding, a node, a seam line. */
|
|
42
|
+
export const band = (c, r, z) => line(...sweep(0, Math.PI).map((t) => ringAt(c, r, z, t)));
|
|
43
|
+
/** The front of the solid between two rings, filled: a painted belt. */
|
|
44
|
+
export const belt = (c, r1, z1, r2, z2) => poly(clean([
|
|
45
|
+
...sweep(0, Math.PI).map((t) => ringAt(c, r1, z1, t)),
|
|
46
|
+
...sweep(Math.PI, 0).map((t) => ringAt(c, r2, z2, t)),
|
|
47
|
+
]));
|
|
48
|
+
/** A line running up the front of the solid at angle t (0 is the right edge, pi/2 the nearest point). */
|
|
49
|
+
export const seam = (c, profile, t) => line(...profile.map(([r, z]) => ringAt(c, r, z, t)));
|
|
50
|
+
/**
|
|
51
|
+
* A leaf blade on screen from o, pointing at `ang` radians (0 right, positive down), `len` long and `w` wide at the
|
|
52
|
+
* middle, its midrib bending down by `droop` of its length (negative bends it up). Returns the outline and the midrib.
|
|
53
|
+
*/
|
|
54
|
+
export function blade(o, ang, len, w, droop) {
|
|
55
|
+
const dir = [Math.cos(ang), Math.sin(ang)];
|
|
56
|
+
const at = (t) => [
|
|
57
|
+
o[0] + dir[0] * len * t,
|
|
58
|
+
o[1] + dir[1] * len * t + droop * len * t * t,
|
|
59
|
+
];
|
|
60
|
+
const ts = sweep(0, 1, 10);
|
|
61
|
+
const rib = ts.map(at);
|
|
62
|
+
const side = (k) => ts.map((t, i) => {
|
|
63
|
+
const p = rib[i] ?? o;
|
|
64
|
+
const q = at(Math.min(1, t + 0.01));
|
|
65
|
+
const r = at(Math.max(0, t - 0.01));
|
|
66
|
+
const [dx, dy] = [q[0] - r[0], q[1] - r[1]];
|
|
67
|
+
const l = Math.hypot(dx, dy) || 1;
|
|
68
|
+
const half = (w / 2) * Math.sin(Math.PI * t) ** 0.7 * k;
|
|
69
|
+
return [p[0] - (dy / l) * half, p[1] + (dx / l) * half];
|
|
70
|
+
});
|
|
71
|
+
return { d: poly(clean([...side(1), ...side(-1).reverse()])), rib };
|
|
72
|
+
}
|
|
73
|
+
/** How far a 3d point sits from the viewer under ISO; draw the larger first. */
|
|
74
|
+
export const farness = ([x, y]) => -0.5 * x + 0.866 * y;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: kuay teow, a bowl of noodle soup; chopsticks lift a few strands and dip them back.
|
|
2
|
+
import { slide, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, poly, rect } from '../sticker.js';
|
|
4
|
+
import { DOWN, steam, TABLE } from './food.js';
|
|
5
|
+
import { glow, LINE } from './shared.js';
|
|
6
|
+
const stick = (x) => ({
|
|
7
|
+
d: poly([
|
|
8
|
+
[x, -40],
|
|
9
|
+
[x + 10, -44],
|
|
10
|
+
[x + 120, -210],
|
|
11
|
+
[x + 112, -214],
|
|
12
|
+
], 2),
|
|
13
|
+
fill: 'deep',
|
|
14
|
+
});
|
|
15
|
+
export const noodleSoup = {
|
|
16
|
+
name: 'noodle-soup',
|
|
17
|
+
frames: 160,
|
|
18
|
+
line: LINE,
|
|
19
|
+
extrude: DOWN,
|
|
20
|
+
layers: [
|
|
21
|
+
{ id: 'root', p: [244, 290], shapes: [] },
|
|
22
|
+
{
|
|
23
|
+
id: 'bowl',
|
|
24
|
+
parent: 'root',
|
|
25
|
+
tilt: TABLE,
|
|
26
|
+
shapes: [
|
|
27
|
+
{ d: ellipse(0, 0, 150), fill: 'white', side: 'main', depth: 3.6 },
|
|
28
|
+
{ d: ellipse(0, 0, 128), fill: 'gold' },
|
|
29
|
+
{ d: 'M-90 -10q15 -18 30 0t30 0t30 0t30 0t30 0', round: true },
|
|
30
|
+
{ d: 'M-80 30q15 -18 30 0t30 0t30 0t30 0', round: true },
|
|
31
|
+
{ d: 'M-60 -50q15 -18 30 0t30 0t30 0', round: true },
|
|
32
|
+
{ d: ellipse(50, 60, 20), fill: 'paper', depth: 0.4 },
|
|
33
|
+
{ d: ellipse(80, 20, 20), fill: 'paper', depth: 0.4 },
|
|
34
|
+
{ d: ellipse(-40, 80, 20), fill: 'paper', depth: 0.4 },
|
|
35
|
+
{ d: ellipse(-80, -60, 9), fill: 'ok', line: 3 },
|
|
36
|
+
{ d: ellipse(20, -80, 9), fill: 'ok', line: 3 },
|
|
37
|
+
{ d: ellipse(-10, 50, 9), fill: 'ok', line: 3 },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
parent: 'root',
|
|
42
|
+
m: slide([0, -40], 24, 40, 36),
|
|
43
|
+
shapes: [
|
|
44
|
+
...[46, 58, 70].map((x) => ({ d: rect(x, -48, 9, 74, 4), fill: 'paper' })),
|
|
45
|
+
stick(44),
|
|
46
|
+
stick(64),
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
steam('root', [-80, -30], -70),
|
|
50
|
+
glow('root', [-170, -40], 20, [twinkle(50), twinkle(130, true)]),
|
|
51
|
+
],
|
|
52
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers after the network diagrams of Protocol Explorer, modelled in 3d (see iso.ts).
|
|
2
|
+
import { erase, jolt, twinkle } from '../motions.js';
|
|
3
|
+
import { block, faceOf, quad, solid, stroke } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// A thin light notebook, lid open about 105 degrees: silver deck and lid, dark bezel, a wide trackpad
|
|
6
|
+
const W = 280;
|
|
7
|
+
const D = 184;
|
|
8
|
+
const LID = 182;
|
|
9
|
+
const LEAN = (15 * Math.PI) / 180;
|
|
10
|
+
const DECK = block([-W / 2, -D / 2, 0], [W, 0, 0], [0, D, 0], [0, 0, 12]);
|
|
11
|
+
const deckTop = faceOf(DECK, 'top');
|
|
12
|
+
// the lid hinges on the deck's back edge and leans back; its thickness runs behind the screen
|
|
13
|
+
const UP = [0, Math.sin(LEAN) * LID, Math.cos(LEAN) * LID];
|
|
14
|
+
const BACK = [0, Math.cos(LEAN) * 7, -Math.sin(LEAN) * 7];
|
|
15
|
+
const LIDB = block([-W / 2, D / 2, 12], [W, 0, 0], BACK, UP);
|
|
16
|
+
const screen = faceOf(LIDB, 'front');
|
|
17
|
+
export const notebook = {
|
|
18
|
+
name: 'notebook',
|
|
19
|
+
frames: 180,
|
|
20
|
+
still: 150,
|
|
21
|
+
line: LINE,
|
|
22
|
+
extrude: [0, 0],
|
|
23
|
+
layers: [
|
|
24
|
+
{ id: 'nb', p: [250, 330], m: jolt([-6, 10]), shapes: [] },
|
|
25
|
+
{
|
|
26
|
+
parent: 'nb',
|
|
27
|
+
shapes: [
|
|
28
|
+
...solid(LIDB, { fill: 'grey', front: 'white' }, 3),
|
|
29
|
+
{ d: quad(screen, 0.04, 0.06, 0.92, 0.9, 4), fill: 'ink', line: false },
|
|
30
|
+
{ d: quad(screen, 0.07, 0.1, 0.86, 0.82, 3), fill: 'tint' },
|
|
31
|
+
{ d: quad(screen, 0.14, 0.5, 0.3, 0.32, 4), fill: 'white' },
|
|
32
|
+
...[0.74, 0.6, 0.46].map((t, i) => ({
|
|
33
|
+
d: stroke(screen, [0.52, t], [i === 1 ? 0.74 : 0.84, t]),
|
|
34
|
+
trim: erase(24 - i * 5, 90 + i * 5),
|
|
35
|
+
})),
|
|
36
|
+
...solid(DECK, { fill: 'grey', top: 'white' }, 3),
|
|
37
|
+
{ d: quad(deckTop, 0.08, 0.5, 0.84, 0.4, 3), fill: 'paper' },
|
|
38
|
+
...[0.62, 0.76].map((t) => ({ d: stroke(deckTop, [0.14, t], [0.86, t]) })),
|
|
39
|
+
{ d: quad(deckTop, 0.3, 0.08, 0.4, 0.32, 4), fill: 'paper' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
glow('nb', [160, -230], 24, [twinkle(40), twinkle(140, true)]),
|
|
43
|
+
],
|
|
44
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Shape, Swatch, Vec } from '../sticker.js';
|
|
2
|
+
import type { V3 } from '../iso.js';
|
|
3
|
+
export interface Drum {
|
|
4
|
+
/** Side, then the rim facing the viewer. */
|
|
5
|
+
shapes: Shape[];
|
|
6
|
+
/** The facing rim's space to screen: s and t from -1 to 1 across it. */
|
|
7
|
+
at: (s: number, t: number) => Vec;
|
|
8
|
+
/** A circle on the facing rim, centred at (s, t) with radius r in rim units. */
|
|
9
|
+
disc: (s: number, t: number, r: number) => string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A drum from `o` along `axis`, radius `r0` at `o` and `r1` at the far end. `up` picks the rim's first direction
|
|
13
|
+
* (any vector not along the axis).
|
|
14
|
+
*/
|
|
15
|
+
export declare function drum(o: V3, axis: V3, r0: number, r1: number, fills: {
|
|
16
|
+
side: Swatch;
|
|
17
|
+
cap: Swatch;
|
|
18
|
+
}, up?: V3): Drum;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Round solids for the object stickers, modelled in 3d with the house camera (see iso.ts): a drum is a cylinder or a
|
|
2
|
+
// cone frustum along any axis, drawn as its silhouette (the hull of both rims) and the rim that faces the viewer.
|
|
3
|
+
import { poly } from '../sticker.js';
|
|
4
|
+
import { add, ISO, mul } from '../iso.js';
|
|
5
|
+
const N = 36;
|
|
6
|
+
const cross = (a, b) => [
|
|
7
|
+
a[1] * b[2] - a[2] * b[1],
|
|
8
|
+
a[2] * b[0] - a[0] * b[2],
|
|
9
|
+
a[0] * b[1] - a[1] * b[0],
|
|
10
|
+
];
|
|
11
|
+
const unit = (a) => mul(a, 1 / Math.hypot(...a));
|
|
12
|
+
const area = (pts) => pts.reduce((s, p, i) => {
|
|
13
|
+
const q = pts[(i + 1) % pts.length] ?? p;
|
|
14
|
+
return s + p[0] * q[1] - q[0] * p[1];
|
|
15
|
+
}, 0);
|
|
16
|
+
/** The convex hull of points on screen (monotone chain). */
|
|
17
|
+
function hull(pts) {
|
|
18
|
+
const s = [...pts].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
19
|
+
const turn = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
20
|
+
const half = (list) => {
|
|
21
|
+
const out = [];
|
|
22
|
+
for (const p of list) {
|
|
23
|
+
while (out.length >= 2 && turn(out[out.length - 2] ?? p, out[out.length - 1] ?? p, p) <= 0)
|
|
24
|
+
out.pop();
|
|
25
|
+
out.push(p);
|
|
26
|
+
}
|
|
27
|
+
out.pop();
|
|
28
|
+
return out;
|
|
29
|
+
};
|
|
30
|
+
return [...half(s), ...half([...s].reverse())];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A drum from `o` along `axis`, radius `r0` at `o` and `r1` at the far end. `up` picks the rim's first direction
|
|
34
|
+
* (any vector not along the axis).
|
|
35
|
+
*/
|
|
36
|
+
export function drum(o, axis, r0, r1, fills, up = [0, 1, 0]) {
|
|
37
|
+
const a = unit(axis);
|
|
38
|
+
const u = unit(cross(Math.abs(a[1]) > 0.9 ? [1, 0, 0] : up, a));
|
|
39
|
+
const v = cross(a, u);
|
|
40
|
+
const rim = (c, r) => Array.from({ length: N }, (_, i) => {
|
|
41
|
+
const t = (i / N) * Math.PI * 2;
|
|
42
|
+
return ISO(add(c, add(mul(u, Math.cos(t) * r), mul(v, Math.sin(t) * r))));
|
|
43
|
+
});
|
|
44
|
+
const end = add(o, axis);
|
|
45
|
+
const far = rim(end, r1);
|
|
46
|
+
const near = rim(o, r0);
|
|
47
|
+
// the end rim winds the house way when its outward normal (the axis) faces the viewer
|
|
48
|
+
const endShows = area(far) < 0;
|
|
49
|
+
const [c, r, pts] = endShows ? [end, r1, far] : [o, r0, near];
|
|
50
|
+
const at = (s, t) => ISO(add(c, add(mul(u, s * r), mul(v, t * r))));
|
|
51
|
+
const disc = (s, t, rr) => poly(Array.from({ length: 20 }, (_, i) => {
|
|
52
|
+
const g = (i / 20) * Math.PI * 2;
|
|
53
|
+
return at(s + Math.cos(g) * rr, t + Math.sin(g) * rr);
|
|
54
|
+
}), 1);
|
|
55
|
+
return {
|
|
56
|
+
shapes: [
|
|
57
|
+
{ d: poly(hull([...near, ...far]), 1), fill: fills.side },
|
|
58
|
+
{ d: poly(pts, 1), fill: fills.cap },
|
|
59
|
+
],
|
|
60
|
+
at,
|
|
61
|
+
disc,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a one-time code arriving on a phone, digit by digit, then a check.
|
|
2
|
+
import { twinkle, wiggle } from '../motions.js';
|
|
3
|
+
import { ellipse, line, pill, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
const XS = [-69, -33, 3, 39];
|
|
6
|
+
export const otp = {
|
|
7
|
+
name: 'otp',
|
|
8
|
+
frames: 180,
|
|
9
|
+
line: LINE,
|
|
10
|
+
extrude: EXT,
|
|
11
|
+
still: 110,
|
|
12
|
+
layers: [
|
|
13
|
+
{ id: 'ph', a: [0, 150], p: [244, 396], m: { ...wiggle, k: 0.5 }, shapes: [] },
|
|
14
|
+
{
|
|
15
|
+
id: 'scr',
|
|
16
|
+
parent: 'ph',
|
|
17
|
+
tilt: FACE,
|
|
18
|
+
shapes: [
|
|
19
|
+
{ d: rect(-90, -160, 180, 320, 36), fill: 'deep', depth: 0.8 },
|
|
20
|
+
{ d: rect(-78, -148, 156, 296, 26), fill: 'tint' },
|
|
21
|
+
{ d: pill(-30, -132, 60, 10), fill: 'ink', line: false },
|
|
22
|
+
{ d: line([-44, -92], [44, -92]) },
|
|
23
|
+
{ d: line([-26, -72], [26, -72]) },
|
|
24
|
+
...XS.map((x) => ({ d: rect(x, -42, 30, 46, 8), fill: 'white', depth: 0.3 })),
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
...XS.map((x, i) => ({
|
|
28
|
+
parent: 'scr',
|
|
29
|
+
a: [x + 15, -19],
|
|
30
|
+
p: [x + 15, -19],
|
|
31
|
+
m: [twinkle(18 + i * 10), twinkle(148, true)],
|
|
32
|
+
shapes: [{ d: ellipse(x + 15, -19, 8), fill: 'ink', line: false }],
|
|
33
|
+
})),
|
|
34
|
+
{
|
|
35
|
+
parent: 'scr',
|
|
36
|
+
a: [0, 62],
|
|
37
|
+
p: [0, 62],
|
|
38
|
+
m: [twinkle(64), twinkle(152, true)],
|
|
39
|
+
shapes: [
|
|
40
|
+
{ d: rect(-46, 40, 92, 44, 22), fill: 'ok', depth: 0.3 },
|
|
41
|
+
{ d: line([-16, 62], [-4, 74], [18, 50]) },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
glow('ph', [124, -170], 24, [twinkle(64), twinkle(140, true)]),
|
|
45
|
+
],
|
|
46
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: over budget; an empty wallet shakes, a fly buzzes out of it, an alert pops.
|
|
2
|
+
import { drift, twinkle, wiggle } from '../motions.js';
|
|
3
|
+
import { ellipse, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
export const overBudget = {
|
|
6
|
+
name: 'over-budget',
|
|
7
|
+
frames: 180,
|
|
8
|
+
line: LINE,
|
|
9
|
+
extrude: EXT,
|
|
10
|
+
layers: [
|
|
11
|
+
{ id: 'root', p: [250, 250], shapes: [] },
|
|
12
|
+
{ id: 'w', parent: 'root', a: [-20, 140], p: [-20, 140], m: { ...wiggle, k: 0.5 }, shapes: [] },
|
|
13
|
+
{
|
|
14
|
+
parent: 'w',
|
|
15
|
+
tilt: FACE,
|
|
16
|
+
shapes: [
|
|
17
|
+
{ d: rect(-150, -110, 300, 210, 24), fill: 'deep', depth: 1 },
|
|
18
|
+
{ d: rect(-126, -88, 252, 90, 12), fill: 'tint', depth: 0.1 },
|
|
19
|
+
{ d: rect(-150, -6, 300, 116, 24), fill: 'main', depth: 0.6 },
|
|
20
|
+
{ d: rect(96, -30, 84, 60, 16), fill: 'deep', depth: 0.4 },
|
|
21
|
+
{ d: ellipse(150, 0, 12), fill: 'white', depth: 0.2 },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
parent: 'root',
|
|
26
|
+
p: [30, -140],
|
|
27
|
+
m: drift.map((m) => ({ ...m, k: 2.2 })),
|
|
28
|
+
shapes: [
|
|
29
|
+
{ d: ellipse(-18, -24, 22, 13), fill: 'white' },
|
|
30
|
+
{ d: ellipse(18, -24, 22, 13), fill: 'white' },
|
|
31
|
+
{ d: ellipse(0, 0, 24, 17), fill: 'ink' },
|
|
32
|
+
{ d: ellipse(-14, -4, 5), fill: 'white', line: false },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
parent: 'root',
|
|
37
|
+
a: [150, -80],
|
|
38
|
+
p: [150, -80],
|
|
39
|
+
m: [twinkle(30), twinkle(140, true)],
|
|
40
|
+
shapes: [
|
|
41
|
+
{ d: ellipse(150, -80, 30), fill: 'hot', depth: 0.4 },
|
|
42
|
+
{ d: rect(146, -98, 8, 22, 3), fill: 'white', line: false },
|
|
43
|
+
{ d: ellipse(150, -66, 4.5), fill: 'white', line: false },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
glow('root', [-170, -130], 18, [twinkle(48), twinkle(140, true)]),
|
|
47
|
+
],
|
|
48
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: pad see ew with yellow egg noodles, Chinese kale, pork and egg, tossed on the plate.
|
|
2
|
+
import { hop, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, line, rect } from '../sticker.js';
|
|
4
|
+
import { DOWN, plate, steam, TABLE } from './food.js';
|
|
5
|
+
import { glow, LINE } from './shared.js';
|
|
6
|
+
// a ribbon with a wave along both edges
|
|
7
|
+
const ribbon = (x, y, w) => {
|
|
8
|
+
const q = w / 4;
|
|
9
|
+
const t = `t${String(q)} 0`;
|
|
10
|
+
return `M${String(x)} ${String(y)}q${String(q / 2)} -12 ${String(q)} 0${t}${t}${t}l0 18q${String(-q / 2)} 12 ${String(-q)} 0t${String(-q)} 0t${String(-q)} 0t${String(-q)} 0Z`;
|
|
11
|
+
};
|
|
12
|
+
const NOODLES = [
|
|
13
|
+
[-120, -40, 150],
|
|
14
|
+
[-90, -10, 170],
|
|
15
|
+
[-130, 20, 140],
|
|
16
|
+
[-60, 50, 150],
|
|
17
|
+
[-100, 80, 120],
|
|
18
|
+
[-40, -70, 130],
|
|
19
|
+
];
|
|
20
|
+
export const padSeeEw = {
|
|
21
|
+
name: 'pad-see-ew',
|
|
22
|
+
frames: 160,
|
|
23
|
+
line: LINE,
|
|
24
|
+
extrude: DOWN,
|
|
25
|
+
layers: [
|
|
26
|
+
{ id: 'root', p: [250, 300], shapes: [] },
|
|
27
|
+
{ id: 'dish', parent: 'root', tilt: TABLE, shapes: plate(180) },
|
|
28
|
+
{
|
|
29
|
+
parent: 'dish',
|
|
30
|
+
a: [0, 0],
|
|
31
|
+
m: { ...hop, k: 0.6 },
|
|
32
|
+
shapes: [
|
|
33
|
+
...NOODLES.map(([x, y, w]) => ({
|
|
34
|
+
d: ribbon(x, y, w),
|
|
35
|
+
fill: 'gold',
|
|
36
|
+
depth: 0.6,
|
|
37
|
+
})),
|
|
38
|
+
...[
|
|
39
|
+
[40, -50],
|
|
40
|
+
[90, 10],
|
|
41
|
+
[-20, 100],
|
|
42
|
+
].flatMap(([x = 0, y = 0]) => [
|
|
43
|
+
{ d: ellipse(x, y, 34, 22), fill: 'ok', depth: 0.3 },
|
|
44
|
+
{ d: line([x - 26, y], [x + 26, y]) },
|
|
45
|
+
]),
|
|
46
|
+
{ d: rect(60, 60, 34, 26, 6), fill: 'deep', depth: 0.6 },
|
|
47
|
+
{ d: rect(10, 20, 30, 24, 6), fill: 'deep', depth: 0.6 },
|
|
48
|
+
{ d: rect(110, -40, 30, 24, 6), fill: 'deep', depth: 0.6 },
|
|
49
|
+
{ d: ellipse(-10, -20, 18, 14), fill: 'white', depth: 0.4 },
|
|
50
|
+
{ d: ellipse(50, 110, 16, 12), fill: 'white', depth: 0.4 },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
steam('root', [-50, 0, 50], -80),
|
|
54
|
+
glow('root', [170, -70], 20, [twinkle(40), twinkle(130, true)]),
|
|
55
|
+
],
|
|
56
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a coconut palm on a sand tile in 2.5d (tile and trunk in 3d, see plant-kit.ts).
|
|
2
|
+
import { sway, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse } from '../sticker.js';
|
|
4
|
+
import { ISO } from '../iso.js';
|
|
5
|
+
import { frond, rod, spine, tile } from './plant-kit.js';
|
|
6
|
+
import { glow, LINE } from './shared.js';
|
|
7
|
+
// the trunk leans and bends: short rings stacked along a curve
|
|
8
|
+
const RINGS = 7;
|
|
9
|
+
const point = (i) => {
|
|
10
|
+
const t = i / RINGS;
|
|
11
|
+
return [-24 + 50 * t * t, -6 * t, 236 * t];
|
|
12
|
+
};
|
|
13
|
+
const TRUNK = Array.from({ length: RINGS }, (_, i) => rod(point(i), point(i + 1), 22 - i, 21 - i, 'gold', 'gold')).flat();
|
|
14
|
+
const CROWN = ISO(point(RINGS));
|
|
15
|
+
// angle (screen, 0 is right), length, droop
|
|
16
|
+
const FRONDS = [
|
|
17
|
+
[-150, 150, 80],
|
|
18
|
+
[-30, 156, 84],
|
|
19
|
+
[-114, 120, 40],
|
|
20
|
+
[-64, 126, 40],
|
|
21
|
+
[178, 140, 110],
|
|
22
|
+
[4, 146, 116],
|
|
23
|
+
];
|
|
24
|
+
export const palmTree = {
|
|
25
|
+
name: 'palm-tree',
|
|
26
|
+
frames: 180,
|
|
27
|
+
line: LINE,
|
|
28
|
+
extrude: [5, 10],
|
|
29
|
+
layers: [
|
|
30
|
+
{ id: 'isle', p: [250, 380], shapes: [] },
|
|
31
|
+
{ parent: 'isle', shapes: [...tile(104, 'paper', 'gold'), ...TRUNK] },
|
|
32
|
+
...FRONDS.map(([deg, len, droop], i) => ({
|
|
33
|
+
parent: 'isle',
|
|
34
|
+
a: CROWN,
|
|
35
|
+
p: CROWN,
|
|
36
|
+
m: { ...sway, at: i * 10, k: deg > -90 ? 1 : -1 },
|
|
37
|
+
shapes: [
|
|
38
|
+
{ d: frond(CROWN, deg, len, 28, droop), fill: 'ok', depth: 0.3 },
|
|
39
|
+
{ d: spine(CROWN, deg, len, droop) },
|
|
40
|
+
],
|
|
41
|
+
})),
|
|
42
|
+
{
|
|
43
|
+
parent: 'isle',
|
|
44
|
+
shapes: [
|
|
45
|
+
[-12, 10],
|
|
46
|
+
[12, 12],
|
|
47
|
+
[0, 26],
|
|
48
|
+
].map(([x, y]) => ({ d: ellipse(CROWN[0] + x, CROWN[1] + y, 13), fill: 'deep' })),
|
|
49
|
+
},
|
|
50
|
+
glow('isle', [-150, -250], 22, [twinkle(46), twinkle(140, true)]),
|
|
51
|
+
],
|
|
52
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a folded paper boat on a round of water, modelled in 3d (see iso.ts); it bobs.
|
|
2
|
+
import { bob, twinkle } from '../motions.js';
|
|
3
|
+
import { line, poly } from '../sticker.js';
|
|
4
|
+
import { ISO } from '../iso.js';
|
|
5
|
+
import { drum } from './object-drum.js';
|
|
6
|
+
import { glow, LINE } from './shared.js';
|
|
7
|
+
const WATER = drum([0, 0, 0], [0, 0, 16], 164, 164, { side: 'main', cap: 'tint' });
|
|
8
|
+
const Z = 26;
|
|
9
|
+
const P = (x, y, z) => ISO([x, y, z + Z]);
|
|
10
|
+
const face = (pts, fill) => ({
|
|
11
|
+
d: poly(pts.map((p) => P(...p)), 3),
|
|
12
|
+
fill,
|
|
13
|
+
});
|
|
14
|
+
// painted back to front: the far wall (its inside shows), the sail with its fold, the near wall; the ends rise to points
|
|
15
|
+
const K0 = [-70, 0, 0];
|
|
16
|
+
const K1 = [70, 0, 0];
|
|
17
|
+
const E0 = [-160, 0, 96];
|
|
18
|
+
const E1 = [160, 0, 96];
|
|
19
|
+
const BOAT = [
|
|
20
|
+
face([K0, K1, E1, [0, 40, 62], E0], 'tint'),
|
|
21
|
+
face([
|
|
22
|
+
[-66, 0, 58],
|
|
23
|
+
[0, 0, 196],
|
|
24
|
+
[0, -22, 58],
|
|
25
|
+
], 'white'),
|
|
26
|
+
face([
|
|
27
|
+
[0, -22, 58],
|
|
28
|
+
[0, 0, 196],
|
|
29
|
+
[66, 0, 58],
|
|
30
|
+
], 'tint'),
|
|
31
|
+
face([K0, K1, E1, [0, -40, 62], E0], 'white'),
|
|
32
|
+
{ d: line(P(-70, -22, 30), P(70, -22, 30)), line: 3 },
|
|
33
|
+
];
|
|
34
|
+
const WAVES = [
|
|
35
|
+
[-0.6, -0.3],
|
|
36
|
+
[0.35, 0.5],
|
|
37
|
+
].map(([s, t]) => ({
|
|
38
|
+
d: line(WATER.at(s - 0.2, t), WATER.at(s, t + 0.06), WATER.at(s + 0.2, t)),
|
|
39
|
+
line: 4,
|
|
40
|
+
}));
|
|
41
|
+
export const paperBoat = {
|
|
42
|
+
name: 'paper-boat',
|
|
43
|
+
frames: 160,
|
|
44
|
+
line: LINE,
|
|
45
|
+
extrude: [0, 0],
|
|
46
|
+
layers: [
|
|
47
|
+
{ id: 'pond', p: [250, 330], shapes: [...WATER.shapes, ...WAVES] },
|
|
48
|
+
{
|
|
49
|
+
parent: 'pond',
|
|
50
|
+
a: ISO([0, 0, 0]),
|
|
51
|
+
p: ISO([0, 0, 0]),
|
|
52
|
+
m: [
|
|
53
|
+
{ ...bob, k: 2.4 },
|
|
54
|
+
{
|
|
55
|
+
r: [
|
|
56
|
+
[0, 0, [0.333, 0, 0.667, 1]],
|
|
57
|
+
[40, 3, [0.333, 0, 0.667, 1]],
|
|
58
|
+
[120, -3, [0.333, 0, 0.667, 1]],
|
|
59
|
+
[160, 0],
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
shapes: BOAT,
|
|
64
|
+
},
|
|
65
|
+
glow('pond', [150, -200], 24, [twinkle(40), twinkle(126, true)]),
|
|
66
|
+
],
|
|
67
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The sheet of paper the file stickers share: a page with a folded corner, text lines and a kind tag.
|
|
2
|
+
import { line, poly } from '../sticker.js';
|
|
3
|
+
/** A page w by h with its top-left at (x, y), the top-right corner folded; `tag` colours a label at its foot. */
|
|
4
|
+
export function page(x, y, w, h, tag) {
|
|
5
|
+
const f = Math.min(w, h) * 0.26;
|
|
6
|
+
const lines = [0.3, 0.42, 0.54].map((t, i) => ({
|
|
7
|
+
d: line([x + w * 0.18, y + h * t], [x + w * (i === 2 ? 0.6 : 0.82), y + h * t]),
|
|
8
|
+
}));
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
d: poly([
|
|
12
|
+
[x, y],
|
|
13
|
+
[x + w - f, y],
|
|
14
|
+
[x + w, y + f],
|
|
15
|
+
[x + w, y + h],
|
|
16
|
+
[x, y + h],
|
|
17
|
+
], [10, 2, 2, 10, 10]),
|
|
18
|
+
fill: 'white',
|
|
19
|
+
depth: 0.6,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
d: poly([
|
|
23
|
+
[x + w - f, y],
|
|
24
|
+
[x + w - f, y + f],
|
|
25
|
+
[x + w, y + f],
|
|
26
|
+
], 2),
|
|
27
|
+
fill: 'tint',
|
|
28
|
+
},
|
|
29
|
+
...lines,
|
|
30
|
+
...(tag
|
|
31
|
+
? [
|
|
32
|
+
{
|
|
33
|
+
d: poly([
|
|
34
|
+
[x + w * 0.14, y + h * 0.72],
|
|
35
|
+
[x + w * 0.62, y + h * 0.72],
|
|
36
|
+
[x + w * 0.62, y + h * 0.86],
|
|
37
|
+
[x + w * 0.14, y + h * 0.86],
|
|
38
|
+
], 8),
|
|
39
|
+
fill: tag,
|
|
40
|
+
depth: 0.2,
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
: []),
|
|
44
|
+
];
|
|
45
|
+
}
|