react-native-webrtc-kaleidoscope 2.3.0 → 2.5.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.
Files changed (110) hide show
  1. package/README.md +12 -3
  2. package/android/src/main/java/com/simiancraft/kaleidoscope/gpu/ShadersGenerated.kt +354 -0
  3. package/catalog/composites/clouds/clouds.thumb.webp +0 -0
  4. package/catalog/composites/corporate-blobs/corporate-blobs.thumb.webp +0 -0
  5. package/catalog/composites/fairy-cave/fairy-cave.thumb.webp +0 -0
  6. package/catalog/composites/fairy-grotto/fairy-grotto.thumb.webp +0 -0
  7. package/catalog/composites/fairy-hollow/fairy-hollow.thumb.webp +0 -0
  8. package/catalog/composites/nebula/nebula.thumb.webp +0 -0
  9. package/catalog/composites/observation-deck/observation-deck.thumb.webp +0 -0
  10. package/catalog/composites/simianlights/simianlights.thumb.webp +0 -0
  11. package/catalog/composites/underwater/underwater.thumb.webp +0 -0
  12. package/catalog/composites/wizard-tower/wizard-tower.thumb.webp +0 -0
  13. package/catalog/composites/wizard-tower-night/wizard-tower-night.thumb.webp +0 -0
  14. package/catalog/images/debug/debug-resolutions.thumb.webp +0 -0
  15. package/catalog/images/home/home-dark.thumb.webp +0 -0
  16. package/catalog/images/home/home-light.thumb.webp +0 -0
  17. package/catalog/images/nature/landscape-dark.thumb.webp +0 -0
  18. package/catalog/images/nature/landscape-light.thumb.webp +0 -0
  19. package/catalog/images/office/office-dark.thumb.webp +0 -0
  20. package/catalog/images/office/office-light.thumb.webp +0 -0
  21. package/catalog/images/sci-fi/sci-fi-light.thumb.webp +0 -0
  22. package/catalog/images/simiancraft/simiancraft-dark.thumb.webp +0 -0
  23. package/catalog/images/simiancraft/simiancraft-light.thumb.webp +0 -0
  24. package/catalog/images/underwater/oceanscape-dark.thumb.webp +0 -0
  25. package/catalog/shaders/aurora-silk/aurora-silk.form.tsx +35 -0
  26. package/catalog/shaders/aurora-silk/aurora-silk.frag +106 -0
  27. package/catalog/shaders/aurora-silk/aurora-silk.ts +92 -0
  28. package/catalog/shaders/halftone-waves/halftone-waves.form.tsx +35 -0
  29. package/catalog/shaders/halftone-waves/halftone-waves.frag +84 -0
  30. package/catalog/shaders/halftone-waves/halftone-waves.ts +100 -0
  31. package/catalog/shaders/index.ts +16 -0
  32. package/catalog/shaders/kaleidoscope/kaleidoscope.form.tsx +35 -0
  33. package/catalog/shaders/kaleidoscope/kaleidoscope.frag +93 -0
  34. package/catalog/shaders/kaleidoscope/kaleidoscope.ts +81 -0
  35. package/catalog/shaders/neo-memphis/neo-memphis.form.tsx +35 -0
  36. package/catalog/shaders/neo-memphis/neo-memphis.frag +152 -0
  37. package/catalog/shaders/neo-memphis/neo-memphis.ts +84 -0
  38. package/dist/catalog/composites/clouds/clouds.thumb.webp +0 -0
  39. package/dist/catalog/composites/corporate-blobs/corporate-blobs.thumb.webp +0 -0
  40. package/dist/catalog/composites/fairy-cave/fairy-cave.thumb.webp +0 -0
  41. package/dist/catalog/composites/fairy-grotto/fairy-grotto.thumb.webp +0 -0
  42. package/dist/catalog/composites/fairy-hollow/fairy-hollow.thumb.webp +0 -0
  43. package/dist/catalog/composites/nebula/nebula.thumb.webp +0 -0
  44. package/dist/catalog/composites/observation-deck/observation-deck.thumb.webp +0 -0
  45. package/dist/catalog/composites/simianlights/simianlights.thumb.webp +0 -0
  46. package/dist/catalog/composites/underwater/underwater.thumb.webp +0 -0
  47. package/dist/catalog/composites/wizard-tower/wizard-tower.thumb.webp +0 -0
  48. package/dist/catalog/composites/wizard-tower-night/wizard-tower-night.thumb.webp +0 -0
  49. package/dist/catalog/images/debug/debug-resolutions.thumb.webp +0 -0
  50. package/dist/catalog/images/home/home-dark.thumb.webp +0 -0
  51. package/dist/catalog/images/home/home-light.thumb.webp +0 -0
  52. package/dist/catalog/images/nature/landscape-dark.thumb.webp +0 -0
  53. package/dist/catalog/images/nature/landscape-light.thumb.webp +0 -0
  54. package/dist/catalog/images/office/office-dark.thumb.webp +0 -0
  55. package/dist/catalog/images/office/office-light.thumb.webp +0 -0
  56. package/dist/catalog/images/sci-fi/sci-fi-light.thumb.webp +0 -0
  57. package/dist/catalog/images/simiancraft/simiancraft-dark.thumb.webp +0 -0
  58. package/dist/catalog/images/simiancraft/simiancraft-light.thumb.webp +0 -0
  59. package/dist/catalog/images/underwater/oceanscape-dark.thumb.webp +0 -0
  60. package/dist/catalog/shaders/aurora-silk/aurora-silk.d.ts +26 -0
  61. package/dist/catalog/shaders/aurora-silk/aurora-silk.d.ts.map +1 -0
  62. package/dist/catalog/shaders/aurora-silk/aurora-silk.form.d.ts +3 -0
  63. package/dist/catalog/shaders/aurora-silk/aurora-silk.form.d.ts.map +1 -0
  64. package/dist/catalog/shaders/aurora-silk/aurora-silk.form.js +13 -0
  65. package/dist/catalog/shaders/aurora-silk/aurora-silk.form.js.map +1 -0
  66. package/dist/catalog/shaders/aurora-silk/aurora-silk.js +70 -0
  67. package/dist/catalog/shaders/aurora-silk/aurora-silk.js.map +1 -0
  68. package/dist/catalog/shaders/halftone-waves/halftone-waves.d.ts +26 -0
  69. package/dist/catalog/shaders/halftone-waves/halftone-waves.d.ts.map +1 -0
  70. package/dist/catalog/shaders/halftone-waves/halftone-waves.form.d.ts +3 -0
  71. package/dist/catalog/shaders/halftone-waves/halftone-waves.form.d.ts.map +1 -0
  72. package/dist/catalog/shaders/halftone-waves/halftone-waves.form.js +13 -0
  73. package/dist/catalog/shaders/halftone-waves/halftone-waves.form.js.map +1 -0
  74. package/dist/catalog/shaders/halftone-waves/halftone-waves.js +78 -0
  75. package/dist/catalog/shaders/halftone-waves/halftone-waves.js.map +1 -0
  76. package/dist/catalog/shaders/index.d.ts +16 -0
  77. package/dist/catalog/shaders/index.d.ts.map +1 -1
  78. package/dist/catalog/shaders/index.js +9 -1
  79. package/dist/catalog/shaders/index.js.map +1 -1
  80. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.d.ts +24 -0
  81. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.d.ts.map +1 -0
  82. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.form.d.ts +3 -0
  83. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.form.d.ts.map +1 -0
  84. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.form.js +14 -0
  85. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.form.js.map +1 -0
  86. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.js +61 -0
  87. package/dist/catalog/shaders/kaleidoscope/kaleidoscope.js.map +1 -0
  88. package/dist/catalog/shaders/neo-memphis/neo-memphis.d.ts +26 -0
  89. package/dist/catalog/shaders/neo-memphis/neo-memphis.d.ts.map +1 -0
  90. package/dist/catalog/shaders/neo-memphis/neo-memphis.form.d.ts +3 -0
  91. package/dist/catalog/shaders/neo-memphis/neo-memphis.form.d.ts.map +1 -0
  92. package/dist/catalog/shaders/neo-memphis/neo-memphis.form.js +13 -0
  93. package/dist/catalog/shaders/neo-memphis/neo-memphis.form.js.map +1 -0
  94. package/dist/catalog/shaders/neo-memphis/neo-memphis.js +62 -0
  95. package/dist/catalog/shaders/neo-memphis/neo-memphis.js.map +1 -0
  96. package/dist/web-driver/shaders.generated.d.ts +4 -0
  97. package/dist/web-driver/shaders.generated.d.ts.map +1 -1
  98. package/dist/web-driver/shaders.generated.js +351 -1
  99. package/dist/web-driver/shaders.generated.js.map +1 -1
  100. package/ios/KaleidoscopeModule/shaders/GENERATIVE.txt +4 -0
  101. package/ios/KaleidoscopeModule/shaders/SHADERS.txt +4 -0
  102. package/ios/KaleidoscopeModule/shaders/aurora-silk.metalsrc +51 -0
  103. package/ios/KaleidoscopeModule/shaders/halftone-waves.metalsrc +41 -0
  104. package/ios/KaleidoscopeModule/shaders/kaleidoscope.metalsrc +45 -0
  105. package/ios/KaleidoscopeModule/shaders/neo-memphis.metalsrc +181 -0
  106. package/package.json +36 -3
  107. package/tools/thumbnails/book-loader.ts +104 -0
  108. package/tools/thumbnails/make-thumbnails.ts +287 -0
  109. package/tools/thumbnails/office-fixture.webp +0 -0
  110. package/tools/thumbnails/render-page.ts +259 -0
