gl-transitions 3.2.0 → 3.3.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 (76) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/compatibility.json +210 -0
  3. package/gl-transitions.js +1 -1
  4. package/gl-transitions.json +1 -1
  5. package/glsl3/CardDeal.glsl +146 -0
  6. package/glsl3/EchoSlide.glsl +93 -0
  7. package/glsl3/GeometricCollage.glsl +241 -0
  8. package/glsl3/HingedSquares.glsl +121 -0
  9. package/glsl3/HorizontalHold.glsl +62 -0
  10. package/glsl3/LayoutGrid.glsl +147 -0
  11. package/glsl3/ProjectorThrow.glsl +75 -0
  12. package/glsl3/Reassemble.glsl +156 -0
  13. package/glsl3/Shockwave.glsl +103 -0
  14. package/glsl3/ShoreWash.glsl +150 -0
  15. package/glsl3/ShutterWipe.glsl +68 -0
  16. package/glsl3/StopMotion.glsl +118 -0
  17. package/glsl3/Vaporize.glsl +125 -0
  18. package/index.js +1 -1
  19. package/layouts.json +493 -0
  20. package/llms-full.txt +647 -434
  21. package/llms.txt +238 -225
  22. package/msl/CardDeal.metal +539 -0
  23. package/msl/EchoSlide.metal +438 -0
  24. package/msl/GeometricCollage.metal +1188 -0
  25. package/msl/HingedSquares.metal +564 -0
  26. package/msl/HorizontalHold.metal +286 -0
  27. package/msl/LayoutGrid.metal +544 -0
  28. package/msl/ProjectorThrow.metal +313 -0
  29. package/msl/Reassemble.metal +667 -0
  30. package/msl/Shockwave.metal +256 -0
  31. package/msl/ShoreWash.metal +538 -0
  32. package/msl/ShutterWipe.metal +286 -0
  33. package/msl/StopMotion.metal +551 -0
  34. package/msl/Vaporize.metal +462 -0
  35. package/package.json +1 -1
  36. package/skills/gl-transitions/references/catalog.md +70 -32
  37. package/sksl/CardDeal.sksl +156 -0
  38. package/sksl/EchoSlide.sksl +99 -0
  39. package/sksl/GeometricCollage.sksl +242 -0
  40. package/sksl/HingedSquares.sksl +124 -0
  41. package/sksl/HorizontalHold.sksl +74 -0
  42. package/sksl/LayoutGrid.sksl +156 -0
  43. package/sksl/ProjectorThrow.sksl +85 -0
  44. package/sksl/Reassemble.sksl +166 -0
  45. package/sksl/Shockwave.sksl +116 -0
  46. package/sksl/ShoreWash.sksl +159 -0
  47. package/sksl/ShutterWipe.sksl +80 -0
  48. package/sksl/StopMotion.sksl +126 -0
  49. package/sksl/Vaporize.sksl +134 -0
  50. package/sksl/index.js +1 -1
  51. package/transitions/CardDeal.glsl +145 -0
  52. package/transitions/EchoSlide.glsl +92 -0
  53. package/transitions/GeometricCollage.glsl +240 -0
  54. package/transitions/HingedSquares.glsl +120 -0
  55. package/transitions/HorizontalHold.glsl +61 -0
  56. package/transitions/LayoutGrid.glsl +146 -0
  57. package/transitions/ProjectorThrow.glsl +74 -0
  58. package/transitions/Reassemble.glsl +155 -0
  59. package/transitions/Shockwave.glsl +102 -0
  60. package/transitions/ShoreWash.glsl +149 -0
  61. package/transitions/ShutterWipe.glsl +67 -0
  62. package/transitions/StopMotion.glsl +117 -0
  63. package/transitions/Vaporize.glsl +124 -0
  64. package/wgsl/CardDeal.wgsl +496 -0
  65. package/wgsl/EchoSlide.wgsl +386 -0
  66. package/wgsl/GeometricCollage.wgsl +1075 -0
  67. package/wgsl/HingedSquares.wgsl +506 -0
  68. package/wgsl/HorizontalHold.wgsl +243 -0
  69. package/wgsl/LayoutGrid.wgsl +495 -0
  70. package/wgsl/ProjectorThrow.wgsl +274 -0
  71. package/wgsl/Reassemble.wgsl +609 -0
  72. package/wgsl/Shockwave.wgsl +226 -0
  73. package/wgsl/ShoreWash.wgsl +492 -0
  74. package/wgsl/ShutterWipe.wgsl +252 -0
  75. package/wgsl/StopMotion.wgsl +496 -0
  76. package/wgsl/Vaporize.wgsl +420 -0
