use-scroll-animate 5.3.0 → 5.5.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/docs/ROADMAP.md CHANGED
@@ -5,8 +5,8 @@
5
5
  - ✅ **v5.1** — 卡片与点击特效 2.0:全息镭射卡、扫光、3D 翻书、磁吸卡组、卡片倾倒;点击冲击波环、墨水飞溅、星星爆裂、果冻按压、涟漪环 —— 全部可用 `<usa-fx>` 触发。
6
6
  - ✅ **v5.2** — 弹跳与物理微交互:弹入、橡皮筋、弹性悬停、掉落回弹、重力文字、弹簧跟随指针、摇摆铃铛。
7
7
  - ✅ **v5.3** — 全页特效:幕布、光圈擦除、像素溶解、百叶窗转场、滚动速度倾斜、全页聚光灯、页面边缘光晕。
8
- - **v5.4** — 滚动叙事模板:`<usa-story>` —— 固定章节、横向长廊、缩放穿越、前后对比滑块、数据故事计数器、逐段高亮。
9
- - **v5.5** — 生成式背景:流场、Voronoi 细胞、网格渐变(mesh gradient)、星空、metaballs、等高线 —— Canvas 2D 实现,可见时才渲染,自适应质量。
8
+ - ✅ **v5.4** — 滚动叙事模板:`<usa-story>` —— 固定章节、横向长廊、缩放穿越、前后对比滑块、数据故事计数器、逐段高亮。
9
+ - ✅ **v5.5** — 生成式背景:流场、Voronoi 细胞、网格渐变(mesh gradient)、星空、metaballs、等高线 —— Canvas 2D 实现,可见时才渲染,自适应质量。
10
10
  - **v5.6** — 声音响应特效:Web Audio 分析器驱动频谱柱、脉冲光环、波形环,节拍检测可触发任意已注册效果(需用户手势开启,减少动态效果时停用)。
11
11
  - **v5.7** — 光标与手势包:彗星拖尾、星光、丝带、磁吸点、聚光光标;甩动、双指旋转、长按蓄力手势 → 触发效果。
12
12
  - **v5.8** — 主题包与微交互库:霓虹、纸张、玻璃、复古、粗野主义主题包(令牌 + 效果预设);复制成功、开关变形、输入抖动、密码显隐、收藏星星、下载进度等 20+ 微交互。
@@ -381,6 +381,41 @@ link.addEventListener('click', (e) => {
381
381
 
382
382
  Persistent: `<usa-fx effect="velocity-skew" trigger="load">`, `spotlight` (`radius`, `dim`), `edge-glow` (`color`, `size`). Reduced motion: transitions cross-fade (150 ms), persistent effects are off.
383
383
 
384
+ ### v5.4 Scroll stories — `<usa-story>` (`components/effects`)
385
+
386
+ ```js
387
+ import { defineStory } from 'use-scroll-animate/components/effects';
388
+ defineStory();
389
+ ```
390
+ ```html
391
+ <usa-story template="pin">
392
+ <figure data-stage>…</figure>
393
+ <section data-step>Chapter 1</section>
394
+ <section data-step>Chapter 2</section>
395
+ </usa-story>
396
+ <usa-story template="gallery"><div data-sticky><div data-track>…cards…</div></div></usa-story>
397
+ <usa-story template="compare" label="Before / after"><div data-sticky><img data-before …><img data-after …></div></usa-story>
398
+ <usa-story template="counter"><strong data-count="12,480">0</strong></usa-story>
399
+ ```
400
+
401
+ Templates `pin` · `gallery` · `zoom` (`zoom="6"`) · `compare` · `counter` · `highlight`. Each sets `--usa-story-progress`, fires `usa-story-step`, and exposes `progress`, `step`, `update()`. Reduced motion: no sliding / zooming, final counter values. Demo: `showcase/story.html`.
402
+
403
+ ### v5.5 Generative backgrounds (`components/effects`)
404
+
405
+ `flow-field` · `voronoi` · `mesh-gradient` · `starfield` · `metaballs` · `contours` (kind `background`) — Canvas 2D behind the element’s content, rendering only while visible, with adaptive quality; reduced motion draws one static frame.
406
+
407
+ ```html
408
+ <usa-fx effect="mesh-gradient" trigger="load" self class="hero" options='{"colors":["#7c5cff","#ff5c8a","#22d3ee"],"speed":0.6}'>
409
+ <h1>Hello</h1>
410
+ </usa-fx>
411
+ ```
412
+ ```js
413
+ import { registerEffect } from 'use-scroll-animate/components/fx';
414
+ import { canvasBackground } from 'use-scroll-animate/components/effects';
415
+ registerEffect({ name: 'pulse-bg', kind: 'background', reduced: 'run',
416
+ run: (el, o, ctx) => canvasBackground(el, ctx, { draw: ({ ctx: g, w, h, t }) => { g.fillStyle = `hsl(${t * 40} 70% 50%)`; g.fillRect(0, 0, w, h); } }, o) });
417
+ ```
418
+
384
419
  ## Frameworks
385
420
 
386
421
  Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-scroll-animate",
3
- "version": "5.3.0",
3
+ "version": "5.5.0",
4
4
  "description": "A lightweight, high-performance, dependency-free scroll animation library and animated UI components (Web Components) for the web and Windows web-view apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",