shaders 2.5.102 → 2.5.104
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/Fog-DhFHErOx.js +674 -0
- package/dist/core/Halftone-BUCDTTAU.js +287 -0
- package/dist/core/Smoke-LIDjCv7f.js +629 -0
- package/dist/core/SmokeFill-ChSIfTxW.js +641 -0
- package/dist/core/{VideoTexture-DnHIs4pp.js → VideoTexture-SWLe5c3m.js} +1 -1
- package/dist/core/{WebcamTexture-XBDo2kgN.js → WebcamTexture-cXPyEumA.js} +1 -1
- package/dist/core/index.js +73 -70
- package/dist/core/registry.js +72 -69
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/core/shaderRegistry-CVhdTDhR.js +252 -0
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/Fog/index.d.ts +78 -0
- package/dist/core/shaders/Fog/index.d.ts.map +1 -0
- package/dist/core/shaders/Fog/index.js +4 -0
- package/dist/core/shaders/Form3D/index.js +1 -1
- package/dist/core/shaders/Glass/index.js +1 -1
- package/dist/core/shaders/GlassTiles/index.js +1 -1
- package/dist/core/shaders/Glitch/index.js +1 -1
- package/dist/core/shaders/Glow/index.js +1 -1
- package/dist/core/shaders/Godrays/index.js +1 -1
- package/dist/core/shaders/Grayscale/index.js +1 -1
- package/dist/core/shaders/Grid/index.js +1 -1
- package/dist/core/shaders/GridDistortion/index.js +1 -1
- package/dist/core/shaders/Group/index.js +1 -1
- package/dist/core/shaders/Halftone/index.d.ts +76 -4
- package/dist/core/shaders/Halftone/index.d.ts.map +1 -1
- package/dist/core/shaders/Halftone/index.js +2 -1
- package/dist/core/shaders/HexGrid/index.js +1 -1
- package/dist/core/shaders/HueShift/index.js +1 -1
- package/dist/core/shaders/ImageTexture/index.js +1 -1
- package/dist/core/shaders/Invert/index.js +1 -1
- package/dist/core/shaders/Kaleidoscope/index.js +1 -1
- package/dist/core/shaders/LensFlare/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.js +1 -1
- package/dist/core/shaders/LinearGradient/index.js +1 -1
- package/dist/core/shaders/Liquify/index.js +1 -1
- package/dist/core/shaders/Mirror/index.js +1 -1
- package/dist/core/shaders/MultiPointGradient/index.js +1 -1
- package/dist/core/shaders/Neon/index.js +1 -1
- package/dist/core/shaders/Paper/index.js +1 -1
- package/dist/core/shaders/Perspective/index.js +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/Plasma/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +1 -1
- package/dist/core/shaders/Polygon/index.js +1 -1
- package/dist/core/shaders/Posterize/index.js +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +1 -1
- package/dist/core/shaders/RadialGradient/index.js +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
- package/dist/core/shaders/Ring/index.js +1 -1
- package/dist/core/shaders/Ripples/index.js +1 -1
- package/dist/core/shaders/RoundedRect/index.js +1 -1
- package/dist/core/shaders/Saturation/index.js +1 -1
- package/dist/core/shaders/Sharpness/index.js +1 -1
- package/dist/core/shaders/Shatter/index.js +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +1 -1
- package/dist/core/shaders/SineWave/index.js +1 -1
- package/dist/core/shaders/Smoke/index.d.ts +113 -0
- package/dist/core/shaders/Smoke/index.d.ts.map +1 -0
- package/dist/core/shaders/Smoke/index.js +4 -0
- package/dist/core/shaders/SmokeFill/index.d.ts +145 -0
- package/dist/core/shaders/SmokeFill/index.d.ts.map +1 -0
- package/dist/core/shaders/SmokeFill/index.js +5 -0
- package/dist/core/shaders/Solarize/index.js +1 -1
- package/dist/core/shaders/SolidColor/index.js +1 -1
- package/dist/core/shaders/Spherize/index.js +1 -1
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Star/index.js +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Stripes/index.js +1 -1
- package/dist/core/shaders/StudioBackground/index.js +1 -1
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/TiltShift/index.js +1 -1
- package/dist/core/shaders/Tint/index.js +1 -1
- package/dist/core/shaders/Trapezoid/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Truchet/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/VHS/index.js +1 -1
- package/dist/core/shaders/Vesica/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/VideoTexture/index.js +2 -2
- package/dist/core/shaders/Vignette/index.js +1 -1
- package/dist/core/shaders/Voronoi/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/Weave/index.js +1 -1
- package/dist/core/shaders/WebcamTexture/index.js +2 -2
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/js/createShader.js +1 -1
- package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.js +79 -1
- package/dist/react/Fog.js +223 -0
- package/dist/react/Preview.js +3 -0
- package/dist/react/Shader.js +1 -1
- package/dist/react/Smoke.js +223 -0
- package/dist/react/SmokeFill.js +223 -0
- package/dist/react/components/Fog.d.ts +31 -0
- package/dist/react/components/Fog.d.ts.map +1 -0
- package/dist/react/components/Halftone.d.ts +7 -2
- package/dist/react/components/Halftone.d.ts.map +1 -1
- package/dist/react/components/Smoke.d.ts +33 -0
- package/dist/react/components/Smoke.d.ts.map +1 -0
- package/dist/react/components/SmokeFill.d.ts +34 -0
- package/dist/react/components/SmokeFill.d.ts.map +1 -0
- package/dist/react/engine/Preview.d.ts.map +1 -1
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +4 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +79 -1
- package/dist/registry.js +1559 -18
- package/dist/solid/components/Fog.d.ts +28 -0
- package/dist/solid/components/Fog.d.ts.map +1 -0
- package/dist/solid/components/Fog.js +228 -0
- package/dist/solid/components/Halftone.d.ts +7 -2
- package/dist/solid/components/Halftone.d.ts.map +1 -1
- package/dist/solid/components/Smoke.d.ts +30 -0
- package/dist/solid/components/Smoke.d.ts.map +1 -0
- package/dist/solid/components/Smoke.js +228 -0
- package/dist/solid/components/SmokeFill.d.ts +31 -0
- package/dist/solid/components/SmokeFill.d.ts.map +1 -0
- package/dist/solid/components/SmokeFill.js +228 -0
- package/dist/solid/engine/Preview.d.ts.map +1 -1
- package/dist/solid/engine/Preview.js +162 -156
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/solid/index.d.ts +3 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +144 -138
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +79 -1
- package/dist/svelte/components/Fog.svelte.d.ts +19 -0
- package/dist/svelte/components/Halftone.svelte.d.ts +6 -1
- package/dist/svelte/components/Smoke.svelte.d.ts +20 -0
- package/dist/svelte/components/SmokeFill.svelte.d.ts +21 -0
- package/dist/svelte/{generatePresetCode-BygAdFRo.js → generatePresetCode-DR_OAIL7.js} +79 -1
- package/dist/svelte/index.d.ts +3 -0
- package/dist/svelte/index.js +1151 -551
- package/dist/svelte/source/components/Fog.svelte +325 -0
- package/dist/svelte/source/components/Halftone.svelte +6 -1
- package/dist/svelte/source/components/Smoke.svelte +326 -0
- package/dist/svelte/source/components/SmokeFill.svelte +327 -0
- package/dist/svelte/source/engine/Preview.svelte +6 -0
- package/dist/svelte/source/index.js +3 -0
- package/dist/svelte/utils/generatePresetCode.js +1 -1
- package/dist/vue/Fog.js +3 -0
- package/dist/vue/Fog.vue_vue_type_script_setup_true_lang.js +222 -0
- package/dist/vue/Halftone.vue_vue_type_script_setup_true_lang.js +13 -2
- package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +6 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/vue/Smoke.js +3 -0
- package/dist/vue/Smoke.vue_vue_type_script_setup_true_lang.js +227 -0
- package/dist/vue/SmokeFill.js +3 -0
- package/dist/vue/SmokeFill.vue_vue_type_script_setup_true_lang.js +232 -0
- package/dist/vue/components/Fog.vue.d.ts +54 -0
- package/dist/vue/components/Fog.vue.d.ts.map +1 -0
- package/dist/vue/components/Halftone.vue.d.ts +6 -1
- package/dist/vue/components/Halftone.vue.d.ts.map +1 -1
- package/dist/vue/components/Smoke.vue.d.ts +55 -0
- package/dist/vue/components/Smoke.vue.d.ts.map +1 -0
- package/dist/vue/components/SmokeFill.vue.d.ts +56 -0
- package/dist/vue/components/SmokeFill.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +3 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +4 -1
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +79 -1
- package/package.json +25 -1
- package/dist/core/Halftone-BVL2oy37.js +0 -67
- package/dist/core/shaderRegistry-B6D8HKv7.js +0 -246
- /package/dist/core/{Form3D-rKpxb9t3.js → Form3D-DaPbLGUi.js} +0 -0
- /package/dist/core/{Glass-C04tCmBL.js → Glass-CpcmrDfm.js} +0 -0
- /package/dist/core/{GlassTiles-k1C4a4u8.js → GlassTiles-Dgh6nOaE.js} +0 -0
- /package/dist/core/{Glitch-DzPMkBu4.js → Glitch-BsbzLahF.js} +0 -0
- /package/dist/core/{Glow-BwaPYDRZ.js → Glow-Ft2x2QHL.js} +0 -0
- /package/dist/core/{Godrays-DAYmq-BP.js → Godrays-D1LINbut.js} +0 -0
- /package/dist/core/{Grayscale-lYKBBkGY.js → Grayscale-Ri-695Uh.js} +0 -0
- /package/dist/core/{Grid-BJ-nxN3i.js → Grid-BYSsAIEv.js} +0 -0
- /package/dist/core/{GridDistortion-DtaRNrTZ.js → GridDistortion-DWFGD8ya.js} +0 -0
- /package/dist/core/{Group-DpozigtX.js → Group-CkhjTW59.js} +0 -0
- /package/dist/core/{HexGrid-D-EmQ4kI.js → HexGrid-BUiDrehv.js} +0 -0
- /package/dist/core/{HueShift-D9K0ynaS.js → HueShift-BtGVMu7q.js} +0 -0
- /package/dist/core/{ImageTexture-CArkZMfh.js → ImageTexture-CrX_9-f0.js} +0 -0
- /package/dist/core/{Invert-DCnwo_Xq.js → Invert-azYrcDMi.js} +0 -0
- /package/dist/core/{Kaleidoscope-BytHro3k.js → Kaleidoscope-CFWtKisp.js} +0 -0
- /package/dist/core/{LensFlare-B0vv4x97.js → LensFlare-ttrXgfea.js} +0 -0
- /package/dist/core/{LinearBlur-BFewxPjV.js → LinearBlur-By2aD8OO.js} +0 -0
- /package/dist/core/{LinearGradient-BKUf_u7r.js → LinearGradient-CM02z32l.js} +0 -0
- /package/dist/core/{Liquify-cE5dxrfh.js → Liquify-CyXo6vAH.js} +0 -0
- /package/dist/core/{Mirror-DIle92J8.js → Mirror-B7XmfGdw.js} +0 -0
- /package/dist/core/{MultiPointGradient-DDwac_mm.js → MultiPointGradient-8zGSIM4U.js} +0 -0
- /package/dist/core/{Neon-Dg8UfC7P.js → Neon-C1JlexhM.js} +0 -0
- /package/dist/core/{Paper-bMSMCeYK.js → Paper-B08rxNys.js} +0 -0
- /package/dist/core/{Perspective-BmfvQV6W.js → Perspective-BN_OpTZq.js} +0 -0
- /package/dist/core/{Pixelate-Dl26r6IT.js → Pixelate-dxPAFCRu.js} +0 -0
- /package/dist/core/{Plasma-CJWS1TvX.js → Plasma-DGCw0cd7.js} +0 -0
- /package/dist/core/{PolarCoordinates-lq6K4WBm.js → PolarCoordinates-CMYCFT4S.js} +0 -0
- /package/dist/core/{Polygon-DRCs3CYs.js → Polygon-CsCOt5YE.js} +0 -0
- /package/dist/core/{Posterize-BjH7Zscm.js → Posterize-Blv9pzPT.js} +0 -0
- /package/dist/core/{ProgressiveBlur-B8xwWyTM.js → ProgressiveBlur-Cx6eR7o9.js} +0 -0
- /package/dist/core/{RadialGradient-DiGFPgrn.js → RadialGradient-De0gtdh3.js} +0 -0
- /package/dist/core/{RectangularCoordinates-COkNDxi0.js → RectangularCoordinates-8Sa2GaDy.js} +0 -0
- /package/dist/core/{Ring-QApyKPzE.js → Ring-kHH-DIDQ.js} +0 -0
- /package/dist/core/{Ripples-C8Q17Hvz.js → Ripples-Bf6Zwg6X.js} +0 -0
- /package/dist/core/{RoundedRect-Ca9af9xe.js → RoundedRect-B0sWh2BN.js} +0 -0
- /package/dist/core/{Saturation-CgDaiq6n.js → Saturation-CB19kOXg.js} +0 -0
- /package/dist/core/{Sharpness-CRXT0D30.js → Sharpness-CQOboeqy.js} +0 -0
- /package/dist/core/{Shatter-BssZTRYJ.js → Shatter-BhK75BiG.js} +0 -0
- /package/dist/core/{SimplexNoise-KfTCAfpL.js → SimplexNoise-BcSgytjc.js} +0 -0
- /package/dist/core/{SineWave-Ckeap_YM.js → SineWave-VTNDSK_g.js} +0 -0
- /package/dist/core/{Solarize-DhtQYYpW.js → Solarize-CWDgSBiv.js} +0 -0
- /package/dist/core/{SolidColor-6yUkGybH.js → SolidColor-DhMdM3bE.js} +0 -0
- /package/dist/core/{Spherize-8LXrGGG_.js → Spherize-BZxwopX8.js} +0 -0
- /package/dist/core/{Spiral-Bs7uZrBr.js → Spiral-gpkw37l1.js} +0 -0
- /package/dist/core/{Star-DiXwnPGP.js → Star-WJAOZ5P5.js} +0 -0
- /package/dist/core/{Strands-DsAAVemq.js → Strands-DOthZNHt.js} +0 -0
- /package/dist/core/{Stretch-D7P2R5lV.js → Stretch--GV6hbru.js} +0 -0
- /package/dist/core/{Stripes-DF8agIiJ.js → Stripes-CFCXw1_N.js} +0 -0
- /package/dist/core/{StudioBackground-BFeNfwEu.js → StudioBackground-DJr-cxOL.js} +0 -0
- /package/dist/core/{Swirl-BwezrSAA.js → Swirl-By5FadQK.js} +0 -0
- /package/dist/core/{TiltShift-CI3FlfYk.js → TiltShift-Dh8wc9GG.js} +0 -0
- /package/dist/core/{Tint-BdXlqlzz.js → Tint-DaTx2HII.js} +0 -0
- /package/dist/core/{Trapezoid-BX_hmeZJ.js → Trapezoid-Co0sIA73.js} +0 -0
- /package/dist/core/{Tritone-BlJ7cchN.js → Tritone-C9Yx69Tw.js} +0 -0
- /package/dist/core/{Truchet-Bnn0fwbF.js → Truchet-CkFSkniR.js} +0 -0
- /package/dist/core/{Twirl-C5ijhqz1.js → Twirl-v8pLqUTN.js} +0 -0
- /package/dist/core/{VHS-CQJ1hV_D.js → VHS-mKd1QBBj.js} +0 -0
- /package/dist/core/{Vesica-DU0f85NG.js → Vesica-CxP7UD0a.js} +0 -0
- /package/dist/core/{Vibrance-CGvYDeds.js → Vibrance-WR5yQv_9.js} +0 -0
- /package/dist/core/{Vignette-BJaonUVL.js → Vignette-hAIKTi35.js} +0 -0
- /package/dist/core/{Voronoi-DZemzWA4.js → Voronoi-DOGmwUSK.js} +0 -0
- /package/dist/core/{WaveDistortion--Y-m667K.js → WaveDistortion-BGdgj3Iz.js} +0 -0
- /package/dist/core/{Weave-CtyohvHz.js → Weave-CIP_EUPa.js} +0 -0
- /package/dist/core/{ZoomBlur-BwkhsFRE.js → ZoomBlur-BuIVpHGG.js} +0 -0
- /package/dist/core/{browser-DTNngPey.js → browser-D8zonASQ.js} +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { a as transformColor, r as transformAngle } from "./transformations-B5lM6fYX.js";
|
|
2
|
+
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
3
|
+
import { convertToTexture, cos, dot, float, fract, length, max, mix, radians, screenUV, sin, smoothstep, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
4
|
+
var transformStyle = (value) => {
|
|
5
|
+
return value === "cmyk" ? 1 : 0;
|
|
6
|
+
};
|
|
7
|
+
const componentDefinition = {
|
|
8
|
+
name: "Halftone",
|
|
9
|
+
category: "Stylize",
|
|
10
|
+
description: "Halftone dot pattern effect for printing aesthetics",
|
|
11
|
+
requiresRTT: true,
|
|
12
|
+
requiresChild: true,
|
|
13
|
+
props: {
|
|
14
|
+
style: {
|
|
15
|
+
default: "classic",
|
|
16
|
+
transform: transformStyle,
|
|
17
|
+
compileTime: true,
|
|
18
|
+
description: "Halftone rendering style",
|
|
19
|
+
ui: {
|
|
20
|
+
type: "select",
|
|
21
|
+
options: [{
|
|
22
|
+
label: "Simple",
|
|
23
|
+
value: "classic"
|
|
24
|
+
}, {
|
|
25
|
+
label: "CMYK Print",
|
|
26
|
+
value: "cmyk"
|
|
27
|
+
}],
|
|
28
|
+
label: "Style",
|
|
29
|
+
group: "Effect"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
frequency: {
|
|
33
|
+
default: 100,
|
|
34
|
+
description: "Frequency of the halftone dots",
|
|
35
|
+
ui: {
|
|
36
|
+
type: ["range", "map"],
|
|
37
|
+
min: 10,
|
|
38
|
+
max: 300,
|
|
39
|
+
step: 1,
|
|
40
|
+
label: "Frequency",
|
|
41
|
+
group: "Effect"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
angle: {
|
|
45
|
+
default: 45,
|
|
46
|
+
transform: transformAngle,
|
|
47
|
+
description: "Rotation angle of the pattern (in degrees)",
|
|
48
|
+
ui: {
|
|
49
|
+
type: ["range", "map"],
|
|
50
|
+
min: 0,
|
|
51
|
+
max: 360,
|
|
52
|
+
step: 1,
|
|
53
|
+
label: "Angle",
|
|
54
|
+
group: "Effect",
|
|
55
|
+
condition: { style: "classic" }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
cyanAngle: {
|
|
59
|
+
default: 15,
|
|
60
|
+
transform: transformAngle,
|
|
61
|
+
description: "Screen angle for the cyan plate (in degrees)",
|
|
62
|
+
ui: {
|
|
63
|
+
type: ["range", "map"],
|
|
64
|
+
min: 0,
|
|
65
|
+
max: 360,
|
|
66
|
+
step: 1,
|
|
67
|
+
label: "Cyan Angle",
|
|
68
|
+
group: "Plate Angles",
|
|
69
|
+
condition: { style: "cmyk" }
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
magentaAngle: {
|
|
73
|
+
default: 75,
|
|
74
|
+
transform: transformAngle,
|
|
75
|
+
description: "Screen angle for the magenta plate (in degrees)",
|
|
76
|
+
ui: {
|
|
77
|
+
type: ["range", "map"],
|
|
78
|
+
min: 0,
|
|
79
|
+
max: 360,
|
|
80
|
+
step: 1,
|
|
81
|
+
label: "Magenta Angle",
|
|
82
|
+
group: "Plate Angles",
|
|
83
|
+
condition: { style: "cmyk" }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
yellowAngle: {
|
|
87
|
+
default: 0,
|
|
88
|
+
transform: transformAngle,
|
|
89
|
+
description: "Screen angle for the yellow plate (in degrees)",
|
|
90
|
+
ui: {
|
|
91
|
+
type: ["range", "map"],
|
|
92
|
+
min: 0,
|
|
93
|
+
max: 360,
|
|
94
|
+
step: 1,
|
|
95
|
+
label: "Yellow Angle",
|
|
96
|
+
group: "Plate Angles",
|
|
97
|
+
condition: { style: "cmyk" }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
blackAngle: {
|
|
101
|
+
default: 45,
|
|
102
|
+
transform: transformAngle,
|
|
103
|
+
description: "Screen angle for the black plate (in degrees)",
|
|
104
|
+
ui: {
|
|
105
|
+
type: ["range", "map"],
|
|
106
|
+
min: 0,
|
|
107
|
+
max: 360,
|
|
108
|
+
step: 1,
|
|
109
|
+
label: "Black Angle",
|
|
110
|
+
group: "Plate Angles",
|
|
111
|
+
condition: { style: "cmyk" }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
misprint: {
|
|
115
|
+
default: 0,
|
|
116
|
+
description: "Simulated mis-registration between plates. Plates are offset around the misprint angle, producing colour fringing at the edges of inked regions.",
|
|
117
|
+
ui: {
|
|
118
|
+
type: ["range", "map"],
|
|
119
|
+
min: 0,
|
|
120
|
+
max: .01,
|
|
121
|
+
step: 5e-4,
|
|
122
|
+
label: "Misprint",
|
|
123
|
+
group: "Effect",
|
|
124
|
+
condition: { style: "cmyk" }
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
misprintAngle: {
|
|
128
|
+
default: 0,
|
|
129
|
+
transform: transformAngle,
|
|
130
|
+
description: "Direction the plates drift apart. Rotating this rotates the colour-fringing pattern.",
|
|
131
|
+
ui: {
|
|
132
|
+
type: ["range", "map"],
|
|
133
|
+
min: 0,
|
|
134
|
+
max: 360,
|
|
135
|
+
step: 1,
|
|
136
|
+
label: "Misprint Angle",
|
|
137
|
+
group: "Effect",
|
|
138
|
+
condition: { style: "cmyk" }
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
paperColor: {
|
|
142
|
+
default: "#ffffff",
|
|
143
|
+
transform: transformColor,
|
|
144
|
+
description: "Paper/substrate color shown where no ink lands",
|
|
145
|
+
ui: {
|
|
146
|
+
type: "color",
|
|
147
|
+
label: "Paper",
|
|
148
|
+
group: "Inks",
|
|
149
|
+
condition: { style: "cmyk" }
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
cyanColor: {
|
|
153
|
+
default: "#00ffff",
|
|
154
|
+
transform: transformColor,
|
|
155
|
+
description: "Cyan ink color",
|
|
156
|
+
ui: {
|
|
157
|
+
type: "color",
|
|
158
|
+
label: "Cyan",
|
|
159
|
+
group: "Inks",
|
|
160
|
+
condition: { style: "cmyk" }
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
magentaColor: {
|
|
164
|
+
default: "#ff00ff",
|
|
165
|
+
transform: transformColor,
|
|
166
|
+
description: "Magenta ink color",
|
|
167
|
+
ui: {
|
|
168
|
+
type: "color",
|
|
169
|
+
label: "Magenta",
|
|
170
|
+
group: "Inks",
|
|
171
|
+
condition: { style: "cmyk" }
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
yellowColor: {
|
|
175
|
+
default: "#ffff00",
|
|
176
|
+
transform: transformColor,
|
|
177
|
+
description: "Yellow ink color",
|
|
178
|
+
ui: {
|
|
179
|
+
type: "color",
|
|
180
|
+
label: "Yellow",
|
|
181
|
+
group: "Inks",
|
|
182
|
+
condition: { style: "cmyk" }
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
blackColor: {
|
|
186
|
+
default: "#000000",
|
|
187
|
+
transform: transformColor,
|
|
188
|
+
description: "Black (key) ink color",
|
|
189
|
+
ui: {
|
|
190
|
+
type: "color",
|
|
191
|
+
label: "Black",
|
|
192
|
+
group: "Inks",
|
|
193
|
+
condition: { style: "cmyk" }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
198
|
+
if (!childNode) return vec4(0);
|
|
199
|
+
const frequency = uniforms.frequency.uniform;
|
|
200
|
+
const smoothness = float(.1);
|
|
201
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
202
|
+
const aspectUV = vec2(screenUV.x.mul(aspect), screenUV.y);
|
|
203
|
+
const rotateUV = (uv$1, angleRad) => {
|
|
204
|
+
const c$1 = cos(angleRad);
|
|
205
|
+
const s = sin(angleRad);
|
|
206
|
+
return vec2(dot(uv$1, vec2(c$1, s.negate())), dot(uv$1, vec2(s, c$1)));
|
|
207
|
+
};
|
|
208
|
+
const dotMask = (rotatedUV, intensity) => {
|
|
209
|
+
const dist = length(fract(rotatedUV.mul(frequency)).sub(.5));
|
|
210
|
+
const size = intensity.mul(.75).sub(smoothness);
|
|
211
|
+
return smoothstep(size.sub(smoothness), size.add(smoothness), dist).oneMinus();
|
|
212
|
+
};
|
|
213
|
+
if (uniforms.style.uniform.value === 0) {
|
|
214
|
+
const gridUV = fract(rotateUV(aspectUV, radians(uniforms.angle.uniform)).mul(frequency)).sub(.5);
|
|
215
|
+
const dotSize = dot(childNode.rgb, vec3(.299, .587, .114)).mul(.7).add(.15);
|
|
216
|
+
const dist = length(gridUV);
|
|
217
|
+
const dotPattern = smoothstep(dotSize.sub(smoothness), dotSize.add(smoothness), dist).oneMinus();
|
|
218
|
+
return vec4(childNode.rgb.mul(dotPattern), childNode.a.mul(dotPattern));
|
|
219
|
+
}
|
|
220
|
+
const childTexture = convertToTexture(childNode);
|
|
221
|
+
onCleanup(() => {
|
|
222
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
223
|
+
});
|
|
224
|
+
const misprint = uniforms.misprint.uniform;
|
|
225
|
+
const misprintAngleRad = radians(uniforms.misprintAngle.uniform);
|
|
226
|
+
const cAngleRad = radians(uniforms.cyanAngle.uniform);
|
|
227
|
+
const mAngleRad = radians(uniforms.magentaAngle.uniform);
|
|
228
|
+
const yAngleRad = radians(uniforms.yellowAngle.uniform);
|
|
229
|
+
const kAngleRad = radians(uniforms.blackAngle.uniform);
|
|
230
|
+
const plateOffset = (offsetAngleRad) => {
|
|
231
|
+
return vec2(cos(offsetAngleRad).mul(misprint), sin(offsetAngleRad).mul(misprint).div(aspect));
|
|
232
|
+
};
|
|
233
|
+
const cSampleUV = screenUV.add(plateOffset(misprintAngleRad));
|
|
234
|
+
const mSampleUV = screenUV.add(plateOffset(misprintAngleRad.add(radians(float(90)))));
|
|
235
|
+
const ySampleUV = screenUV.add(plateOffset(misprintAngleRad.add(radians(float(180)))));
|
|
236
|
+
const kSampleUV = screenUV.add(plateOffset(misprintAngleRad.add(radians(float(270)))));
|
|
237
|
+
const cSample = unpremultiplyAlpha(childTexture.sample(cSampleUV));
|
|
238
|
+
const mSample = unpremultiplyAlpha(childTexture.sample(mSampleUV));
|
|
239
|
+
const ySample = unpremultiplyAlpha(childTexture.sample(ySampleUV));
|
|
240
|
+
const kSample = unpremultiplyAlpha(childTexture.sample(kSampleUV));
|
|
241
|
+
const centerSample = unpremultiplyAlpha(childTexture.sample(screenUV));
|
|
242
|
+
const channelK = (s) => float(1).sub(max(max(s.r, s.g), s.b));
|
|
243
|
+
const channelC = (s) => {
|
|
244
|
+
const k$1 = channelK(s);
|
|
245
|
+
const invK = float(1).sub(k$1).max(float(1e-4));
|
|
246
|
+
return float(1).sub(s.r).sub(k$1).div(invK);
|
|
247
|
+
};
|
|
248
|
+
const channelM = (s) => {
|
|
249
|
+
const k$1 = channelK(s);
|
|
250
|
+
const invK = float(1).sub(k$1).max(float(1e-4));
|
|
251
|
+
return float(1).sub(s.g).sub(k$1).div(invK);
|
|
252
|
+
};
|
|
253
|
+
const channelY = (s) => {
|
|
254
|
+
const k$1 = channelK(s);
|
|
255
|
+
const invK = float(1).sub(k$1).max(float(1e-4));
|
|
256
|
+
return float(1).sub(s.b).sub(k$1).div(invK);
|
|
257
|
+
};
|
|
258
|
+
const c = channelC(cSample);
|
|
259
|
+
const m = channelM(mSample);
|
|
260
|
+
const y = channelY(ySample);
|
|
261
|
+
const k = channelK(kSample);
|
|
262
|
+
const cUV = rotateUV(aspectUV, cAngleRad);
|
|
263
|
+
const mUV = rotateUV(aspectUV, mAngleRad);
|
|
264
|
+
const yUV = rotateUV(aspectUV, yAngleRad);
|
|
265
|
+
const kUV = rotateUV(aspectUV, kAngleRad);
|
|
266
|
+
const cInk = dotMask(cUV, c);
|
|
267
|
+
const mInk = dotMask(mUV, m);
|
|
268
|
+
const yInk = dotMask(yUV, y);
|
|
269
|
+
const kInk = dotMask(kUV, k);
|
|
270
|
+
const paper = uniforms.paperColor.uniform;
|
|
271
|
+
const cyanCol = uniforms.cyanColor.uniform;
|
|
272
|
+
const magentaCol = uniforms.magentaColor.uniform;
|
|
273
|
+
const yellowCol = uniforms.yellowColor.uniform;
|
|
274
|
+
const blackCol = uniforms.blackColor.uniform;
|
|
275
|
+
const transmission = (inkColor, inkMask) => {
|
|
276
|
+
return mix(vec3(1, 1, 1), inkColor.rgb, inkMask.mul(inkColor.a));
|
|
277
|
+
};
|
|
278
|
+
let printed = paper.rgb;
|
|
279
|
+
printed = printed.mul(transmission(cyanCol, cInk));
|
|
280
|
+
printed = printed.mul(transmission(magentaCol, mInk));
|
|
281
|
+
printed = printed.mul(transmission(yellowCol, yInk));
|
|
282
|
+
printed = printed.mul(transmission(blackCol, kInk));
|
|
283
|
+
return vec4(printed, centerSample.a);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
var Halftone_default = componentDefinition;
|
|
287
|
+
export { componentDefinition as n, Halftone_default as t };
|