@@ -1,9 +1,13 @@
1
1
  anamorphic-lensflare
2
+ aurora-silk
2
3
  clouds
3
4
  corporate-blobs
4
5
  fireflies
5
6
  godrays
7
+ halftone-waves
8
+ kaleidoscope
6
9
  light-beams-and-motes
7
10
  nebula
11
+ neo-memphis
8
12
  plasma
9
13
  simianlights
@@ -1,4 +1,5 @@
1
1
  anamorphic-lensflare.frag
2
+ aurora-silk.frag
2
3
  clouds.frag
3
4
  composite-blit.frag
4
5
  composite-blur.frag
@@ -9,8 +10,11 @@ composite-subject.frag
9
10
  corporate-blobs.frag
10
11
  fireflies.frag
11
12
  godrays.frag
13
+ halftone-waves.frag
14
+ kaleidoscope.frag
12
15
  light-beams-and-motes.frag
13
16
  nebula.frag
17
+ neo-memphis.frag
14
18
  passthrough.vert
15
19
  plasma.frag
16
20
  simianlights.frag
@@ -0,0 +1,51 @@
1
+ #include <metal_stdlib>
2
+ #include <simd/simd.h>
3
+
4
+ using namespace metal;
5
+
6
+ struct main0_out
7
+ {
8
+ float4 oColor [[color(0)]];
9
+ };
10
+
11
+ struct main0_in
12
+ {
13
+ float2 vUv [[user(locn0)]];
14
+ };
15
+
16
+ fragment main0_out main0(main0_in in [[stage_in]], constant float2& uResolution [[buffer(0)]], constant float& uAngle [[buffer(1)]], constant float& uTime [[buffer(2)]], constant float& uSpeed [[buffer(3)]], constant float3& uColorLow [[buffer(4)]], constant float3& uColorHigh [[buffer(5)]], constant float& uRibbons [[buffer(6)]], constant float& uCalm [[buffer(7)]], constant float& uSoftness [[buffer(8)]], constant float3& uRibbonColor [[buffer(9)]], constant float& uStyle [[buffer(10)]])
17
+ {
18
+ main0_out out = {};
19
+ float2 _80 = ((in.vUv * uResolution) - (uResolution * 0.5)) / float2(uResolution.y);
20
+ float _87 = cos(uAngle);
21
+ float _90 = sin(uAngle);
22
+ float2 _103 = float2x2(float2(_87, -_90), float2(_90, _87)) * _80;
23
+ float _109 = uTime * uSpeed;
24
+ float _112 = _103.y;
25
+ float _139 = fast::clamp(uRibbons, 0.0, 5.0);
26
+ float _149 = 1.0 - (uCalm * (1.0 - smoothstep(0.1500000059604644775390625, 0.62000000476837158203125, length(_80))));
27
+ float3 _364;
28
+ _364 = mix(uColorLow, uColorHigh, float3(fast::clamp(((_112 * 0.85000002384185791015625) + 0.5) + (0.039999999105930328369140625 * sin(_109 * 0.17000000178813934326171875)), 0.0, 1.0)));
29
+ float3 _298;
30
+ for (int _363 = 0; _363 < 5; _364 = _298, _363++)
31
+ {
32
+ float _165 = float(_363);
33
+ if (_165 >= _139)
34
+ {
35
+ break;
36
+ }
37
+ float _195 = _103.x;
38
+ float _204 = (_195 * 1.39999997615814208984375) + (_109 * (0.100000001490116119384765625 + (0.039999999105930328369140625 * _165)));
39
+ float _207 = _165 * 17.0;
40
+ float _319 = floor(_204);
41
+ float _321 = fract(_204);
42
+ float _247 = mix(0.0599999986588954925537109375, 0.1500000059604644775390625, fract(sin((_165 * 7.30000019073486328125) + 1.0) * 43758.546875));
43
+ float _255 = mix(0.008000000379979610443115234375, _247 * 1.60000002384185791015625, uSoftness);
44
+ float _267 = (1.0 - smoothstep(_247 - _255, _247 + _255, abs(_112 - ((((-0.4199999868869781494140625) + ((0.839999973773956298828125 * (_165 + 0.5)) / _139)) + (0.070000000298023223876953125 * sin((_109 * 0.189999997615814208984375) + (_165 * 1.7000000476837158203125)))) + (((mix(fract(sin(_319 + _207) * 43758.546875), fract(sin((_319 + 1.0) + _207) * 43758.546875), (_321 * _321) * (3.0 - (2.0 * _321))) - 0.5) * 0.5) + (0.100000001490116119384765625 * sin(((_195 * 2.2999999523162841796875) + (_109 * (0.2599999904632568359375 + (0.0599999986588954925537109375 * _165)))) + (_165 * 2.099999904632568359375)))))))) * _149;
45
+ float3 _277 = mix(uRibbonColor, uColorHigh, float3(_165 * 0.12000000476837158203125));
46
+ _298 = mix(mix(_364, _277, float3(_267 * 0.85000002384185791015625)), _364 + ((_277 * _267) * 0.4000000059604644775390625), float3(uStyle));
47
+ }
48
+ out.oColor = float4(_364, 1.0);
49
+ return out;
50
+ }
51
+
@@ -0,0 +1,41 @@
1
+ #include <metal_stdlib>
2
+ #include <simd/simd.h>
3
+
4
+ using namespace metal;
5
+
6
+ struct main0_out
7
+ {
8
+ float4 oColor [[color(0)]];
9
+ };
10
+
11
+ struct main0_in
12
+ {
13
+ float2 vUv [[user(locn0)]];
14
+ };
15
+
16
+ fragment main0_out main0(main0_in in [[stage_in]], constant float2& uResolution [[buffer(0)]], constant float& uPitch [[buffer(1)]], constant float& uTime [[buffer(2)]], constant float& uSpeed [[buffer(3)]], constant float& uAngle [[buffer(4)]], constant float& uCalm [[buffer(5)]], constant float& uDotSize [[buffer(6)]], constant float& uWaveAmp [[buffer(7)]], constant float& uShape [[buffer(8)]], constant float3& uPaper [[buffer(9)]], constant float3& uInk [[buffer(10)]])
17
+ {
18
+ main0_out out = {};
19
+ float2 _29 = ((in.vUv * uResolution) - (uResolution * 0.5)) / float2(uResolution.y);
20
+ float2 _38 = _29 * uPitch;
21
+ float2 _53 = (floor(_38) + float2(0.5)) / float2(uPitch);
22
+ float _59 = uTime * uSpeed;
23
+ float _70 = uAngle + 2.2000000476837158203125;
24
+ float _123 = uDotSize * mix(1.0 - uWaveAmp, 1.0 + uWaveAmp, mix((0.5 + (0.25 * sin((dot(_53, float2(cos(uAngle), sin(uAngle))) * 3.099999904632568359375) + _59))) + (0.25 * sin((dot(_53, float2(cos(_70), sin(_70))) * 4.69999980926513671875) - (_59 * 0.769999980926513671875))), 0.5, uCalm * (1.0 - smoothstep(0.1500000059604644775390625, 0.62000000476837158203125, length(_29)))));
25
+ float2 _126 = abs(fract(_38) - float2(0.5));
26
+ float _130 = _126.x;
27
+ float _132 = _126.y;
28
+ float _138 = length(_126);
29
+ float _198;
30
+ if (uShape < 1.0)
31
+ {
32
+ _198 = mix((_130 + _132) * 0.707099974155426025390625, _138, fast::clamp(uShape, 0.0, 1.0));
33
+ }
34
+ else
35
+ {
36
+ _198 = mix(_138, fast::max(_130, _132), fast::clamp(uShape - 1.0, 0.0, 1.0));
37
+ }
38
+ out.oColor = float4(mix(uPaper, uInk, float3(smoothstep(_123 + 0.0599999986588954925537109375, _123 - 0.0599999986588954925537109375, _198))), 1.0);
39
+ return out;
40
+ }
41
+
@@ -0,0 +1,45 @@
1
+ #pragma clang diagnostic ignored "-Wmissing-prototypes"
2
+
3
+ #include <metal_stdlib>
4
+ #include <simd/simd.h>
5
+
6
+ using namespace metal;
7
+
8
+ struct main0_out
9
+ {
10
+ float4 oColor [[color(0)]];
11
+ };
12
+
13
+ struct main0_in
14
+ {
15
+ float2 vUv [[user(locn0)]];
16
+ };
17
+
18
+ // Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
19
+ template<typename Tx, typename Ty>
20
+ inline Tx mod(Tx x, Ty y)
21
+ {
22
+ return x - y * floor(x / y);
23
+ }
24
+
25
+ fragment main0_out main0(main0_in in [[stage_in]], constant float2& uResolution [[buffer(0)]], constant float& uTime [[buffer(1)]], constant float& uRotate [[buffer(2)]], constant float& uZoom [[buffer(3)]], constant float& uSegments [[buffer(4)]], constant float& uSpeed [[buffer(5)]], constant float3& uColorA [[buffer(6)]], constant float3& uColorB [[buffer(7)]], constant float3& uColorC [[buffer(8)]], constant float& uCalm [[buffer(9)]])
26
+ {
27
+ main0_out out = {};
28
+ float2 _29 = ((in.vUv * uResolution) - (uResolution * 0.5)) / float2(uResolution.y);
29
+ float _33 = length(_29);
30
+ float _39 = uTime * uRotate;
31
+ float _42 = cos(_39);
32
+ float _45 = sin(_39);
33
+ float2 _58 = float2x2(float2(_42, -_45), float2(_45, _42)) * _29;
34
+ float _78 = fast::max(3.0, floor(uSegments));
35
+ float _94 = 3.1415927410125732421875 / _78;
36
+ float _96 = abs(mod(atan2(_58.y, _58.x + 9.9999997473787516355514526367188e-06), 6.283185482025146484375 / _78) - _94);
37
+ float2 _104 = float2(cos(_96), sin(_96)) * ((_33 * uZoom) * (1.0 + (0.0599999986588954925537109375 * sin(uTime * 0.23000000417232513427734375))));
38
+ float _109 = uTime * uSpeed;
39
+ float _112 = _104.x;
40
+ float _121 = _104.y;
41
+ float _150 = (sin((_112 * 6.0) + _109) + sin(((_112 + _121) * 4.19999980926513671875) - (_109 * 0.699999988079071044921875))) + sin((length(_104 - float2(0.89999997615814208984375 + (0.25 * sin(_109 * 0.310000002384185791015625)), 0.0)) * 7.0) + (_109 * 1.10000002384185791015625));
42
+ out.oColor = float4(mix(mix(mix(uColorA, uColorB, float3(0.5 + (0.5 * sin(_150)))), uColorC, float3(smoothstep(0.25, 0.89999997615814208984375, 0.5 + (0.5 * sin(sin(((_121 * 5.0) - (_109 * 0.89999997615814208984375)) + sin((_112 * 3.099999904632568359375) + (_109 * 0.4000000059604644775390625))) + (_150 * 0.5)))) * 0.64999997615814208984375)) * (1.0 - (0.180000007152557373046875 * (smoothstep(0.0350000001490116119384765625, 0.0, abs(_96 - _94)) + smoothstep(0.0350000001490116119384765625, 0.0, _96)))), (uColorA + uColorB) * 0.5, float3((uCalm * (1.0 - smoothstep(0.1500000059604644775390625, 0.62000000476837158203125, _33))) * 0.60000002384185791015625)), 1.0);
43
+ return out;
44
+ }
45
+
@@ -0,0 +1,181 @@
1
+ #include <metal_stdlib>
2
+ #include <simd/simd.h>
3
+
4
+ using namespace metal;
5
+
6
+ struct main0_out
7
+ {
8
+ float4 oColor [[color(0)]];
9
+ };
10
+
11
+ struct main0_in
12
+ {
13
+ float2 vUv [[user(locn0)]];
14
+ };
15
+
16
+ fragment main0_out main0(main0_in in [[stage_in]], constant float3& uBgColor [[buffer(0)]], constant float& uDensity [[buffer(1)]], constant float& uOutline [[buffer(2)]], constant float3& uColorA [[buffer(3)]], constant float3& uColorB [[buffer(4)]], constant float3& uColorC [[buffer(5)]], constant float2& uResolution [[buffer(6)]], constant float& uTime [[buffer(7)]], constant float& uDrift [[buffer(8)]], constant float& uScale [[buffer(9)]], constant float& uCalm [[buffer(10)]])
17
+ {
18
+ main0_out out = {};
19
+ float _603;
20
+ float2 _448 = ((in.vUv * uResolution) - (uResolution * 0.5)) / float2(uResolution.y);
21
+ float _457 = uTime * uDrift;
22
+ float2 _464 = _448 * uScale;
23
+ float2 _477 = ((_464 * 2.2999999523162841796875) + float2(_457 * 0.04500000178813934326171875, _457 * (-0.02999999932944774627685546875))) + float2(51.700000762939453125);
24
+ float _1460;
25
+ float3 _1461;
26
+ do
27
+ {
28
+ float2 _817 = fract((floor(_477) + float2(7.0)) * float2(234.339996337890625, 435.345001220703125));
29
+ float2 _825 = _817 + float2(dot(_817, _817 + float2(34.229999542236328125)));
30
+ float _831 = fract(_825.x * _825.y);
31
+ _603 = uDensity;
32
+ if (_831 > _603)
33
+ {
34
+ _1461 = uBgColor;
35
+ _1460 = 0.0;
36
+ break;
37
+ }
38
+ float _612 = fract(_831 * 113.76999664306640625);
39
+ float _626 = (fract(_831 * 57.310001373291015625) * 6.283185482025146484375) + ((_457 * (_612 - 0.5)) * 0.800000011920928955078125);
40
+ float _628 = cos(_626);
41
+ float _630 = sin(_626);
42
+ float _634 = _831 * 6.283185482025146484375;
43
+ float2 _656 = float2x2(float2(_628, -_630), float2(_630, _628)) * ((fract(_477) - float2(0.5)) - (float2(sin((_457 * 0.60000002384185791015625) + _634), cos((_457 * 0.800000011920928955078125) + _634)) * 0.039999999105930328369140625));
44
+ float _658 = mix(0.14000000059604644775390625, 0.300000011920928955078125, _612);
45
+ float _661 = _658 * 0.60000002384185791015625;
46
+ float _1452;
47
+ if ((fract(_831 * 431.1300048828125) * 6.0) < 3.0)
48
+ {
49
+ _1452 = length(_656) - (_658 * 0.2700000107288360595703125);
50
+ }
51
+ else
52
+ {
53
+ float _678 = _658 * 0.1319999992847442626953125;
54
+ float2 _836 = abs(_656);
55
+ float2 _838 = _836 - float2(_661, _678);
56
+ float2 _855 = _836 - float2(_678, _661);
57
+ _1452 = fast::min(length(fast::max(_838, float2(0.0))) + fast::min(fast::max(_838.x, _838.y), 0.0), length(fast::max(_855, float2(0.0))) + fast::min(fast::max(_855.x, _855.y), 0.0));
58
+ }
59
+ float _796 = fract(_831 * 769.22998046875) * 3.0;
60
+ float3 _1459;
61
+ if (_796 < 1.0)
62
+ {
63
+ _1459 = uColorA;
64
+ }
65
+ else
66
+ {
67
+ _1459 = select(uColorC, uColorB, bool3(_796 < 2.0));
68
+ }
69
+ _1461 = _1459;
70
+ _1460 = (fract(_831 * 891.71002197265625) < uOutline) ? smoothstep(0.01200000010430812835693359375, -0.01200000010430812835693359375, abs(_1452 + (_658 * 0.0360000021755695343017578125)) - (_658 * 0.05400000512599945068359375)) : smoothstep(0.01200000010430812835693359375, -0.01200000010430812835693359375, _1452);
71
+ break;
72
+ } while(false);
73
+ float2 _509 = _464 + float2(_457 * (-0.0599999986588954925537109375), _457 * 0.039999999105930328369140625);
74
+ float _1481;
75
+ float3 _1482;
76
+ do
77
+ {
78
+ float2 _1234 = fract(floor(_509) * float2(234.339996337890625, 435.345001220703125));
79
+ float2 _1242 = _1234 + float2(dot(_1234, _1234 + float2(34.229999542236328125)));
80
+ float _1248 = fract(_1242.x * _1242.y);
81
+ if (_1248 > _603)
82
+ {
83
+ _1482 = uBgColor;
84
+ _1481 = 0.0;
85
+ break;
86
+ }
87
+ float _1029 = fract(_1248 * 113.76999664306640625);
88
+ float _1043 = (fract(_1248 * 57.310001373291015625) * 6.283185482025146484375) + ((_457 * (_1029 - 0.5)) * 0.800000011920928955078125);
89
+ float _1045 = cos(_1043);
90
+ float _1047 = sin(_1043);
91
+ float _1051 = _1248 * 6.283185482025146484375;
92
+ float2 _1073 = float2x2(float2(_1045, -_1047), float2(_1047, _1045)) * ((fract(_509) - float2(0.5)) - (float2(sin((_457 * 0.60000002384185791015625) + _1051), cos((_457 * 0.800000011920928955078125) + _1051)) * 0.039999999105930328369140625));
93
+ float _1075 = mix(0.14000000059604644775390625, 0.300000011920928955078125, _1029);
94
+ float _1080 = fract(_1248 * 431.1300048828125) * 6.0;
95
+ float _1475;
96
+ if (_1080 < 1.0)
97
+ {
98
+ _1475 = length(_1073) - _1075;
99
+ }
100
+ else
101
+ {
102
+ float _1476;
103
+ if (_1080 < 2.0)
104
+ {
105
+ _1476 = abs(length(_1073) - (_1075 * 0.800000011920928955078125)) - (_1075 * 0.180000007152557373046875);
106
+ }
107
+ else
108
+ {
109
+ float _1477;
110
+ if (_1080 < 3.0)
111
+ {
112
+ float _1289 = abs(_1073.x) - _1075;
113
+ float2 _1427 = _1073;
114
+ _1427.x = _1289;
115
+ float _1295 = _1073.y + (_1075 * 0.57735025882720947265625);
116
+ float2 _1430 = _1427;
117
+ _1430.y = _1295;
118
+ float _1301 = 1.73205077648162841796875 * _1295;
119
+ float2 _1472;
120
+ if ((_1289 + _1301) > 0.0)
121
+ {
122
+ _1472 = float2(_1289 - _1301, ((-1.73205077648162841796875) * _1289) - _1295) * 0.5;
123
+ }
124
+ else
125
+ {
126
+ _1472 = _1430;
127
+ }
128
+ float2 _1440 = _1472;
129
+ _1440.x = _1472.x - fast::clamp(_1472.x, (-2.0) * _1075, 0.0);
130
+ _1477 = (-length(_1440)) * sign(_1472.y);
131
+ }
132
+ else
133
+ {
134
+ float _1478;
135
+ if (_1080 < 4.0)
136
+ {
137
+ float _1142 = _1075 * 0.23999999463558197021484375;
138
+ float2 _1340 = abs(_1073);
139
+ float2 _1342 = _1340 - float2(_1075, _1142);
140
+ float2 _1359 = _1340 - float2(_1142, _1075);
141
+ _1478 = fast::min(length(fast::max(_1342, float2(0.0))) + fast::min(fast::max(_1342.x, _1342.y), 0.0), length(fast::max(_1359, float2(0.0))) + fast::min(fast::max(_1359.x, _1359.y), 0.0));
142
+ }
143
+ else
144
+ {
145
+ float _1479;
146
+ if (_1080 < 5.0)
147
+ {
148
+ float2 _1376 = abs(_1073) - float2(_1075 * 0.7799999713897705078125);
149
+ _1479 = length(fast::max(_1376, float2(0.0))) + fast::min(fast::max(_1376.x, _1376.y), 0.0);
150
+ }
151
+ else
152
+ {
153
+ float _1170 = _1073.x;
154
+ _1479 = fast::max(abs(_1073.y - ((0.4000000059604644775390625 * _1075) * sin((_1170 / _1075) * 6.5))) - (_1075 * 0.17000000178813934326171875), abs(_1170) - _1075);
155
+ }
156
+ _1478 = _1479;
157
+ }
158
+ _1477 = _1478;
159
+ }
160
+ _1476 = _1477;
161
+ }
162
+ _1475 = _1476;
163
+ }
164
+ float _1213 = fract(_1248 * 769.22998046875) * 3.0;
165
+ float3 _1480;
166
+ if (_1213 < 1.0)
167
+ {
168
+ _1480 = uColorA;
169
+ }
170
+ else
171
+ {
172
+ _1480 = select(uColorC, uColorB, bool3(_1213 < 2.0));
173
+ }
174
+ _1482 = _1480;
175
+ _1481 = (fract(_1248 * 891.71002197265625) < uOutline) ? smoothstep(0.01200000010430812835693359375, -0.01200000010430812835693359375, abs(_1475 + (_1075 * 0.0599999986588954925537109375)) - (_1075 * 0.0900000035762786865234375)) : smoothstep(0.01200000010430812835693359375, -0.01200000010430812835693359375, _1475);
176
+ break;
177
+ } while(false);
178
+ out.oColor = float4(mix(mix(uBgColor, mix(uBgColor, _1461, float3(0.550000011920928955078125)), float3(_1460)), _1482, float3(_1481 * (1.0 - (uCalm * (1.0 - smoothstep(0.1500000059604644775390625, 0.62000000476837158203125, length(_448))))))), 1.0);
179
+ return out;
180
+ }
181
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-webrtc-kaleidoscope",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Live video effects (blur, background replacement, generative backgrounds, flip/rotate) for react-native-webrtc, packaged as a managed-Expo-friendly Expo Module. Working on web, Android, and iOS. Active development.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "author": "the-simian <info@simiancraft.com>",
20
20
  "license": "MIT",
