shaders 2.0.670 → 2.0.671

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.
@@ -2,10 +2,32 @@ import { ck as e } from "./index2.js";
2
2
  const t = {
3
3
  name: "FilmGrain",
4
4
  category: "Effects",
5
- props: {},
6
- fragmentNode: ({ childNode: t }) => {
7
- let { vec4: n } = e;
8
- return t || n(0);
5
+ props: {
6
+ strength: {
7
+ default: .5,
8
+ description: "Intensity of the film grain noise",
9
+ ui: {
10
+ type: "range",
11
+ min: 0,
12
+ max: 1,
13
+ step: .01,
14
+ label: "Strength"
15
+ }
16
+ },
17
+ animated: {
18
+ default: 0,
19
+ description: "Whether the noise should animate over time",
20
+ ui: {
21
+ type: "checkbox",
22
+ label: "Animated"
23
+ }
24
+ }
25
+ },
26
+ fragmentNode: ({ uniforms: t, childNode: n }) => {
27
+ let { vec2: r, vec4: i, float: a, screenUV: o, sin: s, dot: c, fract: l, timerLocal: u } = e;
28
+ if (!n) return console.error("You must pass a child component into the Film Noise shader."), i(0);
29
+ let d = t.strength.uniform, f = t.animated.uniform, p = n || i(0, 0, 0, 0), m = o, h = f.greaterThan(a(.5)).select(u(), a(0)), g = m.add(r(h.mul(a(.1)), h.mul(a(.13)))), _ = c(g, r(a(12.9898), a(78.233)).mul(a(2))), v = l(s(_).mul(a(43758.5453))), y = v.mul(a(2)).sub(a(1)), b = y.mul(d.mul(a(.1))), x = p.rgb.add(b);
30
+ return i(x, p.a);
9
31
  }
10
32
  };
11
33
  export { t };
@@ -9,7 +9,9 @@ var f = /* @__PURE__ */ r({
9
9
  id: {},
10
10
  maskSource: {},
11
11
  maskType: {},
12
- renderOrder: {}
12
+ renderOrder: {},
13
+ strength: {},
14
+ animated: {}
13
15
  }, {
14
16
  blendMode: "normal",
15
17
  renderOrder: 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shaders",
3
3
  "private": false,
4
- "version": "2.0.670",
4
+ "version": "2.0.671",
5
5
  "description": "Declarative shader components",
6
6
  "author": "Simon Le Marchant<https://github.com/marchantweb>",
7
7
  "homepage": "https://shaders.com/",