You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit faccba2
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,8 @@ Inspired by [Orta Therox](https://github.com/Orta). Thanks Orta for your outstan
50
50
| `text-color` | ❌ | `black` | Color of the collision text (CSS color value) |
51
51
| `scale` | ❌ | `3` | Display zoom factor: the SVG `width`/`height` are the physics dimensions × scale, while the viewBox keeps the raw physics size |
52
52
| `speed` | ❌ | `3` | Playback speed multiplier: the animation duration is the simulated time ÷ speed |
53
+
| `css` | ❌ | `false` | Use the CSS animation engine instead of SMIL `animateTransform`. See below |
54
+
| `animation` | ❌ | `var(--n) var(--dur) linear both` | Custom CSS `animation` value for the CSS engine. ⚠️ Modify with caution — a wrong value breaks the animation. Requires `css: true` |
53
55
| `width` | ❌ | `300` | Width of the physics world. ⚠️ Affects layout and SVG size |
54
56
| `height` | ❌ | `150` | Height of the physics world. ⚠️ Affects layout and SVG size |
55
57
| `size` | ❌ | `4` | Side length of each contribution block. ⚠️ Affects physics |
@@ -60,9 +62,8 @@ Inspired by [Orta Therox](https://github.com/Orta). Thanks Orta for your outstan
60
62
61
63
The trajectory is compressed by default: `compression-tolerance`(default `0.5`) merges
62
64
trajectory points into keyframes so that, at every original moment, the interpolated
63
-
position stays within the given distance (in SVG pixels) of the real one. Each keyframe
64
-
keeps its original timing via `keyTimes`, so speed changes — bounces, landings, stops —
65
-
play back at their real pace.
65
+
position stays within the given distance (in SVG pixels) of the real one — speed changes
66
+
such as bounces, landings and stops keep their real pace.
66
67
67
68
The default is invisible to the eye and already shrinks the output by orders of magnitude,
68
69
so most setups can keep it. Set `0` for a lossless trajectory — only uniform straight
@@ -83,6 +84,30 @@ points each at the default tolerance `0.5`:
83
84
84
85
In most cases, just keep the default.
85
86
87
+
### Animation engine
88
+
89
+
Two output engines are available; both produce a single static SVG file and play the
90
+
same trajectory at the same pace:
91
+
92
+
- **SMIL** (default) drives every block with `<animateTransform>` elements.
93
+
- **CSS** (`css: true`) drops those elements and declares all animations in one
94
+
self-contained `<style>` block: each block's trajectory becomes a `@keyframes` rule.
95
+
96
+
The rendered animation is identical. Choose CSS when the target environment handles
97
+
SMIL poorly — some sanitizers strip SMIL animation elements, while CSS animation in
98
+
SVG is more widely supported (GitHub READMEs load SVGs via `<img>`, where both work).
99
+
The CSS output is slightly larger than SMIL.
100
+
101
+
With `css: true`, the `animation` input replaces the animation declaration applied to
102
+
every block (default `var(--n) var(--dur) linear both`). Available variables:
103
+
104
+
- `--n`— each block's keyframes name, required
105
+
- `--dur`— the playback duration
106
+
107
+
⚠️ This value is spliced into the generated style block as-is — modify with caution,
108
+
a wrong value breaks the animation. Verify in the web preview before committing.
109
+
Must not contain braces, semicolons or `]]>`.
110
+
86
111
### Advanced customization
87
112
88
113
`width`, `height`, `size` and `interval` change the physics world itself, not just the output
0 commit comments