21
- "homepage": "https://github.com/simiancraft/react-native-webrtc-kaleidoscope#readme",
21
+ "homepage": "https://simiancraft.github.io/react-native-webrtc-kaleidoscope/",
22
22
  "repository": {
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/simiancraft/react-native-webrtc-kaleidoscope.git"
@@ -432,6 +432,34 @@
432
432
  "import": "./dist/catalog/shaders/plasma/plasma.form.js",
433
433
  "default": "./dist/catalog/shaders/plasma/plasma.form.js"
434
434
  },
435
+ "./shaders/kaleidoscope/form": {
436
+ "types": "./dist/catalog/shaders/kaleidoscope/kaleidoscope.form.d.ts",
437
+ "react-native": "./catalog/shaders/kaleidoscope/kaleidoscope.form.tsx",
438
+ "browser": "./dist/catalog/shaders/kaleidoscope/kaleidoscope.form.js",
439
+ "import": "./dist/catalog/shaders/kaleidoscope/kaleidoscope.form.js",
440
+ "default": "./dist/catalog/shaders/kaleidoscope/kaleidoscope.form.js"
441
+ },
442
+ "./shaders/neo-memphis/form": {
443
+ "types": "./dist/catalog/shaders/neo-memphis/neo-memphis.form.d.ts",
444
+ "react-native": "./catalog/shaders/neo-memphis/neo-memphis.form.tsx",
445
+ "browser": "./dist/catalog/shaders/neo-memphis/neo-memphis.form.js",
446
+ "import": "./dist/catalog/shaders/neo-memphis/neo-memphis.form.js",
447
+ "default": "./dist/catalog/shaders/neo-memphis/neo-memphis.form.js"
448
+ },
449
+ "./shaders/halftone-waves/form": {
450
+ "types": "./dist/catalog/shaders/halftone-waves/halftone-waves.form.d.ts",
451
+ "react-native": "./catalog/shaders/halftone-waves/halftone-waves.form.tsx",
452
+ "browser": "./dist/catalog/shaders/halftone-waves/halftone-waves.form.js",
453
+ "import": "./dist/catalog/shaders/halftone-waves/halftone-waves.form.js",
454
+ "default": "./dist/catalog/shaders/halftone-waves/halftone-waves.form.js"
455
+ },
456
+ "./shaders/aurora-silk/form": {
457
+ "types": "./dist/catalog/shaders/aurora-silk/aurora-silk.form.d.ts",
458
+ "react-native": "./catalog/shaders/aurora-silk/aurora-silk.form.tsx",
459
+ "browser": "./dist/catalog/shaders/aurora-silk/aurora-silk.form.js",
460
+ "import": "./dist/catalog/shaders/aurora-silk/aurora-silk.form.js",
461
+ "default": "./dist/catalog/shaders/aurora-silk/aurora-silk.form.js"
462
+ },
435
463
  "./shaders/blur/form": {
436
464
  "types": "./dist/catalog/shaders/blur/blur.form.d.ts",
437
465
  "react-native": "./catalog/shaders/blur/blur.form.tsx",
@@ -496,10 +524,14 @@
496
524
  "./expo-module.config.json": "./expo-module.config.json",
497
525
  "./package.json": "./package.json"
498
526
  },