@@ -0,0 +1,386 @@
1
+ // EchoSlide — WGSL, generated from https://github.com/gl-transitions/gl-transitions/blob/master/transitions/EchoSlide.glsl
2
+ // Author: gre
3
+ // License: MIT
4
+ // Description: The outgoing image slides away leaving a trail of discrete fading copies of itself, a stroboscopic echo, and the incoming image's echoes converge into place
5
+ // Bindings and uniform layout: see the gl-transitions package README
6
+
7
+ struct Uniforms {
8
+ progress: f32,
9
+ ratio: f32,
10
+ direction: vec2<f32>,
11
+ echoes: i32,
12
+ trail: f32,
13
+ decay: f32,
14
+ }
15
+
16
+ @group(0) @binding(2)
17
+ var _from: texture_2d<f32>;
18
+ @group(0) @binding(1)
19
+ var _sampler: sampler;
20
+ @group(0) @binding(3)
21
+ var _to: texture_2d<f32>;
22
+ @group(0) @binding(0)
23
+ var<uniform> uniforms: Uniforms;
24
+ var<private> _fragColor: vec4<f32>;
25
+ var<private> _uv_1: vec2<f32>;
26
+
27
+ fn getFromColor(uv: ptr<function, vec2<f32>>) -> vec4<f32> {
28
+ let _e32 = (*uv)[0u];
29
+ let _e34 = (*uv)[1u];
30
+ let _e37 = textureSampleLevel(_from, _sampler, vec2<f32>(_e32, (1f - _e34)), 0f);
31
+ return _e37;
32
+ }
33
+
34
+ fn getToColor(uv_1: ptr<function, vec2<f32>>) -> vec4<f32> {
35
+ let _e32 = (*uv_1)[0u];
36
+ let _e34 = (*uv_1)[1u];
37
+ let _e37 = textureSampleLevel(_to, _sampler, vec2<f32>(_e32, (1f - _e34)), 0f);
38
+ return _e37;
39
+ }
40
+
41
+ fn mirror(v: ptr<function, vec2<f32>>) -> vec2<f32> {
42
+ let _e31 = (*v);
43
+ let _e32 = vec2(2f);
44
+ return (vec2(1f) - abs((vec2(1f) - (_e31 - (floor((_e31 / _e32)) * _e32)))));
45
+ }
46
+
47
+ fn easeInOut(t: ptr<function, f32>) -> f32 {
48
+ let _e31 = (*t);
49
+ let _e32 = (*t);
50
+ let _e34 = (*t);
51
+ return ((_e31 * _e32) * (3f - (2f * _e34)));
52
+ }
53
+
54
+ fn edgeAt(t_1: ptr<function, f32>) -> f32 {
55
+ var param: f32;
56
+
57
+ let _e32 = (*t_1);
58
+ param = clamp(_e32, 0f, 1f);
59
+ let _e34 = easeInOut((&param));
60
+ return _e34;
61
+ }
62
+
63
+ fn echoStep(uv_2: ptr<function, vec2<f32>>, s: ptr<function, f32>, shift: ptr<function, vec2<f32>>, j: ptr<function, f32>, t0_: ptr<function, f32>, lag: ptr<function, f32>, n: ptr<function, f32>) -> vec4<f32> {
64
+ var e0_: f32;
65
+ var param_1: f32;
66
+ var e1_: f32;
67
+ var param_2: f32;
68
+ var a: vec4<f32>;
69
+ var param_3: vec2<f32>;
70
+ var param_4: vec2<f32>;
71
+ var b: vec4<f32>;
72
+ var param_5: vec2<f32>;
73
+ var param_6: vec2<f32>;
74
+ var c: vec4<f32>;
75
+
76
+ let _e48 = (*t0_);
77
+ let _e49 = (*j);
78
+ let _e50 = (*lag);
79
+ param_1 = (_e48 + (_e49 * _e50));
80
+ let _e53 = edgeAt((&param_1));
81
+ e0_ = _e53;
82
+ let _e54 = (*t0_);
83
+ let _e55 = (*j);
84
+ let _e57 = (*lag);
85
+ param_2 = (_e54 + ((_e55 + 1f) * _e57));
86
+ let _e60 = edgeAt((&param_2));
87
+ e1_ = _e60;
88
+ let _e61 = (*uv_2);
89
+ let _e62 = (*shift);
90
+ let _e63 = e0_;
91
+ param_3 = (_e61 - (_e62 * _e63));
92
+ let _e66 = mirror((&param_3));
93
+ param_4 = _e66;
94
+ let _e67 = getFromColor((&param_4));
95
+ a = _e67;
96
+ let _e68 = (*uv_2);
97
+ let _e69 = (*shift);
98
+ let _e70 = e1_;
99
+ param_5 = (_e68 - (_e69 * (_e70 - 1f)));
100
+ let _e74 = mirror((&param_5));
101
+ param_6 = _e74;
102
+ let _e75 = getToColor((&param_6));
103
+ b = _e75;
104
+ let _e76 = b;
105
+ let _e77 = a;
106
+ let _e78 = (*j);
107
+ let _e80 = (*n);
108
+ let _e83 = uniforms.decay;
109
+ c = mix(_e76, _e77, vec4(pow(((_e78 + 0.5f) / _e80), (0.5f + (2f * clamp(_e83, 0f, 1f))))));
110
+ let _e90 = e1_;
111
+ let _e91 = (*s);
112
+ let _e98 = e1_;
113
+ let _e99 = e0_;
114
+ let _e105 = c;
115
+ let _e107 = (_e105.xyz * (1f - ((0.25f * exp((-(max((_e90 - _e91), 0f)) / 0.02f))) * min(((_e98 - _e99) / 0.02f), 1f))));
116
+ c[0u] = _e107.x;
117
+ c[1u] = _e107.y;
118
+ c[2u] = _e107.z;
119
+ let _e114 = c;
120
+ return _e114;
121
+ }
122
+
123
+ fn past(s_1: ptr<function, f32>, x: ptr<function, f32>) -> f32 {
124
+ var local: f32;
125
+ var local_1: f32;
126
+
127
+ let _e34 = (*x);
128
+ if (_e34 <= 0f) {
129
+ local = 1f;
130
+ } else {
131
+ let _e36 = (*x);
132
+ if (_e36 >= 1f) {
133
+ local_1 = 0f;
134
+ } else {
135
+ let _e38 = (*s_1);
136
+ let _e39 = (*x);
137
+ local_1 = clamp((((_e38 - _e39) / 0.002f) + 0.5f), 0f, 1f);
138
+ }
139
+ let _e44 = local_1;
140
+ local = _e44;
141
+ }
142
+ let _e45 = local;
143
+ return _e45;
144
+ }
145
+
146
+ fn transition(uv_3: ptr<function, vec2<f32>>) -> vec4<f32> {
147
+ var dl: f32;
148
+ var d: vec2<f32>;
149
+ var local_2: vec2<f32>;
150
+ var ext: f32;
151
+ var shift_1: vec2<f32>;
152
+ var s_2: f32;
153
+ var n_1: f32;
154
+ var tr: f32;
155
+ var lag_1: f32;
156
+ var t0_1: f32;
157
+ var local_3: f32;
158
+ var eIn: f32;
159
+ var param_7: f32;
160
+ var eOut: f32;
161
+ var param_8: f32;
162
+ var wIn: f32;
163
+ var param_9: f32;
164
+ var param_10: f32;
165
+ var wOut: f32;
166
+ var param_11: f32;
167
+ var param_12: f32;
168
+ var wGap: f32;
169
+ var c_1: vec4<f32>;
170
+ var jf: f32;
171
+ var k: i32;
172
+ var m: f32;
173
+ var param_13: f32;
174
+ var param_14: f32;
175
+ var param_15: f32;
176
+ var j_1: f32;
177
+ var param_16: vec2<f32>;
178
+ var param_17: f32;
179
+ var param_18: vec2<f32>;
180
+ var param_19: f32;
181
+ var param_20: f32;
182
+ var param_21: f32;
183
+ var param_22: f32;
184
+ var param_23: vec2<f32>;
185
+ var param_24: f32;
186
+ var param_25: vec2<f32>;
187
+ var param_26: f32;
188
+ var param_27: f32;
189
+ var param_28: f32;
190
+ var param_29: f32;
191
+ var param_30: vec2<f32>;
192
+ var param_31: vec2<f32>;
193
+ var param_32: vec2<f32>;
194
+ var param_33: vec2<f32>;
195
+
196
+ let _e80 = uniforms.direction;
197
+ dl = length(_e80);
198
+ let _e82 = dl;
199
+ if (_e82 > 0.000001f) {
200
+ let _e85 = uniforms.direction;
201
+ let _e86 = dl;
202
+ local_2 = (_e85 / vec2(_e86));
203
+ } else {
204
+ local_2 = vec2<f32>(1f, 0f);
205
+ }
206
+ let _e89 = local_2;
207
+ d = _e89;
208
+ let _e91 = d[0u];
209
+ let _e94 = d[1u];
210
+ ext = (abs(_e91) + abs(_e94));
211
+ let _e97 = d;
212
+ let _e98 = ext;
213
+ shift_1 = (_e97 * _e98);
214
+ let _e100 = (*uv_3);
215
+ let _e103 = d;
216
+ let _e105 = ext;
217
+ s_2 = (0.5f + (dot((_e100 - vec2(0.5f)), _e103) / _e105));
218
+ let _e109 = uniforms.echoes;
219
+ n_1 = clamp(f32(_e109), 1f, 7f);
220
+ let _e113 = uniforms.trail;
221
+ tr = clamp(_e113, 0.05f, 0.6f);
222
+ let _e115 = tr;
223
+ let _e116 = n_1;
224
+ lag_1 = (_e115 / _e116);
225
+ let _e119 = uniforms.progress;
226
+ if (_e119 >= 1f) {
227
+ local_3 = 1f;
228
+ } else {
229
+ let _e122 = uniforms.progress;
230
+ let _e123 = tr;
231
+ let _e126 = tr;
232
+ local_3 = ((_e122 * (1f + _e123)) - _e126);
233
+ }
234
+ let _e128 = local_3;
235
+ t0_1 = _e128;
236
+ let _e129 = t0_1;
237
+ param_7 = _e129;
238
+ let _e130 = edgeAt((&param_7));
239
+ eIn = _e130;
240
+ let _e131 = t0_1;
241
+ let _e132 = tr;
242
+ param_8 = (_e131 + _e132);
243
+ let _e134 = edgeAt((&param_8));
244
+ eOut = _e134;
245
+ let _e135 = s_2;
246
+ param_9 = _e135;
247
+ let _e136 = eIn;
248
+ param_10 = _e136;
249
+ let _e137 = past((&param_9), (&param_10));
250
+ wIn = (1f - _e137);
251
+ let _e139 = s_2;
252
+ param_11 = _e139;
253
+ let _e140 = eOut;
254
+ param_12 = _e140;
255
+ let _e141 = past((&param_11), (&param_12));
256
+ wOut = _e141;
257
+ let _e142 = wIn;
258
+ let _e144 = wOut;
259
+ wGap = max(((1f - _e142) - _e144), 0f);
260
+ c_1 = vec4<f32>(0f, 0f, 0f, 0f);
261
+ let _e147 = wGap;
262
+ if (_e147 > 0f) {
263
+ jf = 0f;
264
+ k = 1i;
265
+ loop {
266
+ let _e149 = k;
267
+ if (_e149 < 7i) {
268
+ let _e151 = k;
269
+ m = f32(_e151);
270
+ let _e153 = m;
271
+ let _e154 = n_1;
272
+ if (_e153 >= _e154) {
273
+ break;
274
+ }
275
+ let _e156 = t0_1;
276
+ let _e157 = m;
277
+ let _e158 = lag_1;
278
+ param_13 = (_e156 + (_e157 * _e158));
279
+ let _e161 = edgeAt((&param_13));
280
+ let _e162 = s_2;
281
+ param_14 = _e162;
282
+ param_15 = _e161;
283
+ let _e163 = past((&param_14), (&param_15));
284
+ let _e164 = jf;
285
+ jf = (_e164 + _e163);
286
+ continue;
287
+ } else {
288
+ break;
289
+ }
290
+ continuing {
291
+ let _e166 = k;
292
+ k = (_e166 + 1i);
293
+ }
294
+ }
295
+ let _e168 = jf;
296
+ j_1 = floor(_e168);
297
+ let _e170 = (*uv_3);
298
+ param_16 = _e170;
299
+ let _e171 = s_2;
300
+ param_17 = _e171;
301
+ let _e172 = shift_1;
302
+ param_18 = _e172;
303
+ let _e173 = j_1;
304
+ param_19 = _e173;
305
+ let _e174 = t0_1;
306
+ param_20 = _e174;
307
+ let _e175 = lag_1;
308
+ param_21 = _e175;
309
+ let _e176 = n_1;
310
+ param_22 = _e176;
311
+ let _e177 = echoStep((&param_16), (&param_17), (&param_18), (&param_19), (&param_20), (&param_21), (&param_22));
312
+ c_1 = _e177;
313
+ let _e178 = jf;
314
+ let _e179 = j_1;
315
+ if (_e178 > _e179) {
316
+ let _e181 = c_1;
317
+ let _e182 = j_1;
318
+ let _e184 = (*uv_3);
319
+ param_23 = _e184;
320
+ let _e185 = s_2;
321
+ param_24 = _e185;
322
+ let _e186 = shift_1;
323
+ param_25 = _e186;
324
+ param_26 = (_e182 + 1f);
325
+ let _e187 = t0_1;
326
+ param_27 = _e187;
327
+ let _e188 = lag_1;
328
+ param_28 = _e188;
329
+ let _e189 = n_1;
330
+ param_29 = _e189;
331
+ let _e190 = echoStep((&param_23), (&param_24), (&param_25), (&param_26), (&param_27), (&param_28), (&param_29));
332
+ let _e191 = jf;
333
+ let _e192 = j_1;
334
+ c_1 = mix(_e181, _e190, vec4((_e191 - _e192)));
335
+ }
336
+ let _e196 = wGap;
337
+ let _e197 = c_1;
338
+ c_1 = (_e197 * _e196);
339
+ }
340
+ let _e199 = wIn;
341
+ if (_e199 > 0f) {
342
+ let _e201 = wIn;
343
+ let _e202 = (*uv_3);
344
+ let _e203 = shift_1;
345
+ let _e204 = eIn;
346
+ param_30 = (_e202 - (_e203 * (_e204 - 1f)));
347
+ let _e208 = mirror((&param_30));
348
+ param_31 = _e208;
349
+ let _e209 = getToColor((&param_31));
350
+ let _e211 = c_1;
351
+ c_1 = (_e211 + (_e209 * _e201));
352
+ }
353
+ let _e213 = wOut;
354
+ if (_e213 > 0f) {
355
+ let _e215 = wOut;
356
+ let _e216 = (*uv_3);
357
+ let _e217 = shift_1;
358
+ let _e218 = eOut;
359
+ param_32 = (_e216 - (_e217 * _e218));
360
+ let _e221 = mirror((&param_32));
361
+ param_33 = _e221;
362
+ let _e222 = getFromColor((&param_33));
363
+ let _e224 = c_1;
364
+ c_1 = (_e224 + (_e222 * _e215));
365
+ }
366
+ let _e226 = c_1;
367
+ return _e226;
368
+ }
369
+
370
+ fn main_1() {
371
+ var param_34: vec2<f32>;
372
+
373
+ let _e31 = _uv_1;
374
+ param_34 = _e31;
375
+ let _e32 = transition((&param_34));
376
+ _fragColor = _e32;
377
+ return;
378
+ }
379
+
380
+ @fragment
381
+ fn main(@location(0) _uv: vec2<f32>) -> @location(0) vec4<f32> {
382
+ _uv_1 = _uv;
383
+ main_1();
384
+ let _e3 = _fragColor;
385
+ return _e3;
386
+ }