@20baht/stickers 0.0.0-stage → 0.1.1
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/cron.d.ts +2 -0
- package/dist/icons/cron.js +86 -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 +187 -0
- package/dist/icons/index.js +370 -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/kanban.d.ts +2 -0
- package/dist/icons/kanban.js +85 -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 +199 -0
- package/dist/load.js +199 -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,58 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers (konmek asked for one): a metrics panel, an area graph that refreshes to new readings
|
|
2
|
+
// and back, the latest reading riding the end of the line, a live light in the corner.
|
|
3
|
+
import { hop, SNAP, twinkle } from '../motions.js';
|
|
4
|
+
import { ellipse, line, rect } from '../sticker.js';
|
|
5
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
6
|
+
const XS = [-118, -72, -26, 20, 66, 112];
|
|
7
|
+
const BASE = 82;
|
|
8
|
+
const BEFORE = [36, 20, 34, 10, 22, -4];
|
|
9
|
+
const AFTER = [44, 6, 24, -22, -6, -50];
|
|
10
|
+
const points = (ys) => XS.map((x, i) => [x, ys[i] ?? 0]);
|
|
11
|
+
// straight segments only, so every reading morphs into the next point for point
|
|
12
|
+
const area = (ys) => line(...points(ys), [XS.at(-1) ?? 0, BASE], [XS[0] ?? 0, BASE]) + 'Z';
|
|
13
|
+
const last = (ys) => points(ys).at(-1) ?? [0, 0];
|
|
14
|
+
// new readings come in, hold, and the old ones come back before the loop
|
|
15
|
+
const refresh = (a, b) => [
|
|
16
|
+
[16, a, SNAP],
|
|
17
|
+
[52, b, 0],
|
|
18
|
+
[116, b, SNAP],
|
|
19
|
+
[152, a],
|
|
20
|
+
];
|
|
21
|
+
export const metrics = {
|
|
22
|
+
name: 'metrics',
|
|
23
|
+
frames: 180,
|
|
24
|
+
line: LINE,
|
|
25
|
+
extrude: EXT,
|
|
26
|
+
still: 90,
|
|
27
|
+
layers: [
|
|
28
|
+
{ id: 'root', a: [0, 120], p: [250, 350], m: { ...hop, k: 0.5 }, shapes: [] },
|
|
29
|
+
{
|
|
30
|
+
id: 'card',
|
|
31
|
+
parent: 'root',
|
|
32
|
+
tilt: FACE,
|
|
33
|
+
shapes: [
|
|
34
|
+
{ d: rect(-150, -120, 300, 240, 22), fill: 'white', depth: 1 },
|
|
35
|
+
{ d: line([-84, -82], [-10, -82]), line: 9 },
|
|
36
|
+
{ d: line([50, -82], [118, -82]) },
|
|
37
|
+
{ d: refresh(area(BEFORE), area(AFTER)), fill: 'main' },
|
|
38
|
+
{ d: line([-128, BASE], [122, BASE]) },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
parent: 'card',
|
|
43
|
+
a: [-114, -82],
|
|
44
|
+
p: [-114, -82],
|
|
45
|
+
m: [twinkle(8), twinkle(160, true)],
|
|
46
|
+
shapes: [{ d: ellipse(-114, -82, 13), fill: 'ok', depth: 0.4 }],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
parent: 'card',
|
|
50
|
+
p: refresh(last(BEFORE), last(AFTER)),
|
|
51
|
+
shapes: [
|
|
52
|
+
{ d: ellipse(0, 0, 18), fill: 'gold', depth: 0.6 },
|
|
53
|
+
{ d: ellipse(0, 0, 6), fill: 'white' },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
glow('root', [160, -170], 22, [twinkle(54), twinkle(140, true)]),
|
|
57
|
+
],
|
|
58
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers after the network diagrams of Protocol Explorer (redrawn as a slab).
|
|
2
|
+
import { hop, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
// A low square desktop box: a light slab with rounded corners on a darker round foot, one power light
|
|
6
|
+
export const miniPc = {
|
|
7
|
+
name: 'mini-pc',
|
|
8
|
+
frames: 180,
|
|
9
|
+
line: LINE,
|
|
10
|
+
extrude: EXT,
|
|
11
|
+
layers: [
|
|
12
|
+
{ id: 'box', p: [250, 290], m: hop, shapes: [] },
|
|
13
|
+
{
|
|
14
|
+
parent: 'box',
|
|
15
|
+
tilt: FACE,
|
|
16
|
+
shapes: [
|
|
17
|
+
// the foot only shows as the dark band under the body
|
|
18
|
+
{ d: ellipse(0, 0, 118), fill: 'deep', depth: 2.6 },
|
|
19
|
+
{ d: rect(-134, -134, 268, 268, 50), fill: 'white', depth: 1 },
|
|
20
|
+
{ d: rect(-112, -112, 224, 224, 36), fill: 'tint', depth: 0.1 },
|
|
21
|
+
{ d: ellipse(104, 104, 8), fill: 'ok' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
glow('box', [150, -130], 24, [twinkle(40), twinkle(140, true)]),
|
|
25
|
+
],
|
|
26
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers, modelled in 3d (see iso.ts).
|
|
2
|
+
import { hop, twinkle } from '../motions.js';
|
|
3
|
+
import { block, dot, faceOf, solid } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// An ISP fibre box standing upright: a column of lights on the front, the yellow fibre plugged into its side
|
|
6
|
+
const W = 70;
|
|
7
|
+
const D = 170;
|
|
8
|
+
const H = 230;
|
|
9
|
+
const BOX = block([-W / 2, -D / 2, 0], [W, 0, 0], [0, D, 0], [0, 0, H]);
|
|
10
|
+
const front = faceOf(BOX, 'front');
|
|
11
|
+
const FOOT = block([-W / 2 - 20, -D / 2 - 10, -14], [W + 40, 0, 0], [0, D + 20, 0], [0, 0, 14]);
|
|
12
|
+
// the fibre: a boot in the right face, the cable running back and down to the floor
|
|
13
|
+
const BOOT = block([W / 2, -20, 50], [22, 0, 0], [0, 26, 0], [0, 0, 22]);
|
|
14
|
+
const CABLE = block([W / 2 + 22, -14, -10], [14, 0, 0], [0, 14, 0], [0, 0, 82]);
|
|
15
|
+
export const modem = {
|
|
16
|
+
name: 'modem',
|
|
17
|
+
frames: 180,
|
|
18
|
+
line: LINE,
|
|
19
|
+
extrude: [0, 0],
|
|
20
|
+
layers: [
|
|
21
|
+
{ id: 'm', p: [250, 380], m: hop, shapes: [] },
|
|
22
|
+
{
|
|
23
|
+
parent: 'm',
|
|
24
|
+
shapes: [
|
|
25
|
+
...solid(FOOT, { fill: 'grey', top: 'grey' }, 4),
|
|
26
|
+
...solid(BOX, { fill: 'grey', front: 'white', top: 'white' }, 6),
|
|
27
|
+
...['ok', 'ok', 'ok', 'gold'].map((fill, i) => ({
|
|
28
|
+
d: dot(front, 0.5, 0.82 - i * 0.12, 0.1, 0.03),
|
|
29
|
+
fill,
|
|
30
|
+
})),
|
|
31
|
+
...solid(CABLE, { fill: 'gold' }, 2),
|
|
32
|
+
...solid(BOOT, { fill: 'gold', top: 'white' }, 2),
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
glow('m', [120, -270], 22, [twinkle(40), twinkle(140, true)]),
|
|
36
|
+
],
|
|
37
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers, modelled in 3d (see iso.ts).
|
|
2
|
+
import { erase, hop, twinkle } from '../motions.js';
|
|
3
|
+
import { block, faceOf, quad, solid, stroke } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// A standalone monitor: a dark thin-bezel panel with no chin, on a post and a square foot
|
|
6
|
+
const FOOT = block([-60, -50, 0], [120, 0, 0], [0, 100, 0], [0, 0, 10]);
|
|
7
|
+
const POST = block([-14, 20, 10], [28, 0, 0], [0, 14, 0], [0, 0, 96]);
|
|
8
|
+
const PANEL = block([-160, 8, 70], [320, 0, 0], [0, 10, 0], [0, 0, 190]);
|
|
9
|
+
const screen = faceOf(PANEL, 'front');
|
|
10
|
+
export const monitor = {
|
|
11
|
+
name: 'monitor',
|
|
12
|
+
frames: 180,
|
|
13
|
+
// the chart is drawn back in by here
|
|
14
|
+
still: 150,
|
|
15
|
+
line: LINE,
|
|
16
|
+
extrude: [0, 0],
|
|
17
|
+
layers: [
|
|
18
|
+
{ id: 'mon', p: [250, 375], m: { ...hop, k: 0.6 }, shapes: [] },
|
|
19
|
+
{
|
|
20
|
+
parent: 'mon',
|
|
21
|
+
shapes: [
|
|
22
|
+
...solid(FOOT, { fill: 'deep', top: 'main' }, 4),
|
|
23
|
+
...solid(POST, { fill: 'deep', front: 'main' }, 2),
|
|
24
|
+
...solid(PANEL, { fill: 'deep', front: 'ink' }, 4),
|
|
25
|
+
{ d: quad(screen, 0.025, 0.04, 0.95, 0.92, 2), fill: 'tint' },
|
|
26
|
+
...[
|
|
27
|
+
[0.1, 0.3],
|
|
28
|
+
[0.22, 0.5],
|
|
29
|
+
[0.34, 0.38],
|
|
30
|
+
[0.46, 0.66],
|
|
31
|
+
].map(([s, h]) => ({ d: quad(screen, s, 0.14, 0.08, h, 2), fill: 'main' })),
|
|
32
|
+
...[0.76, 0.6].map((t, i) => ({
|
|
33
|
+
d: stroke(screen, [0.62, t], [i ? 0.8 : 0.9, t]),
|
|
34
|
+
trim: erase(30 - i * 5, 96 + i * 5),
|
|
35
|
+
})),
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
glow('mon', [178, -250], 22, [twinkle(44), twinkle(140, true)]),
|
|
39
|
+
],
|
|
40
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a monstera in a white pot in 2.5d (pot in 3d, see plant-kit.ts); the leaves sway.
|
|
2
|
+
import { sway, twinkle } from '../motions.js';
|
|
3
|
+
import { line } from '../sticker.js';
|
|
4
|
+
import { pot, spot } from './plant-kit.js';
|
|
5
|
+
import { glow, LINE } from './shared.js';
|
|
6
|
+
const [POT, SOIL] = pot(100, 50, 62, 'white');
|
|
7
|
+
const n = (v) => v.toFixed(1);
|
|
8
|
+
// a broad heart-shaped leaf from its stalk at o, with the split slits cut in from both edges
|
|
9
|
+
const big = (o, deg, len, w) => {
|
|
10
|
+
const p = (x, y) => spot(o, deg, [x, y]).map(n).join(' ');
|
|
11
|
+
const outline = `M${p(0, 0)}C${p(-w * 0.9, -len * 0.04)} ${p(-w * 1.05, -len * 0.86)} ${p(0, -len)}` +
|
|
12
|
+
`C${p(w * 1.05, -len * 0.86)} ${p(w * 0.9, -len * 0.04)} ${p(0, 0)}Z`;
|
|
13
|
+
const slits = [0.3, 0.52, 0.72].flatMap((t, i) => [-1, 1].map((s) => ({
|
|
14
|
+
d: line(spot(o, deg, [s * w * (0.74 - i * 0.04), -len * t]), spot(o, deg, [s * w * 0.3, -len * (t - 0.06)])),
|
|
15
|
+
})));
|
|
16
|
+
return [
|
|
17
|
+
{ d: outline, fill: 'ok', depth: 0.4 },
|
|
18
|
+
{ d: line(spot(o, deg, [0, -len * 0.06]), spot(o, deg, [0, -len * 0.86])) },
|
|
19
|
+
...slits,
|
|
20
|
+
];
|
|
21
|
+
};
|
|
22
|
+
const LEAVES = [
|
|
23
|
+
[[-4, -146], 4, 112, 60],
|
|
24
|
+
[[-62, -92], -40, 118, 66],
|
|
25
|
+
[[58, -104], 36, 124, 68],
|
|
26
|
+
];
|
|
27
|
+
export const monstera = {
|
|
28
|
+
name: 'monstera',
|
|
29
|
+
frames: 180,
|
|
30
|
+
line: LINE,
|
|
31
|
+
extrude: [5, 10],
|
|
32
|
+
layers: [
|
|
33
|
+
{ id: 'plant', p: [250, 390], shapes: [] },
|
|
34
|
+
{ parent: 'plant', shapes: POT },
|
|
35
|
+
...LEAVES.map(([[dx, dy], deg, len, w], i) => {
|
|
36
|
+
const base = [SOIL[0] + dx, SOIL[1] + dy];
|
|
37
|
+
return {
|
|
38
|
+
parent: 'plant',
|
|
39
|
+
a: SOIL,
|
|
40
|
+
p: SOIL,
|
|
41
|
+
m: { ...sway, at: i * 18, k: i === 1 ? -1 : 1 },
|
|
42
|
+
shapes: [{ d: line(SOIL, base), line: 7, round: true }, ...big(base, deg, len, w)],
|
|
43
|
+
};
|
|
44
|
+
}),
|
|
45
|
+
glow('plant', [140, -260], 22, [twinkle(46), twinkle(140, true)]),
|
|
46
|
+
],
|
|
47
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a crescent moon as a thick slab on the leaned face, little stars twinkling round it.
|
|
2
|
+
import { twinkle, twist } from '../motions.js';
|
|
3
|
+
import { poly, star } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
import { arcPts } from './sky-kit.js';
|
|
6
|
+
// the outer edge of a circle r 120 and the inner edge of r 100 set up and right, meeting at the horns
|
|
7
|
+
const R = 120;
|
|
8
|
+
const C = [52, -40];
|
|
9
|
+
const r = 100;
|
|
10
|
+
const deg = (p, o = [0, 0]) => (Math.atan2(p[1] - o[1], p[0] - o[0]) * 180) / Math.PI;
|
|
11
|
+
// where the two circles cross
|
|
12
|
+
const d = Math.hypot(C[0], C[1]);
|
|
13
|
+
const along = (d * d + R * R - r * r) / (2 * d);
|
|
14
|
+
const h = Math.sqrt(R * R - along * along);
|
|
15
|
+
const [ux, uy] = [C[0] / d, C[1] / d];
|
|
16
|
+
const P1 = [ux * along - uy * h, uy * along + ux * h];
|
|
17
|
+
const P2 = [ux * along + uy * h, uy * along - ux * h];
|
|
18
|
+
const sweep = (a, b, through) => {
|
|
19
|
+
// from a to b the way that passes through `through`
|
|
20
|
+
const norm = (x) => ((x % 360) + 360) % 360;
|
|
21
|
+
const cw = norm(b - a);
|
|
22
|
+
return norm(through - a) <= cw ? [a, a + cw] : [a, a - (360 - cw)];
|
|
23
|
+
};
|
|
24
|
+
const away = deg([-C[0], -C[1]]);
|
|
25
|
+
const [o0, o1] = sweep(deg(P1), deg(P2), away);
|
|
26
|
+
const [i0, i1] = sweep(deg(P2, C), deg(P1, C), away);
|
|
27
|
+
const CRESCENT = poly([...arcPts(0, 0, R, o0, o1, 60), ...arcPts(C[0], C[1], r, i0, i1, 60)]);
|
|
28
|
+
const STARS = [
|
|
29
|
+
[124, -100, 30, 20],
|
|
30
|
+
[156, 20, 22, 40],
|
|
31
|
+
[70, 100, 24, 60],
|
|
32
|
+
];
|
|
33
|
+
export const moon = {
|
|
34
|
+
name: 'moon',
|
|
35
|
+
frames: 180,
|
|
36
|
+
line: LINE,
|
|
37
|
+
extrude: EXT,
|
|
38
|
+
layers: [
|
|
39
|
+
{ id: 'moon', p: [240, 250], m: { ...twist, k: 0.6 }, shapes: [] },
|
|
40
|
+
{
|
|
41
|
+
id: 'face',
|
|
42
|
+
parent: 'moon',
|
|
43
|
+
tilt: FACE,
|
|
44
|
+
shapes: [{ d: CRESCENT, fill: 'gold', depth: 1.2, crease: false }],
|
|
45
|
+
},
|
|
46
|
+
...STARS.map(([x, y, s, at]) => ({
|
|
47
|
+
parent: 'face',
|
|
48
|
+
a: [x, y],
|
|
49
|
+
p: [x, y],
|
|
50
|
+
m: [twinkle(at), twinkle(120 + at / 2, true)],
|
|
51
|
+
shapes: [{ d: star(x, y, s, 0.5, 5, 2), fill: 'white', depth: 0.4 }],
|
|
52
|
+
})),
|
|
53
|
+
glow('moon', [-150, -130], 20, [twinkle(30), twinkle(130, true)]),
|
|
54
|
+
],
|
|
55
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a Thai motorbike taxi rider's vest, seen from the back with its number. No district text.
|
|
2
|
+
import { twinkle, wiggle } from '../motions.js';
|
|
3
|
+
import { line, poly, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
// a vest on a hanger: shoulder straps, armholes cut deep, a white number plate, a reflective band at the hem
|
|
6
|
+
const VEST = poly([
|
|
7
|
+
[-64, -150],
|
|
8
|
+
[-28, -150],
|
|
9
|
+
[0, -124],
|
|
10
|
+
[28, -150],
|
|
11
|
+
[64, -150],
|
|
12
|
+
[72, -96],
|
|
13
|
+
[112, -52],
|
|
14
|
+
[112, 150],
|
|
15
|
+
[-112, 150],
|
|
16
|
+
[-112, -52],
|
|
17
|
+
[-72, -96],
|
|
18
|
+
], [8, 8, 20, 8, 8, 30, 10, 12, 12, 10, 30]);
|
|
19
|
+
export const motorbikeTaxi = {
|
|
20
|
+
name: 'motorbike-taxi',
|
|
21
|
+
frames: 180,
|
|
22
|
+
line: LINE,
|
|
23
|
+
extrude: EXT,
|
|
24
|
+
layers: [
|
|
25
|
+
{ id: 'hang', a: [0, -150], p: [250, 110], m: { ...wiggle, k: 0.7 }, shapes: [] },
|
|
26
|
+
{
|
|
27
|
+
parent: 'hang',
|
|
28
|
+
tilt: FACE,
|
|
29
|
+
shapes: [
|
|
30
|
+
{ d: line([-80, -150], [0, -186], [80, -150]), line: 7 },
|
|
31
|
+
{ d: 'M0 -186q0 -24 18 -24q16 0 14 16', round: true },
|
|
32
|
+
{ d: VEST, fill: 'gold', depth: 0.6 },
|
|
33
|
+
{ d: rect(-112, 100, 224, 22), fill: 'white', depth: 0.1 },
|
|
34
|
+
{ d: rect(-60, -76, 120, 112, 14), fill: 'white', depth: 0.25 },
|
|
35
|
+
{ d: line([-44, -54], [-12, -54], [-12, -22], [-44, -22], [-44, 12], [-12, 12]), line: 8 },
|
|
36
|
+
{ d: line([44, -54], [12, -54], [12, -22], [44, -22], [44, 12], [12, 12]), line: 8 },
|
|
37
|
+
{ d: line([-40, 66], [40, 66]) },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
glow('hang', [150, -110], 24, [twinkle(40), twinkle(140, true)]),
|
|
41
|
+
],
|
|
42
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: two beamed notes as a thick slab on the leaned face; a third note floats up and pops.
|
|
2
|
+
import { float, hop, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, poly, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
// two heads, two stems and a beam, one outline
|
|
6
|
+
const head = (x, y) => ellipse(x, y, 40, 30);
|
|
7
|
+
export const musicNote = {
|
|
8
|
+
name: 'music-note',
|
|
9
|
+
frames: 180,
|
|
10
|
+
line: LINE,
|
|
11
|
+
extrude: EXT,
|
|
12
|
+
layers: [
|
|
13
|
+
{ id: 'notes', p: [240, 270], m: { ...hop, k: 0.7 }, shapes: [] },
|
|
14
|
+
{
|
|
15
|
+
parent: 'notes',
|
|
16
|
+
tilt: FACE,
|
|
17
|
+
shapes: [
|
|
18
|
+
{ d: rect(-74, -120, 24, 200, 4), fill: 'main', depth: 1 },
|
|
19
|
+
{ d: rect(76, -150, 24, 200, 4), fill: 'main', depth: 1 },
|
|
20
|
+
{
|
|
21
|
+
d: poly([
|
|
22
|
+
[-74, -120],
|
|
23
|
+
[100, -150],
|
|
24
|
+
[100, -100],
|
|
25
|
+
[-74, -70],
|
|
26
|
+
], 4),
|
|
27
|
+
fill: 'main',
|
|
28
|
+
depth: 1,
|
|
29
|
+
},
|
|
30
|
+
{ d: head(-90, 86), fill: 'main', depth: 1 },
|
|
31
|
+
{ d: head(60, 56), fill: 'main', depth: 1 },
|
|
32
|
+
{ d: ellipse(-102, 76, 10, 7), fill: 'white', line: false },
|
|
33
|
+
{ d: ellipse(48, 46, 10, 7), fill: 'white', line: false },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'little',
|
|
38
|
+
parent: 'notes',
|
|
39
|
+
p: [150, 60],
|
|
40
|
+
m: [{ ...float, k: -1.6 }, twinkle(20), twinkle(140, true)],
|
|
41
|
+
shapes: [],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
parent: 'little',
|
|
45
|
+
tilt: FACE,
|
|
46
|
+
shapes: [
|
|
47
|
+
{ d: rect(16, -70, 14, 90, 3), fill: 'gold', depth: 0.8 },
|
|
48
|
+
{
|
|
49
|
+
d: poly([
|
|
50
|
+
[16, -70],
|
|
51
|
+
[56, -54],
|
|
52
|
+
[56, -36],
|
|
53
|
+
[30, -46],
|
|
54
|
+
], 3),
|
|
55
|
+
fill: 'gold',
|
|
56
|
+
depth: 0.8,
|
|
57
|
+
},
|
|
58
|
+
{ d: ellipse(6, 22, 24, 18), fill: 'gold', depth: 0.8 },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
glow('notes', [-160, -180], 22, [twinkle(40), twinkle(140, true)]),
|
|
62
|
+
],
|
|
63
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a two-bay NAS in the UGREEN DXP2800 manner, modelled in 3d (see iso.ts). No logo.
|
|
2
|
+
import { hop, twinkle } from '../motions.js';
|
|
3
|
+
import { block, dot, faceOf, quad, solid, stroke } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// A silver box with a dark front: a strip of power key, lights and a port, two tall drive bays; the lights boot in turn
|
|
6
|
+
const W = 200;
|
|
7
|
+
const D = 240;
|
|
8
|
+
const H = 220;
|
|
9
|
+
const BOX = block([-W / 2, -D / 2, 0], [W, 0, 0], [0, D, 0], [0, 0, H]);
|
|
10
|
+
const PANEL = block([-W / 2 + 10, -D / 2 - 6, 10], [W - 20, 0, 0], [0, 6, 0], [0, 0, H - 20]);
|
|
11
|
+
const pf = faceOf(PANEL, 'front');
|
|
12
|
+
const ROUND = (W - 20) / (H - 20);
|
|
13
|
+
const bay = (s) => [
|
|
14
|
+
{ d: quad(pf, s, 0.07, 0.3, 0.86, 3), fill: 'grey' },
|
|
15
|
+
...[0.22, 0.3].map((t) => ({ d: stroke(pf, [s + 0.07, t], [s + 0.23, t]) })),
|
|
16
|
+
];
|
|
17
|
+
const LEDS = [0.66, 0.56, 0.46, 0.36];
|
|
18
|
+
export const nas2bay = {
|
|
19
|
+
name: 'nas-2bay',
|
|
20
|
+
frames: 180,
|
|
21
|
+
still: 100,
|
|
22
|
+
line: LINE,
|
|
23
|
+
extrude: [0, 0],
|
|
24
|
+
layers: [
|
|
25
|
+
{ id: 'nas', p: [250, 370], m: { ...hop, k: 0.4 }, shapes: [] },
|
|
26
|
+
{
|
|
27
|
+
parent: 'nas',
|
|
28
|
+
shapes: [
|
|
29
|
+
...solid(BOX, { fill: 'grey', top: 'white' }, 6),
|
|
30
|
+
...solid(PANEL, { fill: 'deep' }, 4),
|
|
31
|
+
{ d: dot(pf, 0.15, 0.84, 0.05, 0.05 * ROUND), fill: 'white' },
|
|
32
|
+
{ d: quad(pf, 0.11, 0.12, 0.08, 0.08, 2), fill: 'ink' },
|
|
33
|
+
...bay(0.3),
|
|
34
|
+
...bay(0.64),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
...LEDS.map((t, i) => {
|
|
38
|
+
const at = pf.at(0.15, t);
|
|
39
|
+
return {
|
|
40
|
+
parent: 'nas',
|
|
41
|
+
a: at,
|
|
42
|
+
p: at,
|
|
43
|
+
m: [twinkle(14 + i * 10), twinkle(120 + i * 6, true)],
|
|
44
|
+
shapes: [{ d: dot(pf, 0.15, t, 0.025, 0.025 * ROUND), fill: i === 0 ? 'ok' : 'main' }],
|
|
45
|
+
};
|
|
46
|
+
}),
|
|
47
|
+
glow('nas', [110, -290], 24, [twinkle(56), twinkle(140, true)]),
|
|
48
|
+
],
|
|
49
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers after the network diagrams of Protocol Explorer, modelled in 3d (see iso.ts).
|
|
2
|
+
import { slide, sway, twinkle } from '../motions.js';
|
|
3
|
+
import { block, dot, faceOf, ISO, solid, stroke } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// A small storage box: two drive trays standing proud of the front with handle grooves, a row of lights under them
|
|
6
|
+
const W = 210;
|
|
7
|
+
const D = 200;
|
|
8
|
+
const H = 230;
|
|
9
|
+
const BOX = block([-W / 2, -D / 2, 0], [W, 0, 0], [0, D, 0], [0, 0, H]);
|
|
10
|
+
const front = faceOf(BOX, 'front');
|
|
11
|
+
const tray = (x) => {
|
|
12
|
+
const b = block([x, -D / 2 - 8, 70], [80, 0, 0], [0, 8, 0], [0, 0, 142]);
|
|
13
|
+
const f = faceOf(b, 'front');
|
|
14
|
+
return [
|
|
15
|
+
...solid(b, { fill: 'grey', front: 'tint' }, 2),
|
|
16
|
+
...[0.78, 0.66, 0.54].map((t) => ({ d: stroke(f, [0.24, t], [0.76, t]) })),
|
|
17
|
+
];
|
|
18
|
+
};
|
|
19
|
+
export const nas = {
|
|
20
|
+
name: 'nas',
|
|
21
|
+
frames: 180,
|
|
22
|
+
line: LINE,
|
|
23
|
+
extrude: [0, 0],
|
|
24
|
+
layers: [
|
|
25
|
+
{ id: 'nas', p: [250, 370], m: { ...sway, k: 0.5 }, shapes: [] },
|
|
26
|
+
{
|
|
27
|
+
parent: 'nas',
|
|
28
|
+
shapes: [
|
|
29
|
+
...solid(BOX, { fill: 'deep', top: 'main' }, 3),
|
|
30
|
+
...tray(-W / 2 + 16),
|
|
31
|
+
...['ok', 'ok', 'gold'].map((fill, i) => ({
|
|
32
|
+
d: dot(front, 0.16 + i * 0.11, 0.14, 0.035, 0.035 * (W / H)),
|
|
33
|
+
fill,
|
|
34
|
+
})),
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
// the right drive slides out towards the viewer and is pushed home
|
|
38
|
+
{ parent: 'nas', m: slide(ISO([0, -22, 0]), 20, 40, 40), shapes: tray(W / 2 - 96) },
|
|
39
|
+
glow('nas', [118, -286], 24, [twinkle(52), twinkle(140, true)]),
|
|
40
|
+
],
|
|
41
|
+
};
|
|
@@ -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
|
+
};
|