shaders 2.2.4 → 2.2.8
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/dist/core/Stretch-C8iYAgNS.js +104 -0
- package/dist/core/index.js +1130 -1124
- package/dist/core/renderer.d.ts +26 -0
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/Stretch/index.d.ts +45 -0
- package/dist/core/shaders/Stretch/index.d.ts.map +1 -0
- package/dist/core/shaders/Stretch/index.js +8 -0
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/TiltShift/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/core/utilities/uvTransform.d.ts +1 -1
- package/dist/core/utilities/uvTransform.d.ts.map +1 -1
- package/dist/react/components/Stretch.d.ts +3 -1
- package/dist/react/components/Stretch.d.ts.map +1 -1
- package/dist/react/index.cjs +225 -225
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +12502 -12272
- package/dist/react/utils/generatePresetCode.cjs +7 -7
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +13 -0
- package/dist/registry.js +158 -0
- package/dist/svelte/components/Stretch.svelte.d.ts +4 -2
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +14021 -13833
- package/dist/svelte/utils/generatePresetCode.js +13 -0
- package/dist/vue/components/Stretch.vue.d.ts +57 -0
- package/dist/vue/components/Stretch.vue.d.ts.map +1 -0
- package/dist/vue/{generatePresetCode-D4V6rBae.js → generatePresetCode-DoYZnbEH.js} +13 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +12577 -12373
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +1 -1
- package/package.json +6 -1
- /package/dist/core/{Swirl-BoveqtNV.js → Swirl-BpMwkNcm.js} +0 -0
- /package/dist/core/{TiltShift-D53azmRe.js → TiltShift-D31nakFq.js} +0 -0
- /package/dist/core/{Tritone-Cg1rX-hL.js → Tritone-Dx48G3b1.js} +0 -0
- /package/dist/core/{Twirl-raO5pe5X.js → Twirl-ng6pwyl2.js} +0 -0
- /package/dist/core/{Vibrance-DtekSkcz.js → Vibrance-D0ArL0qp.js} +0 -0
- /package/dist/core/{WaveDistortion-C65qO_cZ.js → WaveDistortion-DGKrpUdb.js} +0 -0
- /package/dist/core/{ZoomBlur-B97ZjhXe.js → ZoomBlur-uQyy5yko.js} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { _ as S, a as U, k as _, m as A } from "./three.tsl-BqgDcRt9.js";
|
|
2
|
+
import { t as E } from "./edges-B-tVdqcI.js";
|
|
3
|
+
import { a as F, o as R } from "./transformations-DBjTkQ5b.js";
|
|
4
|
+
A();
|
|
5
|
+
const W = {
|
|
6
|
+
name: "Stretch",
|
|
7
|
+
category: "Distortions",
|
|
8
|
+
description: "Stretch content towards a direction from a center point",
|
|
9
|
+
requiresRTT: !0,
|
|
10
|
+
requiresChild: !0,
|
|
11
|
+
props: {
|
|
12
|
+
center: {
|
|
13
|
+
default: {
|
|
14
|
+
x: 0.5,
|
|
15
|
+
y: 0.5
|
|
16
|
+
},
|
|
17
|
+
transform: R,
|
|
18
|
+
description: "The center point of the stretch effect",
|
|
19
|
+
ui: {
|
|
20
|
+
type: "position",
|
|
21
|
+
label: "Center"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
strength: {
|
|
25
|
+
default: 1,
|
|
26
|
+
description: "The intensity of the stretch effect",
|
|
27
|
+
ui: {
|
|
28
|
+
type: "range",
|
|
29
|
+
min: 0,
|
|
30
|
+
max: 1,
|
|
31
|
+
step: 0.01,
|
|
32
|
+
label: "Strength"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
angle: {
|
|
36
|
+
default: 0,
|
|
37
|
+
description: "The direction of the stretch in degrees",
|
|
38
|
+
ui: {
|
|
39
|
+
type: "range",
|
|
40
|
+
min: 0,
|
|
41
|
+
max: 360,
|
|
42
|
+
step: 1,
|
|
43
|
+
label: "Angle"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
falloff: {
|
|
47
|
+
default: 0,
|
|
48
|
+
description: "Controls the sharpness of the transition (0 = sharp edge, 1 = gradual transition)",
|
|
49
|
+
ui: {
|
|
50
|
+
type: "range",
|
|
51
|
+
min: 0,
|
|
52
|
+
max: 1,
|
|
53
|
+
step: 0.01,
|
|
54
|
+
label: "Falloff"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
edges: {
|
|
58
|
+
default: "stretch",
|
|
59
|
+
description: "How to handle edges when distortion pushes content out of bounds",
|
|
60
|
+
transform: F,
|
|
61
|
+
ui: {
|
|
62
|
+
type: "select",
|
|
63
|
+
options: [
|
|
64
|
+
{
|
|
65
|
+
label: "Stretch",
|
|
66
|
+
value: "stretch"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "Transparent",
|
|
70
|
+
value: "transparent"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Mirror",
|
|
74
|
+
value: "mirror"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "Wrap",
|
|
78
|
+
value: "wrap"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
label: "Edges"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
uvTransformNode: ({ uv: t, uniforms: n, viewportSize: f }) => {
|
|
86
|
+
const { vec2: e, float: o, sin: u, cos: p } = _, c = f.x.div(f.y), r = e(t.x.mul(c), t.y), m = e(n.center.uniform.x.mul(c), n.center.uniform.y.oneMinus()), h = r.sub(m), s = n.angle.uniform.mul(Math.PI / 180), a = e(p(s), u(s)), i = h.dot(a), g = h.sub(a.mul(i)), v = n.falloff.uniform, x = S(o(1e-3), o(75), v), l = U(i.div(x), o(0), o(1)), d = n.strength.uniform.mul(o(100)), b = o(1).add(d.mul(l)), T = i.div(b), V = a.mul(T).add(g), y = m.add(V);
|
|
87
|
+
return e(y.x.div(c), y.y);
|
|
88
|
+
},
|
|
89
|
+
fragmentNode: ({ uniforms: t, childNode: n, onCleanup: f }) => {
|
|
90
|
+
const { vec2: e, vec4: o, screenUV: u, viewportSize: p, convertToTexture: c, float: r, sin: m, cos: h } = _;
|
|
91
|
+
if (!n) return o(0, 0, 0, 0);
|
|
92
|
+
const s = c(n);
|
|
93
|
+
f(() => {
|
|
94
|
+
s?.renderTarget?.dispose && s.renderTarget.dispose();
|
|
95
|
+
});
|
|
96
|
+
const a = p.x.div(p.y), i = e(u.x.mul(a), u.y), g = e(t.center.uniform.x.mul(a), t.center.uniform.y.oneMinus()), v = i.sub(g), x = t.angle.uniform.mul(Math.PI / 180), l = e(h(x), m(x)), d = v.dot(l), b = l.mul(d), T = v.sub(b), V = t.falloff.uniform, y = S(r(1e-3), r(75), V), C = U(d.div(y), r(0), r(1)), j = t.strength.uniform.mul(r(100)), w = r(1).add(j.mul(C)), D = d.div(w), k = l.mul(D).add(T), M = g.add(k), P = e(M.x.div(a), M.y);
|
|
97
|
+
return E(P, s.sample(P), s, t.edges.uniform);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var N = W;
|
|
101
|
+
export {
|
|
102
|
+
W as n,
|
|
103
|
+
N as t
|
|
104
|
+
};
|