@plotdb/lotion 0.3.0 → 0.4.2
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/CHANGELOG.md +32 -0
- package/README.md +27 -0
- package/package.json +1 -1
- package/vector.js +1345 -46
- package/vector.min.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## v0.4.2
|
|
2
|
+
|
|
3
|
+
- animate, size: `clip-path: inset()` ( reveals ) becomes one svg clipPath whose rect moves by smil, instead of one
|
|
4
|
+
appearance per inset ( lotitor's sumi-ink trial: html variants 68 to 35 )
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## v0.4.1
|
|
8
|
+
|
|
9
|
+
- bug fix:
|
|
10
|
+
- vector / animate: box-shadow and text-shadow are reordered to "offsets blur spread color", since computed style
|
|
11
|
+
puts the color first and satori then drew a broken path, so shadows were missing
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## v0.4.0
|
|
15
|
+
|
|
16
|
+
- features:
|
|
17
|
+
- `lotion.animate(opt)` / `player.animate(opt)` ( experimental, in `vector.js` ): convert a whole animation into one
|
|
18
|
+
animated svg. each element becomes a `<g>` nested as in the dom; its motion ( position and transform as a matrix,
|
|
19
|
+
opacity, blur ) is sampled per frame and written as css keyframes, simplified to the points linear interpolation
|
|
20
|
+
needs; each distinct appearance is drawn once by satori and switched by visibility. inline svg is walked
|
|
21
|
+
natively: groups animate, leaves keep their markup with numeric attributes as smil `<animate>`, definitions are
|
|
22
|
+
written once, and text uses fonts embedded once. `mix-blend-mode` now works at any depth.
|
|
23
|
+
- demo: the `/vector/` page converts the whole animation and plays the animated svg
|
|
24
|
+
- animate, size: numeric tracks are written once per element instead of once per appearance ( positions of svg
|
|
25
|
+
leaves join the group matrix, inheritable values such as `stroke-dashoffset` animate on the group );
|
|
26
|
+
css gradient masks moved by `mask-position` / `mask-size` ( wipes ) become one svg mask with a moving rect, so
|
|
27
|
+
the content is drawn once; paths drawn progressively ( each `d` a prefix of a longer one ) become the full path
|
|
28
|
+
revealed by a dash animation. the code-only sumi-ink trial drops from 3.2 MB to 1.5 MB.
|
|
29
|
+
- tweaks:
|
|
30
|
+
- vector: inline svg keeps a content-based placeholder `src` until fonts are ready
|
|
31
|
+
|
|
32
|
+
|
|
1
33
|
## v0.3.0
|
|
2
34
|
|
|
3
35
|
- features:
|
package/README.md
CHANGED
|
@@ -147,6 +147,33 @@ dependency after lotion ( `{name: 'lotion', path: 'vector.min.js'}` ); rescope g
|
|
|
147
147
|
web font ( system fonts are not available ), mask or clip-path under a transform other than a translation
|
|
148
148
|
( satori does not move masks with transforms ).
|
|
149
149
|
|
|
150
|
+
### Animated svg
|
|
151
|
+
|
|
152
|
+
`lotion.animate({el, seek, duration, fps})` ( or `player.animate({fps})` ) converts the whole animation into one svg
|
|
153
|
+
that plays by itself, resolving to `{svg, warnings, stats}`:
|
|
154
|
+
|
|
155
|
+
- every element becomes a `<g>`, nested as in the dom. Its motion, the position and transform combined into a
|
|
156
|
+
matrix, opacity and a `blur()` filter, is sampled at `fps` and written as css keyframes, keeping only the samples
|
|
157
|
+
linear interpolation needs.
|
|
158
|
+
- everything else is its appearance. Each distinct appearance is drawn once ( by satori ) and shown by visibility
|
|
159
|
+
keyframes, so an element that only moves costs one drawing, while one whose content changes ( typing, a growing
|
|
160
|
+
width ) costs one per state. Elements with a css mask, clip-path or other filters, `<img>` and `<canvas>`, are
|
|
161
|
+
drawn with their children as one appearance.
|
|
162
|
+
- inline svg is kept as svg: groups animate like elements, leaves keep their markup with numeric attributes
|
|
163
|
+
( coordinates, `stroke-dashoffset`, opacities ... ) written as smil `<animate>`, definitions are written once,
|
|
164
|
+
and text uses fonts embedded once. nested `<svg>` becomes a group, since smil inside a nested svg does not follow
|
|
165
|
+
the outer svg when paused or seeked.
|
|
166
|
+
- tracks are written once per element: positions of svg leaves join the group matrix, and inheritable values
|
|
167
|
+
( `stroke-dashoffset`, `stroke-width`, fill / stroke opacity ) animate on the group.
|
|
168
|
+
- a css mask of one `linear-gradient` ( horizontal or vertical, `no-repeat` ) becomes an svg mask whose rect follows
|
|
169
|
+
`mask-position` / `mask-size`, so a wipe draws its content once. Other masks and clip-paths are drawn per state.
|
|
170
|
+
- a path whose `d` grows ( each one a prefix of a longer one, stroked without fill, dashes or markers ) becomes the
|
|
171
|
+
longest path revealed by a dash animation.
|
|
172
|
+
- options: `fps` ( default 30 ), `from`, `to`, `loop` ( default true ), `progress`, `signal`.
|
|
173
|
+
|
|
174
|
+
The demo converts in under a second into 230 KB ( 35 KB with brotli ); the code-only sumi-ink trial ( 44 s at 10 fps )
|
|
175
|
+
in about 2 seconds into 1.5 MB ( 230 KB with brotli ). Serve it compressed, or save it as `.svgz`. Frames of the animated svg match screenshots as closely as single frames do.
|
|
176
|
+
|
|
150
177
|
On the demo and the sumi-ink trial of lotitor, frames rasterized from the svg match screenshots at 29 - 39 dB PSNR;
|
|
151
178
|
the remaining difference is mostly text antialiasing and baselines in fixed line-heights. A frame takes 50 - 300 ms.
|
|
152
179
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"zbryikt","name":"@plotdb/lotion","version":"0.
|
|
1
|
+
{"author":"zbryikt","name":"@plotdb/lotion","version":"0.4.2","description":"deterministic motion toolkit: animation as a pure function of time, with player, frame renderer and block packaging","license":"MIT","main":"index.min.js","browser":"index.min.js","bin":{"lotion":"./cli.js"},"homepage":"https://github.com/plotdb/lotion","repository":{"type":"git","url":"git+https://github.com/plotdb/lotion.git"},"scripts":{"start":"npx server -r web -o true"},"engines":{"node":">=14"},"keywords":["motion","animation","video","playwright","block"],"dependencies":{"@plotdb/block":"^5.7.3","@plotdb/csscope":"^5.0.4","@plotdb/rescope":"^5.1.0","@plotdb/semver":"^0.0.4","proxise":"^1.0.1"},"peerDependencies":{"playwright":">=1.40"},"peerDependenciesMeta":{"playwright":{"optional":true}},"devDependencies":{"@plotdb/guides":"github:plotdb/guides","@zbryikt/template":"^2.5.0","@zumer/snapdom":"^3.3.0","fedep":"^1.9.0","livescript":"^1.6.0","mediabunny":"^1.61.3","playwright":"^1.63.0","stylus":"^0.64.0","uglify-js":"^3.19.3"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["@zumer/snapdom","mediabunny"]}}
|