matrix-rain-webgpu 1.0.0-beta.1 → 1.0.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/README.md +3 -1
- package/dist/index.js +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# matrix-rain-webgpu
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/matrix-rain-webgpu)
|
|
4
|
+
[](https://github.com/chicio/matrix-rain-webgpu/actions/workflows/ci.yml)
|
|
3
5
|
[](https://github.com/chicio/matrix-rain-webgpu/actions/workflows/deploy.yml)
|
|
4
6
|
|
|
5
7
|
> A Matrix-style "digital rain" background effect for React, rendered on the GPU with WebGPU via [TypeGPU](https://docs.swmansion.com/TypeGPU/). GPU-driven simulation, signed-distance-field glyphs, depth parallax, bloom, and a CRT post-process.
|
|
@@ -79,4 +81,4 @@ npm --prefix docs run dev
|
|
|
79
81
|
|
|
80
82
|
## Author
|
|
81
83
|
|
|
82
|
-
Built by [Fabrizio Duroni](https://www.fabrizioduroni.it). If you enjoy it, a visit to the site is the best way to support the work. Also don't
|
|
84
|
+
Built by [Fabrizio Duroni](https://www.fabrizioduroni.it). If you enjoy it, a visit to the site is the best way to support the work. Also don't forget :star: to star this repository :star:.
|
package/dist/index.js
CHANGED
|
@@ -3060,6 +3060,17 @@ function X(i) {
|
|
|
3060
3060
|
c.current = i;
|
|
3061
3061
|
let [l, u] = r(0), d = n(0), f = n(null), p = n(!1);
|
|
3062
3062
|
t(() => {
|
|
3063
|
+
let e = () => {
|
|
3064
|
+
if (document.visibilityState !== "visible") return;
|
|
3065
|
+
let e = c.current.ctxRef.current;
|
|
3066
|
+
e && e.configure({
|
|
3067
|
+
device: a.device,
|
|
3068
|
+
format: navigator.gpu.getPreferredCanvasFormat(),
|
|
3069
|
+
alphaMode: "premultiplied"
|
|
3070
|
+
});
|
|
3071
|
+
};
|
|
3072
|
+
return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
|
|
3073
|
+
}, [a]), t(() => {
|
|
3063
3074
|
let e = !1;
|
|
3064
3075
|
return x().then((t) => {
|
|
3065
3076
|
e || (f.current = t);
|
|
@@ -3194,11 +3205,7 @@ function de(e) {
|
|
|
3194
3205
|
r,
|
|
3195
3206
|
i,
|
|
3196
3207
|
a
|
|
3197
|
-
]),
|
|
3198
|
-
n.status === "resolved" && n.value.device.lost.then((e) => {
|
|
3199
|
-
console.warn("[matrix-rain] GPUDevice lost:", e.reason, e.message);
|
|
3200
|
-
});
|
|
3201
|
-
}, [n]), r === "resolved" ? /* @__PURE__ */ p(fe, { ...e }) : null;
|
|
3208
|
+
]), r === "resolved" ? /* @__PURE__ */ p(fe, { ...e }) : null;
|
|
3202
3209
|
}
|
|
3203
3210
|
function fe(e) {
|
|
3204
3211
|
let { ref: t, ctxRef: n } = i({
|