slowmo 0.4.0 → 0.7.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.
Files changed (2) hide show
  1. package/README.md +46 -55
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,19 +1,16 @@
1
1
  # slowmo
2
2
 
3
- Slow down any web animation with one line of code.
3
+ Control time on any web page. Debug, study, or speedrun animations.
4
4
 
5
5
  <!-- TODO: Add hero GIF/video here -->
6
6
  <!-- ![slowmo demo](./assets/demo.gif) -->
7
7
 
8
- [![npm version](https://img.shields.io/npm/v/slowmo.svg)](https://www.npmjs.com/package/slowmo)
9
- [![bundle size](https://img.shields.io/bundlephobia/minzip/slowmo)](https://bundlephobia.com/package/slowmo)
10
- [![license](https://img.shields.io/npm/l/slowmo.svg)](https://github.com/anthropics/slowmo/blob/main/LICENSE)
11
-
12
8
  ## Why?
13
9
 
14
10
  - **Debug animations** - Slow things down to see exactly what's happening
15
- - **Record demos** - Capture smooth slow-motion footage for product videos
16
- - **Create effects** - Add dramatic slow-mo moments to your UI
11
+ - **Study details** - Appreciate the little details on why something looks so neat
12
+ - **Speedrun UIs** - Skip or skim quickly through any animation gated experience
13
+ - **Game difficulty** - Slower gives you better reflexes, faster challenges you more
17
14
 
18
15
  ## Install
19
16
 
@@ -21,51 +18,20 @@ Slow down any web animation with one line of code.
21
18
  npm install slowmo
22
19
  ```
23
20
 
24
- ```bash
25
- pnpm add slowmo
26
- ```
27
-
28
- ```bash
29
- yarn add slowmo
30
- ```
31
-
32
- Or use a CDN:
33
-
34
- ```html
35
- <script type="module">
36
- import { slowmo } from 'https://esm.sh/slowmo';
37
- slowmo(0.5);
38
- </script>
39
- ```
21
+ > **Chrome Extension coming soon** - Control any website's animations without writing code.
40
22
 
41
23
  ## Quick Start
42
24
 
43
25
  ```js
44
- import { slowmo } from 'slowmo';
26
+ import { slowmo } from "slowmo";
45
27
 
46
- slowmo(0.5); // Everything runs at half speed
28
+ slowmo(0.5); // That's it, now anything that moves will go half speed.
47
29
  ```
48
30
 
49
- That's it. CSS animations, videos, canvas, GSAP, Three.js, Framer Motion - all slowed down automatically.
50
-
51
- ## What It Works With
52
-
53
- | Type | How |
54
- |------|-----|
55
- | CSS Animations | Web Animations API `playbackRate` |
56
- | CSS Transitions | Web Animations API `playbackRate` |
57
- | Videos & Audio | `playbackRate` property |
58
- | requestAnimationFrame | Patched timestamps |
59
- | performance.now() | Returns virtual time |
60
- | GSAP | `globalTimeline.timeScale()` (auto-detected) |
61
- | Three.js | Uses rAF, works automatically |
62
- | Framer Motion | Uses Web Animations API, works automatically |
63
- | Canvas animations | Uses rAF, works automatically |
64
-
65
- ## API
31
+ ## Full API
66
32
 
67
33
  ```js
68
- import { slowmo } from 'slowmo';
34
+ import { slowmo } from "slowmo";
69
35
 
70
36
  // Set speed (0.5 = half speed, 2 = double speed)
71
37
  slowmo(0.5);
@@ -81,34 +47,58 @@ slowmo.setSpeed(0.5);
81
47
  slowmo.pause();
82
48
  slowmo.play();
83
49
  slowmo.reset();
84
- slowmo.getSpeed(); // Returns current speed
50
+ slowmo.getSpeed(); // Returns current speed
85
51
  ```
86
52
 
87
53
  ### Speed Guide
88
54
 
89
- | Speed | Effect |
90
- |-------|--------|
91
- | `0` | Paused |
55
+ | Speed | Effect |
56
+ | ----- | -------------------------------- |
57
+ | `0` | Paused |
92
58
  | `0.1` | 10x slower (great for debugging) |
93
- | `0.5` | Half speed |
94
- | `1` | Normal |
95
- | `2` | Double speed |
59
+ | `0.5` | Half speed |
60
+ | `1` | Normal |
61
+ | `2` | Double speed |
96
62
 
97
63
  ### Excluding Elements
98
64
 
99
65
  Add `data-slowmo-exclude` to opt out specific elements:
100
66
 
101
67
  ```html
102
- <div data-slowmo-exclude>
103
- This animation runs at normal speed
104
- </div>
68
+ <div data-slowmo-exclude>This animation runs at normal speed</div>
105
69
  ```
106
70
 
71
+ ## What It Works With
72
+
73
+ | Type | How |
74
+ | --------------------- | -------------------------------------------- |
75
+ | CSS Animations | Web Animations API `playbackRate` |
76
+ | CSS Transitions | Web Animations API `playbackRate` |
77
+ | Videos & Audio | `playbackRate` property |
78
+ | requestAnimationFrame | Patched timestamps |
79
+ | performance.now() | Returns virtual time |
80
+ | GSAP | `globalTimeline.timeScale()` (auto-detected) |
81
+ | Three.js | Uses rAF, works automatically |
82
+ | Framer Motion | Uses Web Animations API, works automatically |
83
+ | Canvas animations | Uses rAF, works automatically |
84
+
107
85
  ## Limitations
108
86
 
109
87
  - **Frame-based animations** that don't use timestamps can't be smoothly slowed (they increment by a fixed amount each frame regardless of time)
110
- - **Libraries that cache time references** before slowmo loads may not be affected
88
+ - **Libraries that cache time function references** before slowmo loads may not be affected
111
89
  - **Video/audio** have browser-imposed limits (~0.0625x to 16x in Chrome)
90
+ - **iframes** won't be affected unless slowmo is also loaded inside them
91
+ - **Web Workers & Worklets** run in separate threads with their own timing APIs that can't be patched from the main thread (audio worklets, paint worklets, animation worklets)
92
+ - **WebGL shaders** with custom time uniforms need manual integration
93
+ - **Server-synced animations** that rely on server timestamps rather than local time
94
+
95
+ ## Contributing
96
+
97
+ Open to contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and Chrome extension testing instructions.
98
+
99
+ ## Inspiration
100
+
101
+ Inspired by [agentation](https://agentation.dev/) by [Benji Taylor](https://x.com/BenjiTaylor) and his related blog posts [[1]](https://benji.org/annotating) [[2]](https://benji.org/agentation)
112
102
 
113
103
  ## License
114
104
 
@@ -117,4 +107,5 @@ MIT
117
107
  ---
118
108
 
119
109
  <!-- TODO: Update with actual website URL -->
120
- [Website](https://slowmo.dev) · [GitHub](https://github.com/anthropics/slowmo) · [npm](https://www.npmjs.com/package/slowmo)
110
+
111
+ [website](https://slowmo.dev) · [github](https://github.com/seflless/slowmo) · [npm](https://www.npmjs.com/package/slowmo)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slowmo",
3
- "version": "0.4.0",
3
+ "version": "0.7.0",
4
4
  "description": "Universal slow-motion control for web animations - CSS, videos, GSAP, Three.js, and more",
5
5
  "type": "module",
6
6
  "main": "./dist/slowmo.cjs",