527
+ "bin": {
528
+ "kaleidoscope-thumbnails": "./tools/thumbnails/make-thumbnails.ts"
529
+ },
499
530
  "files": [
500
531
  "src",
501
532
  "catalog",
502
533
  "dist",
534
+ "tools",
503
535
  "android/src",
504
536
  "android/build.gradle",
505
537
  "ios",
@@ -540,6 +572,7 @@
540
572
  "check:shaders": "bun run build:shaders && git diff --exit-code -- android/src/main/java/com/simiancraft/kaleidoscope/gpu/ShadersGenerated.kt web-driver/shaders.generated.ts",
541
573
  "bench:shader": "bun run scripts/shader-cost.ts",
542
574
  "shader:view": "bun run scripts/shader-view.ts",
575
+ "thumbs": "bun run build && bun tools/thumbnails/make-thumbnails.ts --book demo/kaleidoscope.preset-book.ts --out demo/assets/thumbnails --repo",
543
576
  "demo": "bun run build && cd demo && bun run start",
544
577
  "demo:wsl": "bun run build && cd demo && bun run start:wsl",
545
578
  "demo:ios": "bun run build && cd demo && bun run ios",
@@ -606,7 +639,7 @@
606
639
  "lefthook": "^2.1.9",
607
640
  "livekit-client": "^2.0.0",
608
641
  "nativewind": "4.2.x",
609
- "playwright": "^1.60.0",
642
+ "playwright": "1.60.0",
610
643
  "publint": "^0.3.18",
611
644
  "react": "18.2.0",
612
645
  "react-native": "0.74.5",
@@ -0,0 +1,104 @@
1
+ // Loads a preset book as DATA by executing it under Bun with three shims
2
+ // (issue #65). The book is real TypeScript that imports React control
3
+ // components, expo-asset, and bundled images; none of those matter to a
4
+ // thumbnail, so each is replaced with the smallest stand-in that keeps the
5
+ // module graph executable:
6
+ //
7
+ // - `expo-asset`: `Asset.fromModule(m).uri` returns the module value itself,
8
+ // which (via the asset shim below) is the file's absolute path.
9
+ // - control components (`*.form.*`, `*.controls.*`): a Proxy that satisfies
10
+ // any named import without pulling React in; presets reference these as
11
+ // values but thumbnails never render them.
12
+ // - bundled images (`.webp` / `.png` / `.jpg`): the file's absolute path as
13
+ // the default export, so an image layer's `source` resolves to something
14
+ // the CLI can read and embed.
15
+ //
16
+ // Executing (vs static parsing, which the prebuild plugin does for asset
17
+ // collection) is what yields exact per-preset layer stacks and uniform values
18
+ // with no fragile object-literal parsing. This is Bun-only by design; the
19
+ // thumbnail maker is an opt-in dev command, not runtime code.
20
+
21
+ import path from 'node:path';
22
+ import { plugin } from 'bun';
23
+
24
+ /** One layer as authored in a book (the subset thumbnails care about). */
25
+ type LoadedLayer = {
26
+ readonly id?: string;
27
+ readonly shader: string;
28
+ readonly target?: string;
29
+ readonly blend?: string;
30
+ readonly source?: string;
31
+ readonly uniforms?: Record<string, number | readonly number[]>;
32
+ };
33
+
34
+ /** One preset as authored in a book. */
35
+ export type LoadedPreset = {
36
+ readonly name: string;
37
+ readonly taxonomy: readonly string[];
38
+ readonly thumbnail?: string | number;
39
+ readonly layers: readonly LoadedLayer[];
40
+ };
41
+
42
+ plugin({
43
+ name: 'kaleidoscope-thumbnails-book-shims',
44
+ setup(build) {
45
+ // Path-based onLoad (not onResolve, which Bun's runtime plugins do not
46
+ // reliably fire): any file inside the expo-asset package becomes the
47
+ // shim, so its entry never executes and never drags React Native's
48
+ // Flow-typed asset registry in.
49
+ build.onLoad({ filter: /node_modules\/expo-asset\/.*\.[cm]?js$/ }, () => ({
50
+ contents: [
51
+ 'function unwrap(m) {',
52
+ ' if (typeof m === "string") return m;',
53
+ ' try { if (m && typeof m.default === "string") return m.default; } catch {}',
54
+ ' try { if (m && typeof m.uri === "string") return m.uri; } catch {}',
55
+ ' try { return String(m); } catch { return ""; }',
56
+ '}',
57
+ 'export const Asset = { fromModule: (m) => ({ uri: unwrap(m) }) };',
58
+ ].join('\n'),
59
+ loader: 'js',
60
+ }));
61
+ // Control components are imported by NAME, and ESM named imports need the
62
+ // name to exist; the name is convention-derived from the filename
63
+ // (`clouds.controls.js` -> CloudsControls, `plasma.form.tsx` -> PlasmaForm),
64
+ // so the stub synthesizes exactly that export.
65
+ build.onLoad({ filter: /\.(form|controls)\.(tsx|jsx|ts|js)$/ }, (args) => {
66
+ const base = path.basename(args.path);
67
+ const stem = base.split('.')[0] ?? 'stub';
68
+ const kind = base.includes('.controls.') ? 'Controls' : 'Form';
69
+ const pascal = stem
70
+ .split('-')
71
+ .map((s) => s.charAt(0).toUpperCase() + s.slice(1))
72
+ .join('');
73
+ const name = `${pascal}${kind}`;
74
+ return {
75
+ contents: `export const ${name} = () => null;\nexport default ${name};`,
76
+ loader: 'js',
77
+ };
78
+ });
79
+ // Bun materializes plugin modules as ESM namespaces even when authored as
80
+ // CJS, so the path rides the default export; `import x from './x.webp'`
81
+ // unwraps it natively and the Asset shim's unwrap() handles the
82
+ // `require('./x.webp')` namespace form.
83
+ build.onLoad({ filter: /\.(webp|png|jpe?g|gif)$/ }, (args) => ({
84
+ contents: `export default ${JSON.stringify(args.path)};`,
85
+ loader: 'js',
86
+ }));
87
+ },
88
+ });
89
+
90
+ /**
91
+ * Import the book and return its preset map. Accepts the conventional
92
+ * `export const presets` (the demo's shape) or a default export.
93
+ */
94
+ export async function loadPresetBook(bookPath: string): Promise<Record<string, LoadedPreset>> {
95
+ const abs = path.resolve(bookPath);
96
+ const mod = (await import(abs)) as { presets?: unknown; default?: unknown };
97
+ const book = mod.presets ?? mod.default;
98
+ if (!book || typeof book !== 'object') {
99
+ throw new Error(
100
+ `${bookPath} did not export a preset book (expected \`export const presets = {...}\` or a default export).`,
101
+ );
102
+ }
103
+ return book as Record<string, LoadedPreset>;
104
+ }