@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,45 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a password field filling with dots, its padlock clasping shut.
|
|
2
|
+
import { clasp, jolt, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, pill, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, LINE } from './shared.js';
|
|
5
|
+
const XS = [-104, -70, -36, -2, 32];
|
|
6
|
+
const SHACKLE = 'M-150 -96L-150 -124A26 26 0 0 1 -98 -124L-98 -96L-110 -96L-110 -124A14 14 0 0 0 -138 -124L-138 -96Z';
|
|
7
|
+
export const password = {
|
|
8
|
+
name: 'password',
|
|
9
|
+
frames: 180,
|
|
10
|
+
line: LINE,
|
|
11
|
+
extrude: EXT,
|
|
12
|
+
still: 120,
|
|
13
|
+
layers: [
|
|
14
|
+
{ id: 'root', a: [0, 40], p: [250, 290], m: jolt([-3, 8]), shapes: [] },
|
|
15
|
+
{
|
|
16
|
+
id: 'field',
|
|
17
|
+
parent: 'root',
|
|
18
|
+
tilt: FACE,
|
|
19
|
+
shapes: [
|
|
20
|
+
{ d: pill(-150, -42, 300, 84), fill: 'white', depth: 1 },
|
|
21
|
+
{ d: ellipse(104, 0, 26, 16), fill: 'tint' },
|
|
22
|
+
{ d: ellipse(104, 0, 8), fill: 'ink', line: false },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
...XS.map((x, i) => ({
|
|
26
|
+
parent: 'field',
|
|
27
|
+
a: [x, 0],
|
|
28
|
+
p: [x, 0],
|
|
29
|
+
m: [twinkle(14 + i * 9), twinkle(150, true)],
|
|
30
|
+
shapes: [{ d: ellipse(x, 0, 11), fill: 'main', line: false }],
|
|
31
|
+
})),
|
|
32
|
+
{
|
|
33
|
+
id: 'lock',
|
|
34
|
+
parent: 'field',
|
|
35
|
+
a: [-124, -70],
|
|
36
|
+
p: [-124, -70],
|
|
37
|
+
m: { ...clasp, at: 50, k: 0.6 },
|
|
38
|
+
shapes: [
|
|
39
|
+
{ d: SHACKLE, fill: 'grey', depth: 0.5 },
|
|
40
|
+
{ d: rect(-162, -100, 76, 60, 12), fill: 'ok', depth: 0.8 },
|
|
41
|
+
{ d: ellipse(-124, -72, 8), fill: 'ink', line: false },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers, modelled in 3d (see iso.ts).
|
|
2
|
+
import { jolt, twinkle } from '../motions.js';
|
|
3
|
+
import { block, faceOf, quad, solid } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// A 1U patch panel: a row of jacks, a few patch cords plugged in and hanging forward
|
|
6
|
+
const H = 50;
|
|
7
|
+
const PANEL = block([-170, -40, 0], [340, 0, 0], [0, 80, 0], [0, 0, H]);
|
|
8
|
+
const front = faceOf(PANEL, 'front');
|
|
9
|
+
const JACKS = 10;
|
|
10
|
+
// a cord: a boot in the jack, then the cable dropping down towards the viewer
|
|
11
|
+
const cord = (i, fill) => {
|
|
12
|
+
const x = -170 + 340 * (0.06 + i * 0.09) + 6;
|
|
13
|
+
const boot = block([x, -66, 16], [20, 0, 0], [0, 26, 0], [0, 0, 18]);
|
|
14
|
+
const cable = block([x + 4, -76, -50], [12, 0, 0], [0, 12, 0], [0, 0, 74]);
|
|
15
|
+
return [...solid(cable, { fill }, 2), ...solid(boot, { fill, top: 'white' }, 2)];
|
|
16
|
+
};
|
|
17
|
+
export const patchPanel = {
|
|
18
|
+
name: 'patch-panel',
|
|
19
|
+
frames: 180,
|
|
20
|
+
line: LINE,
|
|
21
|
+
extrude: [0, 0],
|
|
22
|
+
layers: [
|
|
23
|
+
{ id: 'pp', p: [250, 280], m: jolt([-4, 8]), shapes: [] },
|
|
24
|
+
{
|
|
25
|
+
parent: 'pp',
|
|
26
|
+
shapes: [
|
|
27
|
+
...solid(PANEL, { fill: 'deep', top: 'grey', front: 'grey' }, 3),
|
|
28
|
+
...Array.from({ length: JACKS }, (_, i) => ({
|
|
29
|
+
d: quad(front, 0.06 + i * 0.09, 0.3, 0.06, 0.4, 1),
|
|
30
|
+
fill: 'ink',
|
|
31
|
+
line: false,
|
|
32
|
+
})),
|
|
33
|
+
...cord(1, 'main'),
|
|
34
|
+
...cord(3, 'gold'),
|
|
35
|
+
...cord(4, 'ok'),
|
|
36
|
+
...cord(7, 'hot'),
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
glow('pp', [190, -120], 22, [twinkle(44), twinkle(140, true)]),
|
|
40
|
+
],
|
|
41
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers, modelled in 3d (see iso.ts).
|
|
2
|
+
import { sway, twinkle } from '../motions.js';
|
|
3
|
+
import { block, dot, faceOf, ISO, quad, solid } from '../iso.js';
|
|
4
|
+
import { glow, LINE } from './shared.js';
|
|
5
|
+
// A rack power strip: a tall slim bar with a column of sockets, a status light and its cord curling away
|
|
6
|
+
const W = 70;
|
|
7
|
+
const D = 56;
|
|
8
|
+
const H = 300;
|
|
9
|
+
const BAR = block([-W / 2, -D / 2, 0], [W, 0, 0], [0, D, 0], [0, 0, H]);
|
|
10
|
+
const front = faceOf(BAR, 'front');
|
|
11
|
+
const K = W / H;
|
|
12
|
+
const socket = (i) => {
|
|
13
|
+
const t = 0.12 + i * 0.15;
|
|
14
|
+
return [
|
|
15
|
+
{ d: quad(front, 0.18, t, 0.64, 0.11, 3), fill: 'paper' },
|
|
16
|
+
{ d: dot(front, 0.38, t + 0.055, 0.06, 0.06 * K), fill: 'ink', line: false },
|
|
17
|
+
{ d: dot(front, 0.62, t + 0.055, 0.06, 0.06 * K), fill: 'ink', line: false },
|
|
18
|
+
];
|
|
19
|
+
};
|
|
20
|
+
const [cx, cy] = ISO([0, 0, 0]);
|
|
21
|
+
const CORD = `M${String(cx)} ${String(cy)}C${String(cx - 10)} ${String(cy + 40)} ${String(cx - 70)} ${String(cy + 40)} ${String(cx - 96)} ${String(cy + 18)}`;
|
|
22
|
+
export const pdu = {
|
|
23
|
+
name: 'pdu',
|
|
24
|
+
frames: 180,
|
|
25
|
+
line: LINE,
|
|
26
|
+
extrude: [0, 0],
|
|
27
|
+
layers: [
|
|
28
|
+
{ id: 'pdu', a: [0, 0], p: [262, 392], m: { ...sway, k: 0.6 }, shapes: [] },
|
|
29
|
+
{
|
|
30
|
+
parent: 'pdu',
|
|
31
|
+
shapes: [
|
|
32
|
+
{ d: CORD, round: true },
|
|
33
|
+
...solid(BAR, { fill: 'deep', top: 'main' }, 3),
|
|
34
|
+
...[0, 1, 2, 3, 4].flatMap(socket),
|
|
35
|
+
{ d: dot(front, 0.5, 0.91, 0.14, 0.14 * K), fill: 'ok' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
glow('pdu', [70, -300], 24, [twinkle(50), twinkle(140, true)]),
|
|
39
|
+
],
|
|
40
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: topping up a phone; a coin drops in and the signal bars fill. No operator mark.
|
|
2
|
+
import { fall, nudge, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, line, onFace, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
const TOP = onFace(FACE, [0, -160]);
|
|
6
|
+
const COIN = [TOP[0], TOP[1] - 62];
|
|
7
|
+
const BARS = [0, 1, 2, 3];
|
|
8
|
+
export const phoneTopup = {
|
|
9
|
+
name: 'phone-topup',
|
|
10
|
+
frames: 180,
|
|
11
|
+
still: 120,
|
|
12
|
+
line: LINE,
|
|
13
|
+
extrude: EXT,
|
|
14
|
+
layers: [
|
|
15
|
+
{ id: 'ph', a: [0, 160], p: [250, 410], m: { ...nudge, at: 50 }, shapes: [] },
|
|
16
|
+
{
|
|
17
|
+
parent: 'ph',
|
|
18
|
+
a: COIN,
|
|
19
|
+
p: COIN,
|
|
20
|
+
m: [twinkle(4), fall([0, 68], 28, 20)],
|
|
21
|
+
op: 50,
|
|
22
|
+
shapes: [
|
|
23
|
+
{ d: ellipse(COIN[0], COIN[1], 34), fill: 'gold', depth: 0.5 },
|
|
24
|
+
{ d: line([COIN[0] - 14, COIN[1]], [COIN[0] + 14, COIN[1]]), line: 7 },
|
|
25
|
+
{ d: line([COIN[0], COIN[1] - 14], [COIN[0], COIN[1] + 14]), line: 7 },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'face',
|
|
30
|
+
parent: 'ph',
|
|
31
|
+
tilt: FACE,
|
|
32
|
+
shapes: [
|
|
33
|
+
{ d: rect(-90, -160, 180, 320, 34), fill: 'deep', depth: 0.8 },
|
|
34
|
+
{ d: rect(-76, -146, 152, 292, 24), fill: 'tint' },
|
|
35
|
+
{ d: ellipse(0, -126, 7), fill: 'ink', line: false },
|
|
36
|
+
{ d: rect(-56, 70, 112, 44, 14), fill: 'white', depth: 0.3 },
|
|
37
|
+
{ d: line([-30, 92], [30, 92]) },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
...BARS.map((i) => {
|
|
41
|
+
const h = 34 + i * 26;
|
|
42
|
+
const c = [-48 + i * 32, 30 - h / 2];
|
|
43
|
+
return {
|
|
44
|
+
parent: 'face',
|
|
45
|
+
a: c,
|
|
46
|
+
p: c,
|
|
47
|
+
m: [twinkle(54 + i * 8), twinkle(140 + i * 3, true)],
|
|
48
|
+
shapes: [
|
|
49
|
+
{ d: rect(c[0] - 11, 30 - h, 22, h, 4), fill: i === 3 ? 'ok' : 'main', depth: 0.25 },
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}),
|
|
53
|
+
glow('ph', [130, -150], 24, [twinkle(82), twinkle(150, true)]),
|
|
54
|
+
],
|
|
55
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: an image file, hills under a sun that bounces up when it opens.
|
|
2
|
+
import { bounce, jolt, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, poly, rect } from '../sticker.js';
|
|
4
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
5
|
+
export const photo = {
|
|
6
|
+
name: 'photo',
|
|
7
|
+
frames: 180,
|
|
8
|
+
line: LINE,
|
|
9
|
+
extrude: EXT,
|
|
10
|
+
layers: [
|
|
11
|
+
{ id: 'root', a: [0, 110], p: [250, 330], m: jolt(), shapes: [] },
|
|
12
|
+
{
|
|
13
|
+
id: 'pic',
|
|
14
|
+
parent: 'root',
|
|
15
|
+
tilt: FACE,
|
|
16
|
+
shapes: [
|
|
17
|
+
{ d: rect(-160, -120, 320, 240, 18), fill: 'white', depth: 0.8 },
|
|
18
|
+
{ d: rect(-140, -100, 280, 200, 10), fill: 'tint' },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
parent: 'pic',
|
|
23
|
+
a: [60, -40],
|
|
24
|
+
p: [60, -40],
|
|
25
|
+
m: { ...bounce, at: 6 },
|
|
26
|
+
shapes: [{ d: ellipse(60, -40, 28), fill: 'gold' }],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
parent: 'pic',
|
|
30
|
+
shapes: [
|
|
31
|
+
{
|
|
32
|
+
d: poly([
|
|
33
|
+
[-140, 100],
|
|
34
|
+
[-140, 40],
|
|
35
|
+
[-70, -30],
|
|
36
|
+
[10, 50],
|
|
37
|
+
[50, 14],
|
|
38
|
+
[140, 90],
|
|
39
|
+
[140, 100],
|
|
40
|
+
], [10, 4, 10, 6, 10, 4, 10]),
|
|
41
|
+
fill: 'ok',
|
|
42
|
+
depth: 0.2,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
glow('root', [-190, -110], 22, [twinkle(40), twinkle(140, true)]),
|
|
47
|
+
],
|
|
48
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a jasmine phuang malai in 2.5d (see nature-iso.ts); it swings from its hook.
|
|
2
|
+
import { sway, twinkle } from '../motions.js';
|
|
3
|
+
import { ellipse, line, pill, rosette } from '../sticker.js';
|
|
4
|
+
import { ISO } from '../iso.js';
|
|
5
|
+
import { farness } from './nature-iso.js';
|
|
6
|
+
import { glow, LINE } from './shared.js';
|
|
7
|
+
// two strands of jasmine buds hang in a loop that leans into the page, tied at the bottom with a rose and a
|
|
8
|
+
// marigold; ribbons and bead strings hang below and swing a beat behind
|
|
9
|
+
const bead = (R, t) => [R * Math.sin(t), 0, R * Math.cos(t)];
|
|
10
|
+
const STRANDS = [
|
|
11
|
+
{ R: 78, n: 30, off: 0 },
|
|
12
|
+
{ R: 64, n: 24, off: 0.5 },
|
|
13
|
+
];
|
|
14
|
+
const BEADS = STRANDS.flatMap(({ R, n, off }) => Array.from({ length: n }, (_, i) => bead(R, ((i + off) / n) * Math.PI * 2)).filter((p) => p[2] > -R * 0.9)).sort((a, b) => farness(b) - farness(a));
|
|
15
|
+
const KNOT = ISO([0, 0, -74]);
|
|
16
|
+
const TASSELS = [
|
|
17
|
+
[-26, 120],
|
|
18
|
+
[-8, 150],
|
|
19
|
+
[10, 136],
|
|
20
|
+
[28, 112],
|
|
21
|
+
];
|
|
22
|
+
export const phuangMalai = {
|
|
23
|
+
name: 'phuang-malai',
|
|
24
|
+
frames: 180,
|
|
25
|
+
line: LINE,
|
|
26
|
+
extrude: [0, 0],
|
|
27
|
+
layers: [
|
|
28
|
+
{ id: 'malai', a: [0, -96], p: [250, 128], m: { ...sway, k: 1.2 }, shapes: [] },
|
|
29
|
+
{
|
|
30
|
+
parent: 'malai',
|
|
31
|
+
shapes: [
|
|
32
|
+
{ d: line([0, -120], [0, -78]), line: 5 },
|
|
33
|
+
{ d: ellipse(0, -126, 9), line: 5 },
|
|
34
|
+
...BEADS.map((b) => {
|
|
35
|
+
const [x, y] = ISO(b);
|
|
36
|
+
return { d: ellipse(x, y, 10, 11), fill: 'white', line: 4 };
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'tail',
|
|
42
|
+
parent: 'malai',
|
|
43
|
+
a: KNOT,
|
|
44
|
+
p: KNOT,
|
|
45
|
+
m: { ...sway, at: 8, k: 2 },
|
|
46
|
+
shapes: [
|
|
47
|
+
...TASSELS.map(([x, h], i) => ({
|
|
48
|
+
d: pill(KNOT[0] + x - 7, KNOT[1] + 10, 14, h),
|
|
49
|
+
fill: i % 2 ? 'gold' : 'hot',
|
|
50
|
+
})),
|
|
51
|
+
{ d: rosette(KNOT[0] - 20, KNOT[1] + 2, 26, 9, 0.6), fill: 'hot' },
|
|
52
|
+
{ d: rosette(KNOT[0] - 20, KNOT[1] + 2, 13, 6, 0.6), fill: 'hot' },
|
|
53
|
+
{ d: rosette(KNOT[0] + 24, KNOT[1] + 6, 20, 10, 0.7), fill: 'gold' },
|
|
54
|
+
{ d: ellipse(KNOT[0] + 24, KNOT[1] + 6, 6), fill: 'hot' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
glow('malai', [110, -60], 22, [twinkle(40), twinkle(140, true)]),
|
|
58
|
+
],
|
|
59
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a spending pie chart on the leaned face; the biggest-spend slice slides out.
|
|
2
|
+
import { slide, twinkle } from '../motions.js';
|
|
3
|
+
import { EXT, FACE, glow, LINE } from './shared.js';
|
|
4
|
+
const R = 130;
|
|
5
|
+
const DEG = Math.PI / 180;
|
|
6
|
+
const at = (a, r = R) => [Math.cos(a * DEG) * r, Math.sin(a * DEG) * r];
|
|
7
|
+
const n = (v) => +v.toFixed(2);
|
|
8
|
+
/** A wedge from `from` to `to` degrees, clockwise from 3 o'clock. */
|
|
9
|
+
const wedge = (from, to, fill) => {
|
|
10
|
+
const [a, b] = [at(from), at(to)];
|
|
11
|
+
const large = to - from > 180 ? 1 : 0;
|
|
12
|
+
return {
|
|
13
|
+
d: `M0 0L${n(a[0])} ${n(a[1])}A${R} ${R} 0 ${large} 1 ${n(b[0])} ${n(b[1])}Z`,
|
|
14
|
+
fill,
|
|
15
|
+
depth: 1,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const OUT = (-90 + -30) / 2;
|
|
19
|
+
export const pieChart = {
|
|
20
|
+
name: 'pie-chart',
|
|
21
|
+
frames: 180,
|
|
22
|
+
still: 100,
|
|
23
|
+
line: LINE,
|
|
24
|
+
extrude: EXT,
|
|
25
|
+
layers: [
|
|
26
|
+
{ id: 'pie', p: [240, 270], shapes: [] },
|
|
27
|
+
{
|
|
28
|
+
id: 'face',
|
|
29
|
+
parent: 'pie',
|
|
30
|
+
tilt: FACE,
|
|
31
|
+
shapes: [wedge(120, 210, 'tint'), wedge(210, 270, 'white'), wedge(-30, 120, 'main')],
|
|
32
|
+
},
|
|
33
|
+
{ parent: 'face', m: slide(at(OUT, 34), 16, 70, 44), shapes: [wedge(-90, -30, 'gold')] },
|
|
34
|
+
glow('pie', [160, -170], 24, [twinkle(56), twinkle(140, true)]),
|
|
35
|
+
],
|
|
36
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { fall, nudge, twinkle } from '../motions.js';
|
|
2
|
+
import { block, faceOf, ISO, quad, solid } from '../iso.js';
|
|
3
|
+
import { glow, LINE } from './shared.js';
|
|
4
|
+
import { drum, wire } from './volume.js';
|
|
5
|
+
// Voxel pig: a long body, separate square head, four short legs and a raised snout.
|
|
6
|
+
const PINK = '#efa4b5';
|
|
7
|
+
const LIGHT = '#ffd0d9';
|
|
8
|
+
const SHADE = '#ce7f95';
|
|
9
|
+
const voxel = (o, size, front = PINK, top = LIGHT, side = SHADE) => solid(block(o, [size[0], 0, 0], [0, size[1], 0], [0, 0, size[2]]), { fill: side, front, top }, 1);
|
|
10
|
+
const body = block([-62, -45, 53], [124, 0, 0], [0, 192, 0], [0, 0, 95]);
|
|
11
|
+
const head = faceOf(block([-58, -116, 74], [116, 0, 0], [0, 85, 0], [0, 0, 104]), 'front');
|
|
12
|
+
const snout = faceOf(block([-31, -139, 94], [62, 0, 0], [0, 23, 0], [0, 0, 37]), 'front');
|
|
13
|
+
const coin = ISO([0, 55, 240]);
|
|
14
|
+
export const piggyBank = {
|
|
15
|
+
name: 'piggy-bank',
|
|
16
|
+
frames: 180,
|
|
17
|
+
still: 120,
|
|
18
|
+
line: LINE,
|
|
19
|
+
extrude: [0, 0],
|
|
20
|
+
layers: [
|
|
21
|
+
{ id: 'pig', p: [235, 350], m: { ...nudge, at: 58 }, shapes: [] },
|
|
22
|
+
{
|
|
23
|
+
parent: 'pig',
|
|
24
|
+
shapes: [
|
|
25
|
+
wire([
|
|
26
|
+
[0, 147, 99],
|
|
27
|
+
[0, 167, 99],
|
|
28
|
+
[18, 167, 99],
|
|
29
|
+
[18, 167, 117],
|
|
30
|
+
], 7),
|
|
31
|
+
...[-53, 20].flatMap((x) => [-31, 102].flatMap((y) => [
|
|
32
|
+
...voxel([x, y, 0], [33, 34, 65]),
|
|
33
|
+
...voxel([x, y, 0], [33, 34, 15], '#bd778d', PINK, '#a66079'),
|
|
34
|
+
])),
|
|
35
|
+
...voxel([-62, -45, 53], [124, 192, 95]),
|
|
36
|
+
{ d: quad(faceOf(body, 'top'), 0.28, 0.47, 0.44, 0.055, 1), fill: 'ink', line: false },
|
|
37
|
+
...voxel([-58, -116, 74], [116, 85, 104]),
|
|
38
|
+
...[0.12, 0.72].flatMap((s) => [
|
|
39
|
+
{ d: quad(head, s, 0.62, 0.16, 0.17), fill: 'white', line: false },
|
|
40
|
+
{
|
|
41
|
+
d: quad(head, s + 0.055, 0.62, 0.09, 0.14),
|
|
42
|
+
fill: 'ink',
|
|
43
|
+
line: false,
|
|
44
|
+
},
|
|
45
|
+
]),
|
|
46
|
+
...voxel([-31, -139, 94], [62, 23, 37], '#f8b8c7', LIGHT, '#d989a2'),
|
|
47
|
+
...[0.17, 0.65].map((s) => ({
|
|
48
|
+
d: quad(snout, s, 0.3, 0.18, 0.42),
|
|
49
|
+
fill: '#a45573',
|
|
50
|
+
line: false,
|
|
51
|
+
})),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
parent: 'pig',
|
|
56
|
+
a: coin,
|
|
57
|
+
p: coin,
|
|
58
|
+
m: [twinkle(4), fall([0, 78], 34, 22)],
|
|
59
|
+
op: 58,
|
|
60
|
+
shapes: drum([0, 55, 240], 23, 23, 9, 'gold', 'main'),
|
|
61
|
+
},
|
|
62
|
+
glow('pig', [150, -170], 22, [twinkle(60), twinkle(140, true)]),
|
|
63
|
+
],
|
|
64
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Shape, Swatch, Vec } from '../sticker.js';
|
|
2
|
+
import type { V3 } from '../iso.js';
|
|
3
|
+
/**
|
|
4
|
+
* A round rod from a (radius ra) to b (radius rb): a pot, a trunk, a log. Its outline, then whichever end turns to
|
|
5
|
+
* the viewer, in `cap` (the body's fill when left out).
|
|
6
|
+
*/
|
|
7
|
+
export declare function rod(a: V3, b: V3, ra: number, rb: number, fill: Swatch, cap?: Swatch): Shape[];
|
|
8
|
+
/** A square ground tile, top at z 0, `half` from the centre to each side. */
|
|
9
|
+
export declare const tile: (half: number, top: Swatch, side: Swatch, thick?: number) => Shape[];
|
|
10
|
+
/** A pointed leaf from its stalk at o, `len` long and `w` wide, turned deg from straight up (clockwise). */
|
|
11
|
+
export declare const leaf: (o: Vec, deg: number, len: number, w: number) => string;
|
|
12
|
+
/** The leaf's midrib, an open line for the outline pass. */
|
|
13
|
+
export declare const rib: (o: Vec, deg: number, len: number) => string;
|
|
14
|
+
/** A point on a turned local frame, for parts that ride a leaf (slits, a flower on a stem). */
|
|
15
|
+
export declare const spot: (o: Vec, deg: number, p: Vec) => Vec;
|
|
16
|
+
/** A long drooping frond: a tapered blade bent along a curve, from o turned deg, droop pulling the tip down. */
|
|
17
|
+
export declare function frond(o: Vec, deg: number, len: number, w: number, droop: number): string;
|
|
18
|
+
/** The frond's spine, open. */
|
|
19
|
+
export declare const spine: (o: Vec, deg: number, len: number, droop: number) => string;
|
|
20
|
+
/** A tuft of grass at p: three blades, open. */
|
|
21
|
+
export declare const tuft: ([x, y]: Vec) => string;
|
|
22
|
+
/** A pot: a tapered body, a rim and the soil in it. Returns its shapes and the soil's centre on screen. */
|
|
23
|
+
export declare function pot(h: number, r0: number, r1: number, fill: Swatch, soil?: Swatch): [Shape[], Vec];
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Helpers for the plant and camping stickers (not a sticker): round parts in true 3d (pots, trunks, logs), the
|
|
2
|
+
// square ground tile they stand on, and leaf outlines as raw paths for slabs.
|
|
3
|
+
import { poly } from '../sticker.js';
|
|
4
|
+
import { add, block, ISO, mul, solid } from '../iso.js';
|
|
5
|
+
const cross = (a, b) => [
|
|
6
|
+
a[1] * b[2] - a[2] * b[1],
|
|
7
|
+
a[2] * b[0] - a[0] * b[2],
|
|
8
|
+
a[0] * b[1] - a[1] * b[0],
|
|
9
|
+
];
|
|
10
|
+
const unit = (a) => mul(a, 1 / (Math.hypot(...a) || 1));
|
|
11
|
+
const area = (pts) => pts.reduce((s, p, i) => {
|
|
12
|
+
const q = pts[(i + 1) % pts.length] ?? p;
|
|
13
|
+
return s + p[0] * q[1] - q[0] * p[1];
|
|
14
|
+
}, 0);
|
|
15
|
+
// convex hull, monotone chain: the outline of a round part seen from any side
|
|
16
|
+
function hull(points) {
|
|
17
|
+
const pts = [...points].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
|
18
|
+
const turn = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
19
|
+
const half = (list) => {
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const p of list) {
|
|
22
|
+
while (out.length >= 2 && turn(out[out.length - 2] ?? p, out[out.length - 1] ?? p, p) <= 0)
|
|
23
|
+
out.pop();
|
|
24
|
+
out.push(p);
|
|
25
|
+
}
|
|
26
|
+
out.pop();
|
|
27
|
+
return out;
|
|
28
|
+
};
|
|
29
|
+
return [...half(pts), ...half([...pts].reverse())];
|
|
30
|
+
}
|
|
31
|
+
/** A circle of radius r about c, in the plane whose outward normal is n, projected; wound like a block face. */
|
|
32
|
+
function ring(c, n, r, count = 28) {
|
|
33
|
+
const nn = unit(n);
|
|
34
|
+
const w = Math.abs(nn[2]) < 0.9 ? [0, 0, 1] : [1, 0, 0];
|
|
35
|
+
const u = unit(cross(w, nn));
|
|
36
|
+
const v = cross(nn, u);
|
|
37
|
+
return Array.from({ length: count }, (_, i) => {
|
|
38
|
+
const t = (i / count) * Math.PI * 2;
|
|
39
|
+
return ISO(add(c, add(mul(u, Math.cos(t) * r), mul(v, Math.sin(t) * r))));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A round rod from a (radius ra) to b (radius rb): a pot, a trunk, a log. Its outline, then whichever end turns to
|
|
44
|
+
* the viewer, in `cap` (the body's fill when left out).
|
|
45
|
+
*/
|
|
46
|
+
export function rod(a, b, ra, rb, fill, cap = fill) {
|
|
47
|
+
const d = add(b, mul(a, -1));
|
|
48
|
+
const [top, bottom] = [ring(b, d, rb), ring(a, mul(d, -1), ra)];
|
|
49
|
+
const out = [{ d: poly(hull([...top, ...bottom])), fill }];
|
|
50
|
+
for (const e of [top, bottom])
|
|
51
|
+
if (area(e) < 0)
|
|
52
|
+
out.push({ d: poly(e), fill: cap });
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/** A square ground tile, top at z 0, `half` from the centre to each side. */
|
|
56
|
+
export const tile = (half, top, side, thick = 26) => solid(block([-half, -half, -thick], [half * 2, 0, 0], [0, half * 2, 0], [0, 0, thick]), { fill: side, top }, 6);
|
|
57
|
+
const n = (v) => v.toFixed(1);
|
|
58
|
+
const rot = ([x, y], deg) => {
|
|
59
|
+
const a = (deg * Math.PI) / 180;
|
|
60
|
+
return [x * Math.cos(a) - y * Math.sin(a), x * Math.sin(a) + y * Math.cos(a)];
|
|
61
|
+
};
|
|
62
|
+
const place = (o, deg, p) => {
|
|
63
|
+
const [x, y] = rot(p, deg);
|
|
64
|
+
return `${n(o[0] + x)} ${n(o[1] + y)}`;
|
|
65
|
+
};
|
|
66
|
+
/** A pointed leaf from its stalk at o, `len` long and `w` wide, turned deg from straight up (clockwise). */
|
|
67
|
+
export const leaf = (o, deg, len, w) => `M${place(o, deg, [0, 0])}C${place(o, deg, [w, -len * 0.2])} ${place(o, deg, [w * 0.8, -len * 0.75])} ` +
|
|
68
|
+
`${place(o, deg, [0, -len])}C${place(o, deg, [-w * 0.8, -len * 0.75])} ${place(o, deg, [-w, -len * 0.2])} ` +
|
|
69
|
+
`${place(o, deg, [0, 0])}Z`;
|
|
70
|
+
/** The leaf's midrib, an open line for the outline pass. */
|
|
71
|
+
export const rib = (o, deg, len) => `M${place(o, deg, [0, -len * 0.08])}L${place(o, deg, [0, -len * 0.8])}`;
|
|
72
|
+
/** A point on a turned local frame, for parts that ride a leaf (slits, a flower on a stem). */
|
|
73
|
+
export const spot = (o, deg, p) => {
|
|
74
|
+
const [x, y] = rot(p, deg);
|
|
75
|
+
return [o[0] + x, o[1] + y];
|
|
76
|
+
};
|
|
77
|
+
/** A long drooping frond: a tapered blade bent along a curve, from o turned deg, droop pulling the tip down. */
|
|
78
|
+
export function frond(o, deg, len, w, droop) {
|
|
79
|
+
const mid = (t) => {
|
|
80
|
+
const [x, y] = spot(o, deg, [len * t, 0]);
|
|
81
|
+
return [x, y + droop * t * t];
|
|
82
|
+
};
|
|
83
|
+
const side = (t, s) => {
|
|
84
|
+
const [x, y] = mid(t);
|
|
85
|
+
const [x2, y2] = mid(Math.min(1, t + 0.02));
|
|
86
|
+
const l = Math.hypot(x2 - x, y2 - y) || 1;
|
|
87
|
+
const k = Math.sin(Math.PI * Math.min(1, t * 1.15)) * w * s;
|
|
88
|
+
return [x - ((y2 - y) / l) * k, y + ((x2 - x) / l) * k];
|
|
89
|
+
};
|
|
90
|
+
const ts = Array.from({ length: 13 }, (_, i) => i / 12);
|
|
91
|
+
const back = ts.slice(1, -1).reverse();
|
|
92
|
+
return poly([...ts.map((t) => side(t, 1)), ...back.map((t) => side(t, -1))]);
|
|
93
|
+
}
|
|
94
|
+
/** The frond's spine, open. */
|
|
95
|
+
export const spine = (o, deg, len, droop) => Array.from({ length: 11 }, (_, i) => {
|
|
96
|
+
const t = (i / 10) * 0.92;
|
|
97
|
+
const [x, y] = spot(o, deg, [len * t, 0]);
|
|
98
|
+
return `${i ? 'L' : 'M'}${n(x)} ${n(y + droop * t * t)}`;
|
|
99
|
+
}).join('');
|
|
100
|
+
/** A tuft of grass at p: three blades, open. */
|
|
101
|
+
export const tuft = ([x, y]) => `M${n(x - 9)} ${n(y)}L${n(x - 5)} ${n(y - 12)}L${n(x - 1)} ${n(y)}L${n(x + 3)} ${n(y - 15)}L${n(x + 7)} ${n(y)}`;
|
|
102
|
+
/** A pot: a tapered body, a rim and the soil in it. Returns its shapes and the soil's centre on screen. */
|
|
103
|
+
export function pot(h, r0, r1, fill, soil = 'deep') {
|
|
104
|
+
const lip = h * 0.22;
|
|
105
|
+
return [
|
|
106
|
+
[
|
|
107
|
+
...rod([0, 0, 0], [0, 0, h - lip], r0, r1, fill),
|
|
108
|
+
...rod([0, 0, h - lip], [0, 0, h], r1 + 6, r1 + 6, fill, soil),
|
|
109
|
+
],
|
|
110
|
+
ISO([0, 0, h]),
|
|
111
|
+
];
|
|
112
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Drawn for @20baht/stickers: a stack of red plastic stools, modelled in 3d (see street-kit.ts).
|
|
2
|
+
import { hop, twinkle } from '../motions.js';
|
|
3
|
+
import { poly } from '../sticker.js';
|
|
4
|
+
import { ISO } from '../iso.js';
|
|
5
|
+
import { face, lerp4 } from './street-kit.js';
|
|
6
|
+
import { glow, LINE } from './shared.js';
|
|
7
|
+
// Three stools nested in a stack: square seats with a hand slot, splayed sides with arched openings; the top one hops
|
|
8
|
+
const [TOP, BOT, H, STEP] = [70, 90, 150, 58];
|
|
9
|
+
const SIGNS = [
|
|
10
|
+
[-1, -1],
|
|
11
|
+
[1, -1],
|
|
12
|
+
[1, 1],
|
|
13
|
+
[-1, 1],
|
|
14
|
+
];
|
|
15
|
+
const corner = (r, z, i) => {
|
|
16
|
+
const [sx, sy] = SIGNS[i % 4] ?? SIGNS[0];
|
|
17
|
+
return [sx * r, sy * r, z];
|
|
18
|
+
};
|
|
19
|
+
const corners = (r, z) => [0, 1, 2, 3].map((i) => corner(r, z, i));
|
|
20
|
+
const visible = (q, z0) => face(q, 'hot', [0, 0, z0 + H / 2]).length > 0;
|
|
21
|
+
const arch = (q) => {
|
|
22
|
+
const pts = [ISO(lerp4(q, 0.24, 0)), ISO(lerp4(q, 0.24, 0.34))];
|
|
23
|
+
for (let i = 1; i < 10; i++) {
|
|
24
|
+
const a = Math.PI - (i / 10) * Math.PI;
|
|
25
|
+
pts.push(ISO(lerp4(q, 0.5 + Math.cos(a) * 0.26, 0.34 + Math.sin(a) * 0.24)));
|
|
26
|
+
}
|
|
27
|
+
pts.push(ISO(lerp4(q, 0.76, 0.34)), ISO(lerp4(q, 0.76, 0)));
|
|
28
|
+
return poly(pts, 2);
|
|
29
|
+
};
|
|
30
|
+
const stool = (z0) => {
|
|
31
|
+
const sides = [0, 1, 2, 3].map((i) => [
|
|
32
|
+
corner(BOT, z0, i),
|
|
33
|
+
corner(BOT, z0, i + 1),
|
|
34
|
+
corner(TOP, z0 + H, i + 1),
|
|
35
|
+
corner(TOP, z0 + H, i),
|
|
36
|
+
]);
|
|
37
|
+
const IN = [0, 0, z0 + H / 2];
|
|
38
|
+
const seat = corners(TOP, z0 + H);
|
|
39
|
+
return [
|
|
40
|
+
...sides
|
|
41
|
+
.filter((q) => visible(q, z0))
|
|
42
|
+
.flatMap((q) => [...face(q, 'hot', IN, 3), { d: arch(q), fill: 'deep' }]),
|
|
43
|
+
...face(seat, 'hot', IN, 6),
|
|
44
|
+
{
|
|
45
|
+
d: poly([
|
|
46
|
+
ISO([-28, -8, z0 + H]),
|
|
47
|
+
ISO([28, -8, z0 + H]),
|
|
48
|
+
ISO([28, 8, z0 + H]),
|
|
49
|
+
ISO([-28, 8, z0 + H]),
|
|
50
|
+
], 4),
|
|
51
|
+
fill: 'deep',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
};
|
|
55
|
+
const foot = ISO([0, 0, 2 * STEP]);
|
|
56
|
+
export const plasticStool = {
|
|
57
|
+
name: 'plastic-stool',
|
|
58
|
+
frames: 160,
|
|
59
|
+
line: LINE,
|
|
60
|
+
extrude: [0, 0],
|
|
61
|
+
layers: [
|
|
62
|
+
{ id: 'stack', p: [250, 405], shapes: [] },
|
|
63
|
+
{ parent: 'stack', shapes: [...stool(0), ...stool(STEP)] },
|
|
64
|
+
{ parent: 'stack', a: foot, p: foot, m: { ...hop, k: 2.2 }, shapes: stool(2 * STEP) },
|
|
65
|
+
glow('stack', [140, -250], 24, [twinkle(36), twinkle(130, true)]),
|
|
66
|
+
],
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const arrow: (x: number, y: number, k?: number) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The mouse pointer the remote-control stickers share: tip at (x, y), k times its 44 unit height.
|
|
2
|
+
import { poly } from '../sticker.js';
|
|
3
|
+
const ARROW = [
|
|
4
|
+
[0, 0],
|
|
5
|
+
[0, 44],
|
|
6
|
+
[11, 34],
|
|
7
|
+
[19, 50],
|
|
8
|
+
[27, 46],
|
|
9
|
+
[19, 31],
|
|
10
|
+
[33, 31],
|
|
11
|
+
];
|
|
12
|
+
export const arrow = (x, y, k = 1) => poly(ARROW.map(([ax, ay]) => [x + ax * k, y + ay * k]), 3 * k);
|