ripppl 0.1.0 → 0.1.1
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 +58 -9
- package/dist/{ripyl.d.ts → ripppl.d.ts} +1 -1
- package/dist/ripppl.d.ts.map +1 -0
- package/dist/{ripyl.js → ripppl.js} +2 -2
- package/package.json +11 -11
- package/dist/ripyl.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">ripppl</h1>
|
|
2
2
|
|
|
3
|
-
Ripple displacement
|
|
3
|
+
<p align="center">Ripple displacement using WebGL over the DOM.</p>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/Arman-Luthra/ripppl/main/demo_1.gif" alt="" width="49%" />
|
|
7
|
+
<img src="https://raw.githubusercontent.com/Arman-Luthra/ripppl/main/demo-2.gif" alt="" width="49%" />
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
13
|
npm install ripppl
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## Usage
|
|
12
17
|
|
|
13
18
|
```ts
|
|
14
19
|
import { attachRipple } from "ripppl";
|
|
@@ -24,12 +29,56 @@ handle.trigger({ x: 0.5, y: 0.5 });
|
|
|
24
29
|
handle.destroy();
|
|
25
30
|
```
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
`attachRipple` takes a **trigger** (CSS selector, element, or list of elements) and optional options. Clicks on the trigger capture the surrounding DOM and run the ripple. Use **`scope`** to clip the effect to a container; omit **`scope`** for a full-viewport ripple.
|
|
33
|
+
|
|
34
|
+
The returned **handle** exposes:
|
|
35
|
+
|
|
36
|
+
| Method | Purpose |
|
|
37
|
+
|--------|---------|
|
|
38
|
+
| `update(partial)` | Merge new tuning values (see parameters below). |
|
|
39
|
+
| `trigger({ x?, y? })` | Start a ripple at normalized coordinates **0–1** inside the scope (default center). |
|
|
40
|
+
| `destroy()` | Remove listeners, overlay, and WebGL resources. |
|
|
41
|
+
|
|
42
|
+
Types: `RippleOptions`, `RippleTuning`, `RippleHandle` are exported from the package.
|
|
43
|
+
|
|
44
|
+
## Parameters
|
|
45
|
+
|
|
46
|
+
Options passed to `attachRipple` or `update` (all optional except where noted):
|
|
47
|
+
|
|
48
|
+
| Option | Type | Default | Description |
|
|
49
|
+
|--------|------|---------|-------------|
|
|
50
|
+
| `scope` | `string` \| `HTMLElement` | `document.body` | Element whose box clips the ripple and capture. |
|
|
51
|
+
| `amplitude` | `number` | `3` | Displacement strength of the wave. |
|
|
52
|
+
| `frequency` | `number` | `0.018` | Spatial frequency of the ripple rings. |
|
|
53
|
+
| `speed` | `number` | `300` | How fast the wave propagates. |
|
|
54
|
+
| `damping` | `number` | `0.025` | Ring falloff behind the wave front. |
|
|
55
|
+
| `decay` | `number` | `1.2` | How quickly the effect fades over time. |
|
|
56
|
+
| `duration` | `number` (ms) | `3500` | Max duration of the animation. |
|
|
57
|
+
| `chromatic` | `boolean` | `false` | Chromatic aberration on the displaced image. |
|
|
58
|
+
| `chromaticIntensity` | `number` | `0.4` | Strength when `chromatic` is true. |
|
|
59
|
+
| `shimmer` | `string` \| `false` | `false` | OKLCH color string for the shimmer pass, or `false` to disable. |
|
|
60
|
+
| `shimmerWidth` | `number` | `1` | Width of the shimmer band. |
|
|
61
|
+
| `shimmerDuration` | `number` (ms) | `2600` | Shimmer timing relative to the ripple. |
|
|
62
|
+
| `shimmerGlowColor` | `string` | — | Optional OKLCH override for glow highlights (uses shimmer color when omitted). |
|
|
63
|
+
|
|
64
|
+
## Contributing
|
|
65
|
+
|
|
66
|
+
Issues and pull requests are welcome in [GitHub Issues](https://github.com/Arman-Luthra/ripppl/issues).
|
|
67
|
+
|
|
68
|
+
Clone the repo, install dependencies, and run the demo or build the library:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/Arman-Luthra/ripppl.git
|
|
72
|
+
cd ripppl
|
|
73
|
+
npm install
|
|
74
|
+
npm run dev
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run build
|
|
79
|
+
```
|
|
31
80
|
|
|
32
|
-
|
|
81
|
+
Please keep changes focused and match existing style. For larger changes, open an issue first so the direction is agreed.
|
|
33
82
|
|
|
34
83
|
## License
|
|
35
84
|
|
|
@@ -26,4 +26,4 @@ export type RippleHandle = {
|
|
|
26
26
|
type TriggerInput = string | HTMLElement | NodeListOf<HTMLElement> | HTMLElement[];
|
|
27
27
|
export declare function attachRipple(trigger: TriggerInput, options?: RippleOptions): RippleHandle;
|
|
28
28
|
export {};
|
|
29
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=ripppl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ripppl.d.ts","sourceRoot":"","sources":["../src/ripppl.ts"],"names":[],"mappings":"AAwFA,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CAC9B,CAAC;AAgBF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,KAAK,YAAY,GACb,MAAM,GACN,WAAW,GACX,UAAU,CAAC,WAAW,CAAC,GACvB,WAAW,EAAE,CAAC;AA0JlB,wBAAgB,YAAY,CAC1B,OAAO,EAAE,YAAY,EACrB,OAAO,GAAE,aAAkB,GAC1B,YAAY,CAuWd"}
|
|
@@ -700,7 +700,7 @@ function Be(d, f = {}) {
|
|
|
700
700
|
};
|
|
701
701
|
let U = ie();
|
|
702
702
|
const M = document.createElement("canvas");
|
|
703
|
-
if (M.setAttribute("data-
|
|
703
|
+
if (M.setAttribute("data-ripppl-overlay", ""), T)
|
|
704
704
|
M.style.cssText = "position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:2147483647;";
|
|
705
705
|
else {
|
|
706
706
|
getComputedStyle(r).position === "static" && (r.style.position = "relative");
|
|
@@ -749,7 +749,7 @@ function Be(d, f = {}) {
|
|
|
749
749
|
if (!(V || Y)) {
|
|
750
750
|
V = !0, se();
|
|
751
751
|
try {
|
|
752
|
-
const o = devicePixelRatio || 1, _ = innerWidth, D = innerHeight, W = (ee) => !(ee instanceof Element && ee.hasAttribute("data-
|
|
752
|
+
const o = devicePixelRatio || 1, _ = innerWidth, D = innerHeight, W = (ee) => !(ee instanceof Element && ee.hasAttribute("data-ripppl-overlay")), F = Math.round(_ * o), we = Math.round(D * o), be = await De.toPng(document.documentElement, {
|
|
753
753
|
width: F,
|
|
754
754
|
height: we,
|
|
755
755
|
style: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripppl",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Ripple displacement
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Ripple displacement using WebGL over the DOM",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ripple",
|
|
7
7
|
"webgl",
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
"author": "Arman Luthra",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/Arman-Luthra/
|
|
17
|
+
"url": "git+https://github.com/Arman-Luthra/ripppl.git"
|
|
18
18
|
},
|
|
19
19
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/Arman-Luthra/
|
|
20
|
+
"url": "https://github.com/Arman-Luthra/ripppl/issues"
|
|
21
21
|
},
|
|
22
|
-
"homepage": "https://github.com/Arman-Luthra/
|
|
22
|
+
"homepage": "https://github.com/Arman-Luthra/ripppl#readme",
|
|
23
23
|
"type": "module",
|
|
24
|
-
"main": "./dist/
|
|
25
|
-
"module": "./dist/
|
|
26
|
-
"types": "./dist/
|
|
24
|
+
"main": "./dist/ripppl.js",
|
|
25
|
+
"module": "./dist/ripppl.js",
|
|
26
|
+
"types": "./dist/ripppl.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"types": "./dist/
|
|
30
|
-
"import": "./dist/
|
|
31
|
-
"default": "./dist/
|
|
29
|
+
"types": "./dist/ripppl.d.ts",
|
|
30
|
+
"import": "./dist/ripppl.js",
|
|
31
|
+
"default": "./dist/ripppl.js"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
package/dist/ripyl.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ripyl.d.ts","sourceRoot":"","sources":["../src/ripyl.ts"],"names":[],"mappings":"AAwFA,MA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