morphico 0.5.0 → 0.6.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/README.md +99 -32
- package/dist/esm/all.js +1 -1
- package/dist/esm/clip.js +8 -6
- package/dist/esm/engine.js +1 -1
- package/dist/esm/face.js +2 -3
- package/dist/esm/geometry.js +1 -1
- package/dist/esm/icon.js +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/morph.js +2 -2
- package/dist/esm/roundness.js +1 -1
- package/dist/esm/sets/battery.js +1 -1
- package/dist/esm/sets/bell.js +1 -1
- package/dist/esm/sets/characters.js +42 -21
- package/dist/esm/sets/check-mark.js +1 -1
- package/dist/esm/sets/checkbox.js +1 -1
- package/dist/esm/sets/chevron.js +1 -1
- package/dist/esm/sets/condensed.js +4 -3
- package/dist/esm/sets/copy.js +1 -1
- package/dist/esm/sets/eye.js +1 -1
- package/dist/esm/sets/faces.js +1 -1
- package/dist/esm/sets/folder.js +1 -1
- package/dist/esm/sets/handwritten.js +4 -3
- package/dist/esm/sets/lock.js +1 -1
- package/dist/esm/sets/lucide.js +1 -1
- package/dist/esm/sets/media.js +1 -1
- package/dist/esm/sets/menu.js +1 -1
- package/dist/esm/sets/mic.js +1 -1
- package/dist/esm/sets/radio.js +1 -1
- package/dist/esm/sets/round.js +4 -3
- package/dist/esm/sets/shapes.js +7 -1
- package/dist/esm/sets/slim.js +4 -3
- package/dist/esm/sets/square.js +4 -3
- package/dist/esm/sets/symbols.js +154 -0
- package/dist/esm/sets/theme.js +1 -1
- package/dist/esm/sets/toggle.js +1 -1
- package/dist/esm/sets/volume.js +1 -1
- package/dist/esm/sets/weather.js +1 -1
- package/dist/esm/sets/wifi.js +1 -1
- package/dist/esm/svg.js +1 -1
- package/dist/esm/text.js +6 -5
- package/dist/esm/types.js +1 -1
- package/dist/morphico.js +236 -46
- package/dist/types/clip.d.ts +5 -8
- package/dist/types/icon.d.ts +2 -2
- package/dist/types/index.d.ts +4 -3
- package/dist/types/morph.d.ts +3 -3
- package/dist/types/sets/characters.d.ts +3 -2
- package/dist/types/sets/shapes.d.ts +4 -1
- package/dist/types/sets/symbols.d.ts +38 -0
- package/dist/types/text.d.ts +3 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,39 +1,100 @@
|
|
|
1
1
|
# morphico
|
|
2
2
|
|
|
3
|
-
Morphing
|
|
3
|
+
Morphing SVG for the web: icons, digits, cut-outs and faces that smoothly change from one state to another — play
|
|
4
|
+
turns into pause, 4 turns into 5, a star-shaped photo turns into a heart, a smile turns into a frown. Small, no
|
|
5
|
+
dependencies, works in any framework or none.
|
|
4
6
|
|
|
5
|
-
> **Status:**
|
|
7
|
+
> **Status:** 0.x — the API may still change before 1.0.
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
Save this as an `.html` file and open it — no install, no build:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<!doctype html>
|
|
15
|
+
<button id="player" style="font-size: 48px; border: 0; background: none; color: #333; cursor: pointer"></button>
|
|
16
|
+
|
|
17
|
+
<script src="https://cdn.jsdelivr.net/npm/morphico"></script>
|
|
18
|
+
<script>
|
|
19
|
+
const { icon, iconSets } = morphico;
|
|
20
|
+
|
|
21
|
+
const button = document.querySelector('#player');
|
|
22
|
+
const player = icon(button, 'play', { set: iconSets.media }); // draw a "play" icon into the button
|
|
23
|
+
|
|
24
|
+
let playing = false;
|
|
25
|
+
button.addEventListener('click', () => {
|
|
26
|
+
playing = !playing;
|
|
27
|
+
player.to(playing ? 'pause' : 'play'); // morph to the other icon
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The icon is `1em` big and takes the CSS `color`, like text. (For a real site, pin a version in the URL:
|
|
33
|
+
`https://cdn.jsdelivr.net/npm/morphico@<version>`.)
|
|
34
|
+
|
|
35
|
+
With a bundler (Vite, webpack, esbuild …), install it and import what you use:
|
|
8
36
|
|
|
9
37
|
```sh
|
|
10
38
|
npm install morphico
|
|
11
39
|
```
|
|
12
40
|
|
|
13
41
|
```ts
|
|
14
|
-
import { icon
|
|
15
|
-
import {
|
|
16
|
-
|
|
42
|
+
import { icon } from 'morphico';
|
|
43
|
+
import { iconsMedia } from 'morphico/sets/media'; // every set is its own import
|
|
44
|
+
|
|
45
|
+
const player = icon(document.querySelector('#player'), 'play', { set: iconsMedia });
|
|
46
|
+
player.to('pause');
|
|
17
47
|
```
|
|
18
48
|
|
|
19
|
-
|
|
20
|
-
page uses — e.g. `icon()` with one icon set is about 13–21 KB gzipped, everything about 63 KB. `clip()` and `face()`
|
|
21
|
-
bring their own shapes / expressions. To pick sets by name at run time, `import { iconSets } from 'morphico/all'`
|
|
22
|
-
(`iconSets.weather` …; this imports every set).
|
|
49
|
+
## The four parts
|
|
23
50
|
|
|
24
|
-
|
|
25
|
-
`
|
|
51
|
+
All four work the same way: **create** with `(element, what to show first, options)`, **change** with `to()`,
|
|
52
|
+
**remove** with `destroy()`. `to()` returns a promise that resolves when the morph ends.
|
|
26
53
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
54
|
+
| | Create | Change |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| [**icon**](#one-icon-iconelement-init-options) — one icon or digit | `icon(el, 'play', { set: iconsMedia })` | `.to('pause')` |
|
|
57
|
+
| [**text**](#a-line-of-characters-textelement-init-options) — a line of digits, e.g. a clock | `text(el, '04:59', { set: digitsRound })` | `.to('05:00')` |
|
|
58
|
+
| [**clip**](#a-cut-out-clipelement-init-options) — any element cut out by a shape | `clip(el, 'star')` | `.to('heart')` |
|
|
59
|
+
| [**face**](#a-face-faceelement-init-options) — a face with feelings | `face(el, 'normal')` | `.to('smiling')`, `.blink()` |
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
await clock.to('05:00'); // wait for the morph to end
|
|
63
|
+
clock.to('05:01', { duration: 600 }); // options for one change
|
|
64
|
+
clock.destroy(); // remove it (e.g. when a component unmounts)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### In React
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { useEffect, useRef } from 'react';
|
|
71
|
+
import { icon, type Icon } from 'morphico';
|
|
72
|
+
import { iconsMedia } from 'morphico/sets/media';
|
|
73
|
+
|
|
74
|
+
export function PlayIcon({ playing }: { playing: boolean }) {
|
|
75
|
+
const element = useRef<HTMLSpanElement>(null);
|
|
76
|
+
const player = useRef<Icon | null>(null);
|
|
77
|
+
|
|
78
|
+
useEffect(() => { // create once, remove on unmount
|
|
79
|
+
player.current = icon(element.current!, playing ? 'pause' : 'play', { set: iconsMedia });
|
|
80
|
+
return () => player.current?.destroy();
|
|
81
|
+
}, []);
|
|
82
|
+
|
|
83
|
+
useEffect(() => { player.current?.to(playing ? 'pause' : 'play'); }, [playing]); // morph on change
|
|
84
|
+
|
|
85
|
+
return <span ref={element} />;
|
|
86
|
+
}
|
|
33
87
|
```
|
|
34
88
|
|
|
35
|
-
|
|
36
|
-
|
|
89
|
+
## Install details
|
|
90
|
+
|
|
91
|
+
Every set is a separate file, so a bundler only ships the sets and functions a page uses — e.g. `icon()` with one
|
|
92
|
+
icon set is about 13–21 KB gzipped, everything about 63 KB. `clip()` and `face()` bring their own shapes /
|
|
93
|
+
expressions. To pick sets by name at run time, `import { iconSets } from 'morphico/all'` (`iconSets.weather` …; this
|
|
94
|
+
imports every set).
|
|
95
|
+
|
|
96
|
+
The classic script from the CDN (`https://cdn.jsdelivr.net/npm/morphico`) is one file with everything: the global
|
|
97
|
+
`morphico` has `icon`, `text`, `clip`, `face` and the sets by name in `morphico.iconSets`.
|
|
37
98
|
|
|
38
99
|
## One icon: `icon(element, init, options)`
|
|
39
100
|
|
|
@@ -49,8 +110,8 @@ digit.destroy(); // stops and removes it (e.g. when
|
|
|
49
110
|
```
|
|
50
111
|
|
|
51
112
|
Digit sets: `digitsRound` (`morphico/sets/round`), `digitsSquare` (`/square`), `digitsCondensed` (`/condensed`),
|
|
52
|
-
`digitsSlim` (`/slim`), `digitsHandwritten` (`/handwritten`). Their states: `'0'`…`'9'`, `'-'` `'/'` `'.'` `','` `':'`,
|
|
53
|
-
out of it and fade). A digit morphing into `-` `/` `.` `,` is pressed flat onto it; into `:` it splits into the two dots.
|
|
113
|
+
`digitsSlim` (`/slim`), `digitsHandwritten` (`/handwritten`). Their states: `'0'`…`'9'`, `'-'` `'/'` `'.'` `','` `':'`, the symbols `'+'` `'%'` `'$'` `'€'` `'£'` (drawn in each
|
|
114
|
+
set's own style), and `' '` (empty: nothing drawn, shapes grow out of it and fade). A digit morphing into `-` `/` `.` `,` is pressed flat onto it; into `:` it splits into the two dots.
|
|
54
115
|
|
|
55
116
|
Icon sets (based on [Lucide](https://lucide.dev)):
|
|
56
117
|
|
|
@@ -91,11 +152,14 @@ const clock = text(document.querySelector('#clock'), '04:59', { set: digitsRound
|
|
|
91
152
|
|
|
92
153
|
await clock.to('05:00'); // only the digits that changed morph
|
|
93
154
|
clock.destroy();
|
|
155
|
+
|
|
156
|
+
const price = text(document.querySelector('#price'), '€49.99', { set: digitsRound });
|
|
157
|
+
price.to('€39.99'); // a promotion: 4 → 3 morphs, the rest stays
|
|
94
158
|
```
|
|
95
159
|
|
|
96
|
-
- Supported characters: digits `0`–`9`, space, `-` `:` `.` `,`
|
|
97
|
-
**Any other character is removed** (with the regex `/[^0-9
|
|
98
|
-
- Cells: digits, space and
|
|
160
|
+
- Supported characters: digits `0`–`9`, space, `-` `:` `.` `,` `/`, and `+` `%` `$` `€` `£` (prices and discounts:
|
|
161
|
+
`€39.99`, `-20%`) — all of them morph. **Any other character is removed** (with the regex `/[^0-9 :.,\/+%$€£-]/g`): `'12:09 AM'` shows `12:09 `.
|
|
162
|
+
- Cells: digits, space, `-` and the symbols have one width, `:` `.` `,` half of it, `/` 0.7 of it. A change morphs when the length
|
|
99
163
|
and every cell's width stay the same (`5` ↔ `-`, `.` ↔ `,`); otherwise the line is rebuilt without animation
|
|
100
164
|
(`5` ↔ `:`). Pad counters with spaces to keep them morphing: `counter.to(String(count).padStart(3, ' '))`.
|
|
101
165
|
- Digits sit on the text baseline, and every cell has the same width, so clocks don't jiggle.
|
|
@@ -119,17 +183,18 @@ photo.destroy(); // the element is whol
|
|
|
119
183
|
Shapes (based on [Lucide](https://lucide.dev)): `circle`, `ellipse`, `heart`, `sparkle`, `astroid`, `bookmark`,
|
|
120
184
|
`shield`, `moon`, `tag`, `square`, `badge`, `triangle`, `droplet`, `pentagon`, `hexagon`, `octagon`, `squircle`,
|
|
121
185
|
`star`, `rectangle-horizontal`, `message-circle`, `message-square`, `cloud`, `puzzle`, `club`. A diamond is the `square`
|
|
122
|
-
turned 45°, a portrait rectangle `rectangle-horizontal` turned 90° (`rotation`).
|
|
186
|
+
turned 45°, a portrait rectangle `rectangle-horizontal` turned 90° (`rotation`). The names are also exported as
|
|
187
|
+
`clipShapeNames` (type `ClipShape`: editors suggest them and TypeScript catches typos).
|
|
123
188
|
|
|
124
189
|
| Option | Default | |
|
|
125
190
|
| --- | --- | --- |
|
|
126
191
|
| `x`, `y` | `50` | The shape's **centre**. A number is %, or a string `'40%'` / `'120px'` (% of the element's width for `x`, height for `y`) |
|
|
127
|
-
| `size` |
|
|
192
|
+
| `size` | 70 % | The side of the shape's square (% of the element's width, or px). The shape keeps its own proportions inside that square. Default: 70 % of the element's shorter side, so the shape sits in the middle with room around it |
|
|
128
193
|
| `rotation` | `0` | Degrees, clockwise, **absolute**: `rotation: 360` ends one full turn from 0. The shape turns rigidly, also in a wide or tall element |
|
|
129
194
|
| `roundness` | `1` | Corners: `0` = sharp … `1` = the shape's own (the maximum) |
|
|
130
195
|
| `outline` | `false` | `{ width, band }`: only a band of `width` px along the edge shows; `band`: `'inside'` (default), `'centre'` or `'outside'` the edge. Not animated |
|
|
131
196
|
| `inverted` | `false` | `true`: the other way round — the shape (or band) is a hole, the rest of the element shows. Not animated |
|
|
132
|
-
| `duration`, `easing` | `
|
|
197
|
+
| `duration`, `easing` | `300`, `'easeInOutCubic'` | As for icons; also per `to()` call |
|
|
133
198
|
|
|
134
199
|
Everything except `outline` and `inverted` (they switch at once) animates together in `to()`; `duration: 0` jumps. How it works: a filled shape uses CSS `clip-path: url(#…)`,
|
|
135
200
|
an outlined one `mask: url(#…)` (clip-path has no line width); the `<clipPath>` / `<mask>` sit in a small hidden
|
|
@@ -166,7 +231,7 @@ morphs into any other. `wink-left` / `wink-right` = the eye that closes, as seen
|
|
|
166
231
|
| `pupilColor` | `'white'` | Colour of the pupils. Brows, eyes and mouth take the CSS `color` |
|
|
167
232
|
| `blink` | `true` | Blink by itself every few seconds |
|
|
168
233
|
| `size` | `'100%'` | CSS width and height of the face (by default it fills the element) |
|
|
169
|
-
| `duration`, `easing` | `
|
|
234
|
+
| `duration`, `easing` | `300`, `'easeInOutCubic'` | As for icons; also per `to()` call |
|
|
170
235
|
|
|
171
236
|
The face draws no background: a disc, card or anything else behind it is the element's own CSS. The pupils only show
|
|
172
237
|
inside the eyes (an eyelid covers them). With reduced motion the face changes without animation and doesn't blink.
|
|
@@ -177,7 +242,7 @@ inside the eyes (an eyelid covers them). With reduced motion the face changes wi
|
|
|
177
242
|
| --- | --- | --- | --- |
|
|
178
243
|
| `set` | both | **required** | A set object: a digit set (`digitsRound` …) for `text()`, any set for `icon()` — see above |
|
|
179
244
|
| `size` | both | `'1em'` | CSS size (icon: width and height; text: height). `1em` follows the font size |
|
|
180
|
-
| `duration` | both | `
|
|
245
|
+
| `duration` | both | `300` | Milliseconds |
|
|
181
246
|
| `easing` | both | `'easeInOutCubic'` | `'linear'`, `'easeInOutCubic'`, `'easeOutBack'`, `'easeOutElastic'`, or a function `(progress) => easedProgress` |
|
|
182
247
|
| `strokeWidth` | both | per set | Line width. A number is in grid units (an icon is 24 × 24; digits use about 1.1–1.6, icon sets 1.78) and scales with the size; a CSS length (`'2px'`, `'0.1rem'`, `'0.08em'`) stays that wide at any size |
|
|
183
248
|
| `lineCap` | both | per set | `'round'`, `'butt'`, `'square'` |
|
|
@@ -196,8 +261,10 @@ inside the eyes (an eyelid covers them). With reduced motion the face changes wi
|
|
|
196
261
|
- **Interrupting:** calling `to()` during a morph starts the new morph from the shape on screen.
|
|
197
262
|
The earlier promise resolves with `{ interrupted: true }`; promises never stay pending.
|
|
198
263
|
- **Reduced motion:** when the user's system asks for reduced motion, shapes change without animation.
|
|
199
|
-
- **Accessibility:**
|
|
200
|
-
- **Server-side rendering:** importing does not touch the DOM; only `icon()` / `text()` / `clip()` / `face()`
|
|
264
|
+
- **Accessibility:** icons, text lines and faces have `role="img"` and an `aria-label` with what they show.
|
|
265
|
+
- **Server-side rendering:** importing does not touch the DOM; only calling `icon()` / `text()` / `clip()` / `face()` does
|
|
266
|
+
(in React: inside `useEffect`).
|
|
267
|
+
- **TypeScript:** types are included (`Icon`, `IconOptions`, `Text`, `Clip`, `Face`, `ClipShape`, `FaceExpression` …).
|
|
201
268
|
|
|
202
269
|
## Development
|
|
203
270
|
|
package/dist/esm/all.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Every built-in set by name — `import { iconSets } from 'morphico/all'` (and `morphico.iconSets` in the classic script).
|
|
3
3
|
// Imports every set: for pages that pick sets at run time. Others import single sets (`morphico/sets/<name>`), so a
|
|
4
4
|
// bundler only keeps those.
|
package/dist/esm/clip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Layer 3: an element cut out by a morphing shape (a star, a heart, a speech bubble …), e.g. a photo or a card.
|
|
3
3
|
// The shape is square (1:1), placed by its centre (x, y) and size in % or px of the element, can be turned and
|
|
4
4
|
// outlined (only a band along its edge shows). Filled → CSS `clip-path: url(#id)`; outlined → `mask: url(#id)`
|
|
@@ -10,6 +10,8 @@ import { clampToUnit, DEFAULT_DURATION, prefersReducedMotion, shapesOf } from '.
|
|
|
10
10
|
import { clipShapes } from './sets/shapes.js';
|
|
11
11
|
import { createSvgElement } from './svg.js';
|
|
12
12
|
const GRID_SIZE = 24;
|
|
13
|
+
/** Default size: this share of the element's shorter side (a square that fits, with room around it). */
|
|
14
|
+
const DEFAULT_SIZE_SHARE = 0.7;
|
|
13
15
|
const GRID_CENTER = 12;
|
|
14
16
|
const DEGREE = Math.PI / 180;
|
|
15
17
|
/** Masks and their clip regions reach far past the element, so bands and turned shapes are never cut by them. */
|
|
@@ -38,7 +40,7 @@ const checkedOutline = (outline) => {
|
|
|
38
40
|
};
|
|
39
41
|
/** Cuts `element` out by a morphing shape, `init` first. */
|
|
40
42
|
export const clip = (element, init, options = {}) => {
|
|
41
|
-
const {
|
|
43
|
+
const { x = 50, y = 50, size, rotation = 0, roundness = 1, outline = false, inverted = false, ...defaultMorphOptions } = options;
|
|
42
44
|
const checkedState = (shapeSet, state) => {
|
|
43
45
|
if (!(state in shapeSet.strokes)) {
|
|
44
46
|
throw new Error(`morphico: unknown shape "${state}" (known: ${Object.keys(shapeSet.strokes).join(', ')})`);
|
|
@@ -51,10 +53,10 @@ export const clip = (element, init, options = {}) => {
|
|
|
51
53
|
}
|
|
52
54
|
/** Where the change goes (or what shows when nothing moves). */
|
|
53
55
|
const target = {
|
|
54
|
-
state: checkedState(
|
|
56
|
+
state: checkedState(clipShapes, checkedInit(init, 'clip')), set: resolveIconSet(clipShapes, roundness), roundness,
|
|
55
57
|
x, y, size, rotation, outline: checkedOutline(outline), inverted,
|
|
56
58
|
};
|
|
57
|
-
const pieceLength = pieceLengthOf(
|
|
59
|
+
const pieceLength = pieceLengthOf(clipShapes);
|
|
58
60
|
let frame = null; // null = resting at the target
|
|
59
61
|
let running = null;
|
|
60
62
|
let elementWidth = 0, elementHeight = 0;
|
|
@@ -123,7 +125,7 @@ export const clip = (element, init, options = {}) => {
|
|
|
123
125
|
const restingPlacement = () => ({
|
|
124
126
|
centerX: lengthToPixels(target.x, elementWidth, 'x'),
|
|
125
127
|
centerY: lengthToPixels(target.y, elementHeight, 'y'),
|
|
126
|
-
side: target.size === undefined ? Math.min(elementWidth, elementHeight) : lengthToPixels(target.size, elementWidth, 'size'),
|
|
128
|
+
side: target.size === undefined ? DEFAULT_SIZE_SHARE * Math.min(elementWidth, elementHeight) : lengthToPixels(target.size, elementWidth, 'size'),
|
|
127
129
|
});
|
|
128
130
|
const restingFrame = () => ({ shape: shapesOf(target.set)[target.state], rotation: target.rotation, placement: restingPlacement() });
|
|
129
131
|
/** The shape in element pixels: scaled to its square, turned around the square's centre, moved into place. */
|
|
@@ -180,7 +182,7 @@ export const clip = (element, init, options = {}) => {
|
|
|
180
182
|
target.state = checkedState(target.set, changes.state);
|
|
181
183
|
if (changes.roundness !== undefined && changes.roundness !== target.roundness) {
|
|
182
184
|
target.roundness = changes.roundness;
|
|
183
|
-
target.set = resolveIconSet(
|
|
185
|
+
target.set = resolveIconSet(clipShapes, changes.roundness);
|
|
184
186
|
}
|
|
185
187
|
if (changes.x !== undefined)
|
|
186
188
|
target.x = changes.x;
|
package/dist/esm/engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Animation engine: easings and one shared requestAnimationFrame loop for every running morph.
|
|
3
3
|
// The loop only runs while something moves; nothing touches the DOM at import time (SSR-safe).
|
|
4
4
|
export const easings = {
|
package/dist/esm/face.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Layer 4: a face that morphs between feelings. 7 soft filled pieces (sets/faces.ts) — brows, eyes and mouth in the
|
|
3
3
|
// CSS color, the pupils in their own color and clipped to the eyes. Blinking runs on top of any expression, by itself
|
|
4
4
|
// every few seconds (option) or on blink().
|
|
@@ -12,7 +12,6 @@ const BLINK_SHUT = 50;
|
|
|
12
12
|
const BLINK_OPENING = 150;
|
|
13
13
|
const AUTO_BLINK_MIN_PAUSE = 2500;
|
|
14
14
|
const AUTO_BLINK_EXTRA_PAUSE = 3500;
|
|
15
|
-
const DEFAULT_FACE_DURATION = DEFAULT_DURATION + 100;
|
|
16
15
|
/** Expressions whose eyes are already shut: blinking does nothing. */
|
|
17
16
|
const EYES_SHUT = ['asleep', 'laughing'];
|
|
18
17
|
let faceCount = 0;
|
|
@@ -64,7 +63,7 @@ export const face = (element, init, options = {}) => {
|
|
|
64
63
|
updateLabel();
|
|
65
64
|
const fromPieces = shownPieces;
|
|
66
65
|
const toPieces = expressions[nextState];
|
|
67
|
-
const duration = morphOptions.duration ??
|
|
66
|
+
const duration = morphOptions.duration ?? DEFAULT_DURATION;
|
|
68
67
|
if (prefersReducedMotion() || duration <= 0) {
|
|
69
68
|
shownPieces = toPieces;
|
|
70
69
|
render();
|
package/dist/esm/geometry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
const DEGREE = Math.PI / 180;
|
|
3
3
|
const ICON_CENTER = 12;
|
|
4
4
|
/** Largest arc one cubic segment may cover: up to 90° the cubic is visually exact. */
|
package/dist/esm/icon.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Layer 1: one icon that morphs between the states of a set, e.g. a single digit.
|
|
3
3
|
import { createMorphingPath, EMPTY_STATE, hasState } from './morph.js';
|
|
4
4
|
import { checkedIconSet, checkedInit, resolveIconSet } from './roundness.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
|
@@ -45,6 +45,7 @@ export { easings } from './engine.js';
|
|
|
45
45
|
export { face } from './face.js';
|
|
46
46
|
export { icon } from './icon.js';
|
|
47
47
|
export { faceExpressionNames } from './sets/faces.js';
|
|
48
|
+
export { clipShapeNames } from './sets/shapes.js';
|
|
48
49
|
export { text } from './text.js';
|
|
49
50
|
/** Package version, e.g. "0.1.0" (tools/build.ts replaces 'dev'). */
|
|
50
|
-
export const version = '0.
|
|
51
|
+
export const version = '0.6.0';
|
package/dist/esm/morph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// One SVG <path> that morphs between the states of an icon set. Shared by icon() and every text() cell.
|
|
3
3
|
import { animate, easings } from './engine.js';
|
|
4
4
|
import { defaultShapes, drawnPieces, interpolate, pieceLengthOf, rotateAroundCenter, scaleAroundCenter, shapeForPair, toPathData, withDrawnPieces, } from './geometry.js';
|
|
@@ -6,7 +6,7 @@ import { defaultShapes, drawnPieces, interpolate, pieceLengthOf, rotateAroundCen
|
|
|
6
6
|
export const EMPTY_STATE = ' ';
|
|
7
7
|
/** How small a shape gets while it fades into (or out of) the empty state. */
|
|
8
8
|
const EMPTY_SCALE = 0.3;
|
|
9
|
-
export const DEFAULT_DURATION =
|
|
9
|
+
export const DEFAULT_DURATION = 300;
|
|
10
10
|
// default layouts of every state, computed once per set on first use (nothing runs at import)
|
|
11
11
|
const shapesBySet = new WeakMap();
|
|
12
12
|
export const shapesOf = (iconSet) => {
|
package/dist/esm/roundness.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
const setsByRoundness = new WeakMap();
|
|
3
3
|
/** The set, optionally with sharper corners (`roundness` 0 = sharp … 1 = its own). */
|
|
4
4
|
export const resolveIconSet = (iconSet, roundness) => {
|
package/dist/esm/sets/battery.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/bell.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
2
|
-
// The characters every digit set shares besides 0–9: `-` `/` `.` `,` `:` (space = the empty state, see morph.ts)
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
|
+
// The characters every digit set shares besides 0–9: `-` `/` `.` `,` `:` (space = the empty state, see morph.ts),
|
|
3
|
+
// plus the symbols `+` `%` `$` `€` `£` drawn in the set's own style (symbols.ts).
|
|
3
4
|
// Each is drawn as one straight line, placed by the set's text layout and stroke width, and morphs to and from
|
|
4
5
|
// every digit by flattening (the user's choice 2026-10-27): the digit is pressed flat onto the line.
|
|
5
|
-
// `:` has two dots, so digit sets get a second
|
|
6
|
-
// (same strokes and layouts, drawn on top of itself, so
|
|
7
|
-
|
|
6
|
+
// `:` has two dots and the symbols up to three parts, so digit sets get a second and a third piece. The second
|
|
7
|
+
// repeats the first piece exactly for every state with one part (same strokes and layouts, drawn on top of itself, so
|
|
8
|
+
// it doesn't show; a digit morphing into `:` splits into the two dots). The third is only `€`'s lower bar and `%`'s
|
|
9
|
+
// lower ring: every other state rests it as a single point in the middle (never drawn), so it grows out of there
|
|
10
|
+
// instead of a whole copy shrinking into it. Symbols morph with the default pairing, except the pairs in
|
|
11
|
+
// `symbolPairLayouts`.
|
|
12
|
+
import { defaultBreakpoints, line } from '../geometry.js';
|
|
13
|
+
import { symbolPairLayouts, symbolStrokes } from './symbols.js';
|
|
8
14
|
const DIGITS = [...'0123456789'];
|
|
9
15
|
/** Half the length of a dot's line, relative to the stroke width: round ends make it a dot 1.1 × the stroke wide. */
|
|
10
16
|
const DOT_HALF_LENGTH = 0.05;
|
|
11
|
-
/**
|
|
12
|
-
|
|
17
|
+
/** The layouts of a piece plus more pairs (merged per state). */
|
|
18
|
+
const withMorePairs = (layouts, morePairs) => {
|
|
19
|
+
const merged = { ...layouts };
|
|
20
|
+
for (const [state, byOtherState] of Object.entries(morePairs))
|
|
21
|
+
merged[state] = { ...merged[state], ...byOtherState };
|
|
22
|
+
return merged;
|
|
23
|
+
};
|
|
24
|
+
/** Adds `-` `/` `.` `,` `:` and the symbols (in `symbolStyle`) to a digit set (which needs a text layout) as morphing states. */
|
|
25
|
+
export const withTextCharacters = (iconSet, symbolStyle) => {
|
|
13
26
|
const { baselineY, colonDotsY } = iconSet.textLayout;
|
|
14
27
|
const dotHalfLength = iconSet.strokeWidth * DOT_HALF_LENGTH;
|
|
15
28
|
const dotY = baselineY; // dot centre on the line the digits stand on
|
|
@@ -21,23 +34,31 @@ export const withTextCharacters = (iconSet) => {
|
|
|
21
34
|
',': [line(12.3, dotY, 11, baselineY + 2.2)], // from the dot down to the left
|
|
22
35
|
':': [dot(colonDotsY[0])],
|
|
23
36
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
const pairLayouts = withMorePairs(iconSet.pairLayouts, Object.fromEntries(Object.keys(characters).map((character) => [character, Object.fromEntries(DIGITS.map((digit) => [digit, { flatten: true }]))])));
|
|
38
|
+
const drawings = symbolStrokes(symbolStyle);
|
|
39
|
+
/** A tracing is only used with breakpoints (geometry.ts shapeForPair): give the symbols' tracings the default ones. */
|
|
40
|
+
const withTracingBreakpoints = (layouts, tracings) => Object.fromEntries(Object.entries(layouts).map(([state, byOtherState]) => [state, Object.fromEntries(Object.entries(byOtherState).map(([otherState, layout]) => [otherState, layout.tracing && !layout.breakpoints
|
|
41
|
+
? { ...layout, breakpoints: defaultBreakpoints(tracings[layout.tracing], iconSet.segmentCount) }
|
|
42
|
+
: layout]))]));
|
|
43
|
+
const symbols = Object.entries(drawings.pieces);
|
|
44
|
+
const strokes = { ...iconSet.strokes, ...characters, ...Object.fromEntries(symbols.map(([symbol, [first]]) => [symbol, first])) };
|
|
45
|
+
const partsAt = (index) => Object.fromEntries(symbols.flatMap(([symbol, pieces]) => (pieces[index] ? [[symbol, pieces[index]]] : [])));
|
|
46
|
+
const secondPiece = {
|
|
47
|
+
strokes: { ...strokes, ':': [dot(colonDotsY[1])], ...partsAt(1) },
|
|
48
|
+
alternativeStrokes: { ...iconSet.alternativeStrokes, ...drawings.secondPieceTracings },
|
|
49
|
+
pairLayouts: withMorePairs(pairLayouts, withTracingBreakpoints(symbolPairLayouts[1], drawings.secondPieceTracings)),
|
|
50
|
+
};
|
|
51
|
+
// only the symbols' layouts here: the digits' tracings would draw a whole digit in place of the resting point
|
|
52
|
+
const thirdPiece = {
|
|
53
|
+
strokes: { ...Object.fromEntries(Object.keys(strokes).map((state) => [state, [line(12, 12, 12, 12)]])), ...partsAt(2) },
|
|
54
|
+
alternativeStrokes: drawings.thirdPieceTracings,
|
|
55
|
+
pairLayouts: withTracingBreakpoints(symbolPairLayouts[2], drawings.thirdPieceTracings),
|
|
30
56
|
};
|
|
31
|
-
const pairLayouts = flattenPairs(iconSet.pairLayouts);
|
|
32
|
-
const strokes = { ...iconSet.strokes, ...characters };
|
|
33
57
|
return {
|
|
34
58
|
...iconSet,
|
|
35
59
|
strokes,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
alternativeStrokes: iconSet.alternativeStrokes,
|
|
40
|
-
pairLayouts,
|
|
41
|
-
}],
|
|
60
|
+
alternativeStrokes: { ...iconSet.alternativeStrokes, ...drawings.firstPieceTracings },
|
|
61
|
+
pairLayouts: withMorePairs(pairLayouts, withTracingBreakpoints(symbolPairLayouts[0], drawings.firstPieceTracings)),
|
|
62
|
+
morePieces: [secondPiece, thirdPiece],
|
|
42
63
|
};
|
|
43
64
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/chevron.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Digit set "condensed": tall, narrow, thin "display" digits with rounded corners, drafted from the reference images in
|
|
3
3
|
// icons/condensed/ (the set format is described in ../types.ts).
|
|
4
4
|
//
|
|
@@ -29,7 +29,8 @@ const HOOK_END_Y = 79;
|
|
|
29
29
|
// the 6: hook at the top right, over the top, down the left side, round the bottom, up to the middle bar, back left
|
|
30
30
|
const SIX_POINTS = [[47, 94 - HOOK_END_Y], [47, 3], [3, 3], [3, 91], [47, 91], [47, 47], [3, 47]];
|
|
31
31
|
const SIX_RADII = [0, OUTER_RADIUS, OUTER_RADIUS, OUTER_RADIUS, OUTER_RADIUS, MIDDLE_RADIUS, 0];
|
|
32
|
-
// '-' '/' '.' ',' ':'
|
|
32
|
+
// '-' '/' '.' ',' ':' and the symbols '+' '%' '$' '€' '£' (in this set's box and corners) are added by
|
|
33
|
+
// withTextCharacters (characters.ts, symbols.ts)
|
|
33
34
|
export const digitsCondensed = withTextCharacters({
|
|
34
35
|
segmentCount: 20,
|
|
35
36
|
strokeWidth: 6 / PIXELS_PER_UNIT,
|
|
@@ -134,4 +135,4 @@ export const digitsCondensed = withTextCharacters({
|
|
|
134
135
|
},
|
|
135
136
|
spins: { 6: { 9: 180 }, 9: { 6: -180 } },
|
|
136
137
|
textLayout: { cellWidth: 8, spacing: 3.5, baselineY: 20, colonDotsY: [8, 16] },
|
|
137
|
-
});
|
|
138
|
+
}, { left: 8, right: 16, top: 4, bottom: 20, corners: CORNER_RADIUS / PIXELS_PER_UNIT });
|
package/dist/esm/sets/copy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/eye.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/faces.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
export const OUTLINE_POINTS = 24;
|
|
3
3
|
export const PIECE_NAMES = ['leftBrow', 'rightBrow', 'leftEye', 'rightEye', 'leftPupil', 'rightPupil', 'mouth'];
|
|
4
4
|
const DENSE_SAMPLES = 360;
|
package/dist/esm/sets/folder.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Digit set "handwritten": hand-drawn marker digits, traced from the reference images in icons/handwritten/
|
|
3
3
|
// (the set format is described in ../types.ts).
|
|
4
4
|
//
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// - the 4 is drawn out and back over its crossbar end and right stem (one continuous stroke)
|
|
12
12
|
import { cubic } from '../geometry.js';
|
|
13
13
|
import { withTextCharacters } from './characters.js';
|
|
14
|
-
// '-' '/' '.' ',' ':'
|
|
14
|
+
// '-' '/' '.' ',' ':' and the symbols '+' '%' '$' '€' '£' (in this set's box and corners) are added by
|
|
15
|
+
// withTextCharacters (characters.ts, symbols.ts)
|
|
15
16
|
export const digitsHandwritten = withTextCharacters({
|
|
16
17
|
segmentCount: 16,
|
|
17
18
|
strokeWidth: 1.04,
|
|
@@ -133,4 +134,4 @@ export const digitsHandwritten = withTextCharacters({
|
|
|
133
134
|
},
|
|
134
135
|
spins: {},
|
|
135
136
|
textLayout: { cellWidth: 9, spacing: 4, baselineY: 20.2, colonDotsY: [8, 16] },
|
|
136
|
-
});
|
|
137
|
+
}, { left: 7.5, right: 16.5, top: 4.2, bottom: 19.8, corners: 'round' });
|
package/dist/esm/sets/lock.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/lucide.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/media.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/menu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/mic.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/radio.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | code: MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE)
|
|
2
2
|
* Icons based on Lucide (https://lucide.dev), some of them from Feather (https://feathericons.com):
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
package/dist/esm/sets/round.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! morphico v0.
|
|
1
|
+
/*! morphico v0.6.0 | MIT License, Copyright (c) 2026 Raycho Ivanov (see LICENSE) */
|
|
2
2
|
// Digit set "round": geometric sans digits, drafted from the reference images in icons/round/
|
|
3
3
|
// (the set format is described in ../types.ts).
|
|
4
4
|
//
|
|
@@ -35,7 +35,8 @@ const TWO_DIAGONAL_ANGLE = 39.5191;
|
|
|
35
35
|
const FIVE_JOIN_ANGLE = 237.2;
|
|
36
36
|
/** The 7's foot: on the measured diagonal (16, 4.2 → 7.45, 20.6), pulled in to the base line. */
|
|
37
37
|
const SEVEN_FOOT = pointAtY([16, TOP_BAR_Y], [7.45, 20.6], BASE_Y);
|
|
38
|
-
// '-' '/' '.' ',' ':'
|
|
38
|
+
// '-' '/' '.' ',' ':' and the symbols '+' '%' '$' '€' '£' (in this set's box and corners) are added by
|
|
39
|
+
// withTextCharacters (characters.ts, symbols.ts)
|
|
39
40
|
export const digitsRound = withTextCharacters({
|
|
40
41
|
segmentCount: 12,
|
|
41
42
|
strokeWidth: STROKE_WIDTH,
|
|
@@ -241,4 +242,4 @@ export const digitsRound = withTextCharacters({
|
|
|
241
242
|
9: { 6: -180, 8: -180 },
|
|
242
243
|
},
|
|
243
244
|
textLayout: { cellWidth: 10, spacing: 4, baselineY: 19.8, colonDotsY: [7.6, 15.6] },
|
|
244
|
-
});
|
|
245
|
+
}, { left: 7, right: 17, top: 4.2, bottom: 19.8, corners: 'round' });
|