@clypra-studio/engine 1.3.0 → 1.4.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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-LT3HTJ3X.js → chunk-3UEOLDJJ.js} +5 -829
  3. package/dist/chunk-3UEOLDJJ.js.map +1 -0
  4. package/dist/{chunk-Y4FMAOTW.js → chunk-E6O6LZME.js} +266 -1004
  5. package/dist/chunk-E6O6LZME.js.map +1 -0
  6. package/dist/chunk-PU3Q4QI7.js +833 -0
  7. package/dist/chunk-PU3Q4QI7.js.map +1 -0
  8. package/dist/{index-D6GAXDBy.d.cts → index-C18SQ-y6.d.cts} +171 -37
  9. package/dist/{index-D6GAXDBy.d.ts → index-C18SQ-y6.d.ts} +171 -37
  10. package/dist/index.cjs +11149 -23528
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +2087 -7834
  13. package/dist/index.d.ts +2087 -7834
  14. package/dist/index.js +10059 -17971
  15. package/dist/index.js.map +1 -1
  16. package/dist/textEffects/index.cjs +259 -971
  17. package/dist/textEffects/index.cjs.map +1 -1
  18. package/dist/textEffects/index.d.cts +1 -1
  19. package/dist/textEffects/index.d.ts +1 -1
  20. package/dist/textEffects/index.js +1 -1
  21. package/dist/transitions/index.cjs +18 -2199
  22. package/dist/transitions/index.cjs.map +1 -1
  23. package/dist/transitions/index.d.cts +37 -53
  24. package/dist/transitions/index.d.ts +37 -53
  25. package/dist/transitions/index.js +3 -51
  26. package/dist/videoEffects/index.cjs +4 -835
  27. package/dist/videoEffects/index.cjs.map +1 -1
  28. package/dist/videoEffects/index.d.cts +9 -138
  29. package/dist/videoEffects/index.d.ts +9 -138
  30. package/dist/videoEffects/index.js +1 -15
  31. package/package.json +13 -16
  32. package/dist/TransitionDefinition-CQoSb4ZB.d.cts +0 -158
  33. package/dist/TransitionDefinition-CQoSb4ZB.d.ts +0 -158
  34. package/dist/chunk-FIJBB3MH.js +0 -2990
  35. package/dist/chunk-FIJBB3MH.js.map +0 -1
  36. package/dist/chunk-LT3HTJ3X.js.map +0 -1
  37. package/dist/chunk-RYA4KGDB.js +0 -690
  38. package/dist/chunk-RYA4KGDB.js.map +0 -1
  39. package/dist/chunk-Y4FMAOTW.js.map +0 -1
  40. package/dist/index-BdQ3oRT4.d.cts +0 -139
  41. package/dist/index-BdQ3oRT4.d.ts +0 -139
  42. package/dist/v2/backends/index.cjs +0 -693
  43. package/dist/v2/backends/index.cjs.map +0 -1
  44. package/dist/v2/backends/index.d.cts +0 -3
  45. package/dist/v2/backends/index.d.ts +0 -3
  46. package/dist/v2/backends/index.js +0 -8
  47. package/dist/v2/backends/index.js.map +0 -1
@@ -20,30 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var transitions_exports = {};
21
21
  __export(transitions_exports, {
22
22
  ALL_TRANSITIONS: () => ALL_TRANSITIONS,
23
- ChromaticPushTransition: () => ChromaticPushTransition,
24
- CrossDissolveTransition: () => CrossDissolveTransition,
25
- DepthPushTransition: () => DepthPushTransition,
26
- DirectionalDissolveTransition: () => DirectionalDissolveTransition,
27
- ElasticSnapCutTransition: () => ElasticSnapCutTransition,
28
- FilmBurnWipeTransition: () => FilmBurnWipeTransition,
29
- FoldTurnTransition: () => FoldTurnTransition,
30
- FrameHoldStutterTransition: () => FrameHoldStutterTransition,
31
- GlitchTransition: () => GlitchTransition,
32
- GravityDropTransition: () => GravityDropTransition,
33
- IrisRevealTransition: () => IrisRevealTransition,
34
- LightLeakSweepTransition: () => LightLeakSweepTransition,
35
- LumaWipeTransition: () => LumaWipeTransition,
36
- ParallaxLayerSplitTransition: () => ParallaxLayerSplitTransition,
37
- PixelateCollapseTransition: () => PixelateCollapseTransition,
38
- PushTransition: () => PushTransition,
39
- RackFocusBlendTransition: () => RackFocusBlendTransition,
40
- RefractionWarpTransition: () => RefractionWarpTransition,
41
- ShatterBurstTransition: () => ShatterBurstTransition,
42
- StrobeCutTransition: () => StrobeCutTransition,
43
23
  TRANSITION_CATEGORIES: () => TRANSITION_CATEGORIES,
44
24
  TRANSITION_PRESETS: () => TRANSITION_PRESETS,
45
25
  TransitionRenderer: () => TransitionRenderer,
46
- ZoomTransition: () => ZoomTransition,
47
26
  getAllTransitionTags: () => getAllTransitionTags,
48
27
  getAllTransitions: () => getAllTransitions,
49
28
  getRecommendedDuration: () => getRecommendedDuration,
@@ -51,12 +30,9 @@ __export(transitions_exports, {
51
30
  getTransitionByRenderer: () => getTransitionByRenderer,
52
31
  getTransitionCategories: () => getTransitionCategories,
53
32
  getTransitionCountByCategory: () => getTransitionCountByCategory,
54
- getTransitionEffect: () => getTransitionEffect,
55
33
  getTransitionsByCategory: () => getTransitionsByCategory,
56
34
  getTransitionsByTags: () => getTransitionsByTags,
57
- searchTransitions: () => searchTransitions,
58
- transitionEffects: () => transitionEffects,
59
- transitionEffectsById: () => transitionEffectsById
35
+ searchTransitions: () => searchTransitions
60
36
  });
61
37
  module.exports = __toCommonJS(transitions_exports);
62
38
 
@@ -859,2182 +835,28 @@ function getRecommendedDuration(presetId) {
859
835
  return preset?.defaultDuration ?? 1;
860
836
  }
861
837
 
862
- // src/effects/transitions/geometric/PushTransition.ts
863
- var import_pixi = require("pixi.js");
864
-
865
- // src/effects/transitions/defaultVertexShader.ts
866
- var defaultVertexShader = `
867
- in vec2 aPosition;
868
- out vec2 vTextureCoord;
869
- out vec2 vNormalizedCoord;
870
-
871
- uniform vec4 uInputSize;
872
- uniform vec4 uOutputFrame;
873
- uniform vec4 uOutputTexture;
874
-
875
- vec4 filterVertexPosition(void) {
876
- vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
877
- position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
878
- position.y = position.y * (2.0 * uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
879
- return vec4(position, 0.0, 1.0);
880
- }
881
-
882
- vec2 filterTextureCoord(void) {
883
- return aPosition * (uOutputFrame.zw * uInputSize.zw);
884
- }
885
-
886
- void main(void) {
887
- gl_Position = filterVertexPosition();
888
- vTextureCoord = filterTextureCoord();
889
- vNormalizedCoord = aPosition;
890
- }
891
- `;
892
-
893
- // src/effects/transitions/geometric/PushTransition.ts
894
- var fragment = `
895
- in vec2 vNormalizedCoord;
896
- out vec4 finalColor;
897
-
898
- uniform sampler2D uFrom;
899
- uniform sampler2D uTo;
900
- uniform float uProgress;
901
- uniform float uDirection; // 0=left, 1=right, 2=up, 3=down
902
- uniform float uEasing; // 0=linear, 1=easeIn, 2=easeOut, 3=easeInOut
903
-
904
- // Easing functions
905
- float easeIn(float t) {
906
- return t * t;
907
- }
908
-
909
- float easeOut(float t) {
910
- return t * (2.0 - t);
911
- }
912
-
913
- float easeInOut(float t) {
914
- return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
915
- }
916
-
917
- float applyEasing(float t, float easingType) {
918
- if (easingType < 0.5) return t; // linear
919
- if (easingType < 1.5) return easeIn(t);
920
- if (easingType < 2.5) return easeOut(t);
921
- return easeInOut(t);
922
- }
923
-
924
- void main() {
925
- float t = applyEasing(uProgress, uEasing);
926
- vec2 uv = vNormalizedCoord;
927
-
928
- // Calculate offset based on direction
929
- vec2 offsetFrom = vec2(0.0);
930
- vec2 offsetTo = vec2(0.0);
931
-
932
- if (uDirection < 0.5) {
933
- // Push left
934
- offsetFrom = vec2(-t, 0.0);
935
- offsetTo = vec2(1.0 - t, 0.0);
936
- } else if (uDirection < 1.5) {
937
- // Push right
938
- offsetFrom = vec2(t, 0.0);
939
- offsetTo = vec2(-1.0 + t, 0.0);
940
- } else if (uDirection < 2.5) {
941
- // Push up
942
- offsetFrom = vec2(0.0, -t);
943
- offsetTo = vec2(0.0, 1.0 - t);
944
- } else {
945
- // Push down
946
- offsetFrom = vec2(0.0, t);
947
- offsetTo = vec2(0.0, -1.0 + t);
948
- }
949
-
950
- vec2 uvFrom = uv + offsetFrom;
951
- vec2 uvTo = uv + offsetTo;
952
-
953
- vec4 color;
954
-
955
- // Check which clip is visible at this UV coordinate
956
- if (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0) {
957
- color = texture(uFrom, uvFrom);
958
- } else if (uvTo.x >= 0.0 && uvTo.x <= 1.0 && uvTo.y >= 0.0 && uvTo.y <= 1.0) {
959
- color = texture(uTo, uvTo);
960
- } else {
961
- color = vec4(0.0, 0.0, 0.0, 1.0);
962
- }
963
-
964
- finalColor = color;
965
- }
966
- `;
967
- var PushTransition = {
968
- id: "push",
969
- name: "Push",
970
- category: "geometric",
971
- description: "One clip pushes the other off screen in a configurable direction.",
972
- tags: ["push", "slide", "spatial", "directional"],
973
- defaultDurationMs: 800,
974
- params: [
975
- { key: "direction", label: "Direction", type: "select", value: "left", options: ["left", "right", "up", "down"] },
976
- { key: "easing", label: "Easing", type: "select", value: "easeInOut", options: ["linear", "easeIn", "easeOut", "easeInOut"] }
977
- ],
978
- create(params) {
979
- const dirStr = params.direction || "left";
980
- const dirVal = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
981
- const easeStr = params.easing || "easeInOut";
982
- const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
983
- return import_pixi.Filter.from({
984
- gl: { vertex: defaultVertexShader, fragment },
985
- resources: {
986
- transitionUniforms: {
987
- uProgress: { value: 0, type: "f32" },
988
- uDirection: { value: dirVal, type: "f32" },
989
- uEasing: { value: easeVal, type: "f32" }
990
- }
991
- }
992
- });
993
- },
994
- updateProgress(filter, progress, params) {
995
- const u = filter.resources?.transitionUniforms?.uniforms;
996
- if (u) {
997
- u.uProgress = progress;
998
- const dirStr = params.direction || "left";
999
- u.uDirection = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
1000
- const easeStr = params.easing || "easeInOut";
1001
- u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
1002
- }
1003
- }
1004
- };
1005
-
1006
- // src/effects/transitions/geometric/IrisRevealTransition.ts
1007
- var import_pixi2 = require("pixi.js");
1008
- var fragment2 = `
1009
- in vec2 vNormalizedCoord;
1010
- out vec4 finalColor;
1011
-
1012
- uniform sampler2D uFrom;
1013
- uniform sampler2D uTo;
1014
- uniform float uProgress;
1015
- uniform vec2 uCenter;
1016
- uniform float uEdgeSoftness;
1017
- uniform float uShape; // 0 = circle, 1 = square, 2 = hexagon
1018
-
1019
- float sdCircle(vec2 p, float r) {
1020
- return length(p) - r;
1021
- }
1022
-
1023
- float sdSquare(vec2 p, float r) {
1024
- vec2 d = abs(p) - r;
1025
- return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
1026
- }
1027
-
1028
- float sdHexagon(vec2 p, float r) {
1029
- const vec3 k = vec3(-0.866025404, 0.5, 0.577350269);
1030
- p = abs(p);
1031
- p -= 2.0 * min(dot(k.xy, p), 0.0) * k.xy;
1032
- p -= vec2(clamp(p.x, -k.z * r, k.z * r), r);
1033
- return length(p) * sign(p.y);
1034
- }
1035
-
1036
- void main(void) {
1037
- vec2 uv = vNormalizedCoord;
1038
- vec4 fromColor = texture(uFrom, uv);
1039
- vec4 toColor = texture(uTo, uv);
1040
-
1041
- vec2 p = uv - uCenter;
1042
- float r = uProgress * 1.0; // Scaled radius to fully cover screen
1043
-
1044
- float dist = 0.0;
1045
- if (uShape < 0.5) {
1046
- dist = sdCircle(p, r);
1047
- } else if (uShape < 1.5) {
1048
- dist = sdSquare(p, r);
1049
- } else {
1050
- dist = sdHexagon(p, r);
1051
- }
1052
-
1053
- float mask = smoothstep(uEdgeSoftness, 0.0, dist);
1054
- finalColor = mix(fromColor, toColor, mask);
1055
- }
1056
- `;
1057
- var IrisRevealTransition = {
1058
- id: "iris-reveal",
1059
- name: "Iris Reveal",
1060
- category: "geometric",
1061
- description: "A circular, square, or hexagonal mask expands from a center point to reveal the incoming clip.",
1062
- tags: ["mask", "geometric", "radial", "reveal"],
1063
- defaultDurationMs: 800,
1064
- params: [
1065
- { key: "centerX", label: "Center X", type: "range", value: 0.5, min: 0, max: 1, step: 0.01 },
1066
- { key: "centerY", label: "Center Y", type: "range", value: 0.5, min: 0, max: 1, step: 0.01 },
1067
- { key: "edgeSoftness", label: "Edge Softness", type: "range", value: 0.05, min: 0, max: 0.2, step: 0.01 },
1068
- { key: "shape", label: "Shape", type: "select", value: "circle", options: ["circle", "square", "hexagon"] }
1069
- ],
1070
- create(params) {
1071
- const shapeStr = params.shape || "circle";
1072
- const shapeVal = shapeStr === "circle" ? 0 : shapeStr === "square" ? 1 : 2;
1073
- return import_pixi2.Filter.from({
1074
- gl: { vertex: defaultVertexShader, fragment: fragment2 },
1075
- resources: {
1076
- transitionUniforms: {
1077
- uProgress: { value: 0, type: "f32" },
1078
- uCenter: { value: [params.centerX ?? 0.5, params.centerY ?? 0.5], type: "vec2<f32>" },
1079
- uEdgeSoftness: { value: params.edgeSoftness ?? 0.05, type: "f32" },
1080
- uShape: { value: shapeVal, type: "f32" }
1081
- }
1082
- }
1083
- });
1084
- },
1085
- updateProgress(filter, progress, params) {
1086
- const u = filter.resources?.transitionUniforms?.uniforms;
1087
- if (u) {
1088
- u.uProgress = progress;
1089
- u.uCenter = [params.centerX ?? 0.5, params.centerY ?? 0.5];
1090
- u.uEdgeSoftness = params.edgeSoftness ?? 0.05;
1091
- const shapeStr = params.shape || "circle";
1092
- u.uShape = shapeStr === "circle" ? 0 : shapeStr === "square" ? 1 : 2;
1093
- }
1094
- }
1095
- };
1096
-
1097
- // src/effects/transitions/geometric/FoldTurnTransition.ts
1098
- var import_pixi3 = require("pixi.js");
1099
- var fragment3 = `
1100
- in vec2 vNormalizedCoord;
1101
- out vec4 finalColor;
1102
-
1103
- uniform sampler2D uFrom;
1104
- uniform sampler2D uTo;
1105
- uniform float uProgress;
1106
- uniform float uFoldDirection; // 0=left, 1=right, 2=top, 3=bottom
1107
- uniform float uShadowIntensity;
1108
-
1109
- void main(void) {
1110
- vec2 uv = vNormalizedCoord;
1111
- vec4 toColor = texture(uTo, uv);
1112
-
1113
- vec4 color = toColor; // Default to incoming showing behind
1114
- float shadow = 0.0;
1115
-
1116
- if (uFoldDirection < 0.5) {
1117
- // Left
1118
- float split = 1.0 - uProgress;
1119
- if (uv.x < split) {
1120
- vec2 foldUv = vec2(uv.x / max(split, 0.001), uv.y);
1121
- color = texture(uFrom, foldUv);
1122
- shadow = smoothstep(split - 0.1, split, uv.x) * uShadowIntensity;
1123
- color.rgb = mix(color.rgb, vec3(0.0), shadow);
1124
- }
1125
- } else if (uFoldDirection < 1.5) {
1126
- // Right
1127
- float split = uProgress;
1128
- if (uv.x > split) {
1129
- vec2 foldUv = vec2((uv.x - split) / max(1.0 - split, 0.001), uv.y);
1130
- color = texture(uFrom, foldUv);
1131
- shadow = smoothstep(split + 0.1, split, uv.x) * uShadowIntensity;
1132
- color.rgb = mix(color.rgb, vec3(0.0), shadow);
1133
- }
1134
- } else if (uFoldDirection < 2.5) {
1135
- // Top
1136
- float split = 1.0 - uProgress;
1137
- if (uv.y < split) {
1138
- vec2 foldUv = vec2(uv.x, uv.y / max(split, 0.001));
1139
- color = texture(uFrom, foldUv);
1140
- shadow = smoothstep(split - 0.1, split, uv.y) * uShadowIntensity;
1141
- color.rgb = mix(color.rgb, vec3(0.0), shadow);
1142
- }
1143
- } else {
1144
- // Bottom
1145
- float split = uProgress;
1146
- if (uv.y > split) {
1147
- vec2 foldUv = vec2(uv.x, (uv.y - split) / max(1.0 - split, 0.001));
1148
- color = texture(uFrom, foldUv);
1149
- shadow = smoothstep(split + 0.1, split, uv.y) * uShadowIntensity;
1150
- color.rgb = mix(color.rgb, vec3(0.0), shadow);
1151
- }
1152
- }
1153
-
1154
- finalColor = color;
1155
- }
1156
- `;
1157
- var FoldTurnTransition = {
1158
- id: "fold-turn",
1159
- name: "Fold Turn",
1160
- category: "geometric",
1161
- description: "The outgoing clip skews away like a folding page, revealing the incoming clip with edge shadow depth.",
1162
- tags: ["page", "fold", "geometric", "skew", "depth"],
1163
- defaultDurationMs: 900,
1164
- params: [
1165
- { key: "foldDirection", label: "Fold Direction", type: "select", value: "left", options: ["left", "right", "top", "bottom"] },
1166
- { key: "shadowIntensity", label: "Shadow Intensity", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
1167
- ],
1168
- create(params) {
1169
- const dirStr = params.foldDirection || "left";
1170
- const dirVal = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "top" ? 2 : 3;
1171
- return import_pixi3.Filter.from({
1172
- gl: { vertex: defaultVertexShader, fragment: fragment3 },
1173
- resources: {
1174
- transitionUniforms: {
1175
- uProgress: { value: 0, type: "f32" },
1176
- uFoldDirection: { value: dirVal, type: "f32" },
1177
- uShadowIntensity: { value: params.shadowIntensity ?? 0.5, type: "f32" }
1178
- }
1179
- }
1180
- });
1181
- },
1182
- updateProgress(filter, progress, params) {
1183
- const u = filter.resources?.transitionUniforms?.uniforms;
1184
- if (u) {
1185
- u.uProgress = progress;
1186
- const dirStr = params.foldDirection || "left";
1187
- u.uFoldDirection = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "top" ? 2 : 3;
1188
- u.uShadowIntensity = params.shadowIntensity ?? 0.5;
1189
- }
1190
- }
1191
- };
1192
-
1193
- // src/effects/transitions/optical-distortion/ZoomTransition.ts
1194
- var import_pixi4 = require("pixi.js");
1195
- var fragment4 = `
1196
- in vec2 vNormalizedCoord;
1197
- out vec4 finalColor;
1198
-
1199
- uniform sampler2D uFrom;
1200
- uniform sampler2D uTo;
1201
- uniform float uProgress;
1202
- uniform float uDirection; // 0=in, 1=out
1203
- uniform float uIntensity;
1204
- uniform float uEasing;
1205
- uniform float uBlur;
1206
-
1207
- // Easing functions
1208
- float easeIn(float t) {
1209
- return t * t;
1210
- }
1211
-
1212
- float easeOut(float t) {
1213
- return t * (2.0 - t);
1214
- }
1215
-
1216
- float easeInOut(float t) {
1217
- return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
1218
- }
1219
-
1220
- float applyEasing(float t, float easingType) {
1221
- if (easingType < 0.5) return t; // linear
1222
- if (easingType < 1.5) return easeIn(t);
1223
- if (easingType < 2.5) return easeOut(t);
1224
- return easeInOut(t);
1225
- }
1226
-
1227
- vec4 sampleWithBlur(sampler2D tex, vec2 uv, float blurAmount) {
1228
- if (uBlur < 0.5 || blurAmount < 0.01) {
1229
- return texture(tex, uv);
1230
- }
1231
-
1232
- // Simple 5-tap blur
1233
- vec4 color = vec4(0.0);
1234
- float offset = blurAmount * 0.01;
1235
-
1236
- color += texture(tex, uv) * 0.4;
1237
- color += texture(tex, uv + vec2(offset, 0.0)) * 0.15;
1238
- color += texture(tex, uv - vec2(offset, 0.0)) * 0.15;
1239
- color += texture(tex, uv + vec2(0.0, offset)) * 0.15;
1240
- color += texture(tex, uv - vec2(0.0, offset)) * 0.15;
1241
-
1242
- return color;
1243
- }
1244
-
1245
- void main() {
1246
- float t = applyEasing(uProgress, uEasing);
1247
- vec2 center = vec2(0.5, 0.5);
1248
-
1249
- // Calculate zoom scales
1250
- float scaleA, scaleB;
1251
-
1252
- if (uDirection < 0.5) {
1253
- // Zoom in: A shrinks, B grows from small
1254
- scaleA = 1.0 + t * uIntensity;
1255
- scaleB = 1.0 - (1.0 - t) * uIntensity;
1256
- } else {
1257
- // Zoom out: A grows, B shrinks to small
1258
- scaleA = 1.0 - t * uIntensity * 0.5;
1259
- scaleB = 1.0 + (1.0 - t) * uIntensity;
1260
- }
1261
-
1262
- // Apply zoom
1263
- vec2 uvA = (vNormalizedCoord - center) / scaleA + center;
1264
- vec2 uvB = (vNormalizedCoord - center) / scaleB + center;
1265
-
1266
- // Blur amount based on zoom speed
1267
- float blurAmountA = abs(scaleA - 1.0) * 2.0;
1268
- float blurAmountB = abs(scaleB - 1.0) * 2.0;
1269
-
1270
- // Sample with optional blur
1271
- vec4 colorA = sampleWithBlur(uFrom, uvA, blurAmountA);
1272
- vec4 colorB = sampleWithBlur(uTo, uvB, blurAmountB);
1273
-
1274
- // Handle out-of-bounds UVs
1275
- if (uvA.x < 0.0 || uvA.x > 1.0 || uvA.y < 0.0 || uvA.y > 1.0) {
1276
- colorA = vec4(0.0);
1277
- }
1278
- if (uvB.x < 0.0 || uvB.x > 1.0 || uvB.y < 0.0 || uvB.y > 1.0) {
1279
- colorB = vec4(0.0);
1280
- }
1281
-
1282
- // Blend
1283
- finalColor = mix(colorA, colorB, t);
1284
- }
1285
- `;
1286
- var ZoomTransition = {
1287
- id: "zoom",
1288
- name: "Zoom",
1289
- category: "optical-distortion",
1290
- description: "Zoom in or out while transitioning between clips with dynamic scaling and motion blur.",
1291
- tags: ["zoom", "scale", "dynamic", "motion"],
1292
- defaultDurationMs: 800,
1293
- params: [
1294
- { key: "direction", label: "Direction", type: "select", value: "in", options: ["in", "out"] },
1295
- { key: "intensity", label: "Intensity", type: "range", value: 0.5, min: 0, max: 2, step: 0.1 },
1296
- { key: "easing", label: "Easing", type: "select", value: "easeInOut", options: ["linear", "easeIn", "easeOut", "easeInOut"] },
1297
- { key: "blur", label: "Motion Blur", type: "toggle", value: true }
1298
- ],
1299
- create(params) {
1300
- const dirStr = params.direction || "in";
1301
- const dirVal = dirStr === "in" ? 0 : 1;
1302
- const easeStr = params.easing || "easeInOut";
1303
- const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
1304
- const blurVal = params.blur ?? true ? 1 : 0;
1305
- return import_pixi4.Filter.from({
1306
- gl: { vertex: defaultVertexShader, fragment: fragment4 },
1307
- resources: {
1308
- transitionUniforms: {
1309
- uProgress: { value: 0, type: "f32" },
1310
- uDirection: { value: dirVal, type: "f32" },
1311
- uIntensity: { value: params.intensity ?? 0.5, type: "f32" },
1312
- uEasing: { value: easeVal, type: "f32" },
1313
- uBlur: { value: blurVal, type: "f32" }
1314
- }
1315
- }
1316
- });
1317
- },
1318
- updateProgress(filter, progress, params) {
1319
- const u = filter.resources?.transitionUniforms?.uniforms;
1320
- if (u) {
1321
- u.uProgress = progress;
1322
- const dirStr = params.direction || "in";
1323
- u.uDirection = dirStr === "in" ? 0 : 1;
1324
- u.uIntensity = params.intensity ?? 0.5;
1325
- const easeStr = params.easing || "easeInOut";
1326
- u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
1327
- u.uBlur = params.blur ?? true ? 1 : 0;
1328
- }
1329
- }
1330
- };
1331
-
1332
- // src/effects/transitions/optical-distortion/ChromaticPushTransition.ts
1333
- var import_pixi5 = require("pixi.js");
1334
- var fragment5 = `
1335
- in vec2 vNormalizedCoord;
1336
- out vec4 finalColor;
1337
-
1338
- uniform sampler2D uFrom;
1339
- uniform sampler2D uTo;
1340
- uniform float uProgress;
1341
- uniform float uDirection; // 0=left, 1=right, 2=up, 3=down
1342
- uniform float uSplitIntensity;
1343
-
1344
- vec4 sampleChannel(sampler2D texA, sampler2D texB, vec2 baseUv, vec2 pushA, vec2 pushB, vec2 channelShift) {
1345
- vec2 uvA = baseUv + pushA + channelShift;
1346
- vec2 uvB = baseUv + pushB + channelShift;
1347
-
1348
- if (uvA.x >= 0.0 && uvA.x <= 1.0 && uvA.y >= 0.0 && uvA.y <= 1.0) {
1349
- return texture(texA, uvA);
1350
- } else if (uvB.x >= 0.0 && uvB.x <= 1.0 && uvB.y >= 0.0 && uvB.y <= 1.0) {
1351
- return texture(texB, uvB);
1352
- }
1353
- return vec4(0.0, 0.0, 0.0, 1.0);
1354
- }
1355
-
1356
- void main(void) {
1357
- vec2 uv = vNormalizedCoord;
1358
-
1359
- // Slide/push offset
1360
- vec2 offsetFrom = vec2(0.0);
1361
- vec2 offsetTo = vec2(0.0);
1362
-
1363
- if (uDirection < 0.5) {
1364
- // Left
1365
- offsetFrom = vec2(-uProgress, 0.0);
1366
- offsetTo = vec2(1.0 - uProgress, 0.0);
1367
- } else if (uDirection < 1.5) {
1368
- // Right
1369
- offsetFrom = vec2(uProgress, 0.0);
1370
- offsetTo = vec2(-1.0 + uProgress, 0.0);
1371
- } else if (uDirection < 2.5) {
1372
- // Up
1373
- offsetFrom = vec2(0.0, -uProgress);
1374
- offsetTo = vec2(0.0, 1.0 - uProgress);
1375
- } else {
1376
- // Down
1377
- offsetFrom = vec2(0.0, uProgress);
1378
- offsetTo = vec2(0.0, -1.0 + uProgress);
1379
- }
1380
-
1381
- // Chromatic split offset (peaks at progress = 0.5)
1382
- float splitOffset = sin(uProgress * 3.14159265) * uSplitIntensity * 0.005;
1383
-
1384
- float r = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(splitOffset, 0.0)).r;
1385
- float g = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(0.0, 0.0)).g;
1386
- float b = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(-splitOffset, 0.0)).b;
1387
- float a = sampleChannel(uFrom, uTo, uv, offsetFrom, offsetTo, vec2(0.0, 0.0)).a;
1388
-
1389
- finalColor = vec4(r, g, b, a);
1390
- }
1391
- `;
1392
- var ChromaticPushTransition = {
1393
- id: "chromatic-push",
1394
- name: "Chromatic Push",
1395
- category: "optical-distortion",
1396
- description: "A spatial push transition where R/G/B channels split and offset horizontally, peaking mid-transition.",
1397
- tags: ["chromatic", "push", "glitch", "distortion", "split"],
1398
- defaultDurationMs: 800,
1399
- params: [
1400
- { key: "direction", label: "Direction", type: "select", value: "left", options: ["left", "right", "up", "down"] },
1401
- { key: "splitIntensity", label: "Split Intensity", type: "range", value: 8, min: 0, max: 20, step: 0.5 }
1402
- ],
1403
- create(params) {
1404
- const dirStr = params.direction || "left";
1405
- const dirVal = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
1406
- return import_pixi5.Filter.from({
1407
- gl: { vertex: defaultVertexShader, fragment: fragment5 },
1408
- resources: {
1409
- transitionUniforms: {
1410
- uProgress: { value: 0, type: "f32" },
1411
- uDirection: { value: dirVal, type: "f32" },
1412
- uSplitIntensity: { value: params.splitIntensity ?? 8, type: "f32" }
1413
- }
1414
- }
1415
- });
1416
- },
1417
- updateProgress(filter, progress, params) {
1418
- const u = filter.resources?.transitionUniforms?.uniforms;
1419
- if (u) {
1420
- u.uProgress = progress;
1421
- const dirStr = params.direction || "left";
1422
- u.uDirection = dirStr === "left" ? 0 : dirStr === "right" ? 1 : dirStr === "up" ? 2 : 3;
1423
- u.uSplitIntensity = params.splitIntensity ?? 8;
1424
- }
1425
- }
1426
- };
1427
-
1428
- // src/effects/transitions/optical-distortion/RefractionWarpTransition.ts
1429
- var import_pixi6 = require("pixi.js");
1430
- var fragment6 = `
1431
- in vec2 vNormalizedCoord;
1432
- out vec4 finalColor;
1433
-
1434
- uniform sampler2D uFrom;
1435
- uniform sampler2D uTo;
1436
- uniform float uProgress;
1437
- uniform float uRippleScale;
1438
- uniform float uAmplitude;
1439
-
1440
- void main(void) {
1441
- vec2 uv = vNormalizedCoord;
1442
-
1443
- // Displacement intensity peaks at progress = 0.5
1444
- float distortion = sin(uProgress * 3.14159265);
1445
-
1446
- // Dynamic wave calculations for water/glass refraction
1447
- float waveX = sin(uv.y * uRippleScale + uProgress * 6.28) * uAmplitude * distortion;
1448
- float waveY = cos(uv.x * uRippleScale + uProgress * 6.28) * uAmplitude * distortion;
1449
-
1450
- vec2 displacedUv = clamp(uv + vec2(waveX, waveY), 0.001, 0.999);
1451
-
1452
- vec4 fromColor = texture(uFrom, displacedUv);
1453
- vec4 toColor = texture(uTo, displacedUv);
1454
-
1455
- // Crossfade under the displacement
1456
- finalColor = mix(fromColor, toColor, uProgress);
1457
- }
1458
- `;
1459
- var RefractionWarpTransition = {
1460
- id: "refraction-warp",
1461
- name: "Refraction Warp",
1462
- category: "optical-distortion",
1463
- description: "The incoming clip melts through the outgoing clip via a rippling, glass-like refraction distortion.",
1464
- tags: ["refraction", "warp", "distortion", "melt", "water"],
1465
- defaultDurationMs: 900,
1466
- params: [
1467
- { key: "rippleScale", label: "Ripple Scale", type: "range", value: 12, min: 1, max: 20, step: 0.5 },
1468
- { key: "amplitude", label: "Amplitude", type: "range", value: 0.05, min: 0, max: 0.1, step: 5e-3 }
1469
- ],
1470
- create(params) {
1471
- return import_pixi6.Filter.from({
1472
- gl: { vertex: defaultVertexShader, fragment: fragment6 },
1473
- resources: {
1474
- transitionUniforms: {
1475
- uProgress: { value: 0, type: "f32" },
1476
- uRippleScale: { value: params.rippleScale ?? 12, type: "f32" },
1477
- uAmplitude: { value: params.amplitude ?? 0.05, type: "f32" }
1478
- }
1479
- }
1480
- });
1481
- },
1482
- updateProgress(filter, progress, params) {
1483
- const u = filter.resources?.transitionUniforms?.uniforms;
1484
- if (u) {
1485
- u.uProgress = progress;
1486
- u.uRippleScale = params.rippleScale ?? 12;
1487
- u.uAmplitude = params.amplitude ?? 0.05;
1488
- }
1489
- }
1490
- };
1491
-
1492
- // src/effects/transitions/temporal/GlitchTransition.ts
1493
- var import_pixi7 = require("pixi.js");
1494
- var fragment7 = `
1495
- in vec2 vNormalizedCoord;
1496
- out vec4 finalColor;
1497
-
1498
- uniform sampler2D uFrom;
1499
- uniform sampler2D uTo;
1500
- uniform float uProgress;
1501
- uniform float uIntensity;
1502
- uniform float uBlockSize;
1503
- uniform float uRgbShift;
1504
- uniform float uNoise;
1505
- uniform vec2 uResolution;
1506
-
1507
- float rand(vec2 co) {
1508
- return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
1509
- }
1510
-
1511
- float blockRand(vec2 uv, float blockSize) {
1512
- vec2 block = floor(uv * uResolution / blockSize);
1513
- return rand(block + vec2(uProgress * 10.0));
1514
- }
1515
-
1516
- void main(void) {
1517
- vec2 uv = vNormalizedCoord;
1518
- float t = uProgress;
1519
-
1520
- // Glitch intensity peaks at mid-transition
1521
- float glitchAmount = uIntensity * (1.0 - abs(t * 2.0 - 1.0));
1522
-
1523
- // Block-based displacement
1524
- float blockR = blockRand(uv, uBlockSize);
1525
-
1526
- if (blockR < glitchAmount) {
1527
- // Random horizontal displacement
1528
- float displacement = (rand(vec2(blockR, t)) - 0.5) * glitchAmount * 0.3;
1529
- uv.x += displacement;
1530
-
1531
- // Random vertical jitter (smaller)
1532
- float jitter = (rand(vec2(blockR + 1.0, t)) - 0.5) * glitchAmount * 0.1;
1533
- uv.y += jitter;
1534
- }
1535
-
1536
- uv = clamp(uv, 0.0, 1.0);
1537
-
1538
- vec4 colorA, colorB;
1539
-
1540
- if (uRgbShift > 0.5 && glitchAmount > 0.1) {
1541
- float shiftAmount = glitchAmount * 0.01;
1542
-
1543
- float rA = texture(uFrom, uv + vec2(shiftAmount, 0.0)).r;
1544
- float gA = texture(uFrom, uv).g;
1545
- float bA = texture(uFrom, uv - vec2(shiftAmount, 0.0)).b;
1546
- colorA = vec4(rA, gA, bA, 1.0);
1547
-
1548
- float rB = texture(uTo, uv + vec2(shiftAmount, 0.0)).r;
1549
- float gB = texture(uTo, uv).g;
1550
- float bB = texture(uTo, uv - vec2(shiftAmount, 0.0)).b;
1551
- colorB = vec4(rB, gB, bB, 1.0);
1552
- } else {
1553
- colorA = texture(uFrom, uv);
1554
- colorB = texture(uTo, uv);
1555
- }
1556
-
1557
- float blockSwitch = blockRand(vNormalizedCoord, uBlockSize * 0.5);
1558
- float threshold = mix(t, 0.5, glitchAmount);
1559
-
1560
- vec4 color;
1561
- if (blockSwitch < threshold) {
1562
- color = colorB;
1563
- } else {
1564
- color = mix(colorA, colorB, t);
1565
- }
1566
-
1567
- if (uNoise > 0.5 && glitchAmount > 0.2) {
1568
- float noiseVal = rand(vNormalizedCoord * 500.0 + vec2(t * 100.0));
1569
- if (noiseVal > 0.95) {
1570
- color.rgb = vec3(noiseVal);
1571
- }
1572
- }
1573
-
1574
- if (glitchAmount > 0.4) {
1575
- float corruptionChance = rand(vec2(floor(t * 60.0)));
1576
- if (corruptionChance < glitchAmount * 0.1) {
1577
- color.rgb = 1.0 - color.rgb;
1578
- }
1579
- }
1580
-
1581
- finalColor = color;
1582
- }
1583
- `;
1584
- var GlitchTransition = {
1585
- id: "glitch",
1586
- name: "Glitch",
1587
- category: "temporal",
1588
- description: "Chaotic digital glitch with block displacement, RGB shifting, and noise artifacts.",
1589
- tags: ["glitch", "digital", "chaos", "corruption", "artifacts"],
1590
- defaultDurationMs: 500,
1591
- // Short strobe/glitch style duration
1592
- params: [
1593
- { key: "intensity", label: "Intensity", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 },
1594
- { key: "blockSize", label: "Block Size", type: "range", value: 10, min: 1, max: 50, step: 1 },
1595
- { key: "rgbShift", label: "RGB Shift", type: "toggle", value: true },
1596
- { key: "noise", label: "Noise", type: "toggle", value: true }
1597
- ],
1598
- create(params) {
1599
- const rgbShiftVal = params.rgbShift ?? true ? 1 : 0;
1600
- const noiseVal = params.noise ?? true ? 1 : 0;
1601
- return import_pixi7.Filter.from({
1602
- gl: { vertex: defaultVertexShader, fragment: fragment7 },
1603
- resources: {
1604
- transitionUniforms: {
1605
- uProgress: { value: 0, type: "f32" },
1606
- uIntensity: { value: params.intensity ?? 0.5, type: "f32" },
1607
- uBlockSize: { value: params.blockSize ?? 10, type: "f32" },
1608
- uRgbShift: { value: rgbShiftVal, type: "f32" },
1609
- uNoise: { value: noiseVal, type: "f32" },
1610
- uResolution: { value: [1280, 720], type: "vec2<f32>" }
1611
- }
1612
- }
1613
- });
1614
- },
1615
- updateProgress(filter, progress, params) {
1616
- const u = filter.resources?.transitionUniforms?.uniforms;
1617
- if (u) {
1618
- u.uProgress = progress;
1619
- u.uIntensity = params.intensity ?? 0.5;
1620
- u.uBlockSize = params.blockSize ?? 10;
1621
- u.uRgbShift = params.rgbShift ?? true ? 1 : 0;
1622
- u.uNoise = params.noise ?? true ? 1 : 0;
1623
- }
1624
- }
1625
- };
1626
-
1627
- // src/effects/transitions/temporal/StrobeCutTransition.ts
1628
- var import_pixi8 = require("pixi.js");
1629
- var fragment8 = `
1630
- in vec2 vNormalizedCoord;
1631
- out vec4 finalColor;
1632
-
1633
- uniform sampler2D uFrom;
1634
- uniform sampler2D uTo;
1635
- uniform float uProgress;
1636
- uniform float uFlashRate;
1637
- uniform float uUseFlashColor;
1638
- uniform vec3 uFlashColor;
1639
-
1640
- void main(void) {
1641
- vec2 uv = vNormalizedCoord;
1642
-
1643
- // Flash rate accelerates as progress goes 0 -> 1
1644
- float currentRate = mix(4.0, uFlashRate, uProgress);
1645
-
1646
- // Calculate strobe state: 0.0 or 1.0
1647
- float strobeVal = fract(uProgress * currentRate * 3.0);
1648
- float choice = step(strobeVal, 0.5);
1649
-
1650
- vec4 fromColor = texture(uFrom, uv);
1651
- vec4 toColor = texture(uTo, uv);
1652
-
1653
- // Hard cut/switch based on strobe choice
1654
- // But as progress approaches 1.0, we lean more towards toColor
1655
- float blendVal = mix(choice, 1.0, uProgress * uProgress);
1656
- vec4 baseColor = mix(fromColor, toColor, step(0.5, blendVal));
1657
-
1658
- if (uUseFlashColor > 0.5) {
1659
- // Flash glow intensity spikes at strobe peaks
1660
- float flashGlow = sin(strobeVal * 3.14159) * (1.0 - abs(uProgress - 0.5) * 2.0);
1661
- baseColor = mix(baseColor, vec4(uFlashColor, 1.0), flashGlow * 0.5);
1662
- }
1663
-
1664
- finalColor = baseColor;
1665
- }
1666
- `;
1667
- var hexToVec3 = (hex) => {
1668
- const r = parseInt(hex.slice(1, 3), 16) / 255;
1669
- const g = parseInt(hex.slice(3, 5), 16) / 255;
1670
- const b = parseInt(hex.slice(5, 7), 16) / 255;
1671
- return [r, g, b];
1672
- };
1673
- var StrobeCutTransition = {
1674
- id: "strobe-cut",
1675
- name: "Strobe Cut",
1676
- category: "temporal",
1677
- description: "Rapidly strobes between outgoing and incoming clips at an accelerating rate with optional color flashes.",
1678
- tags: ["temporal", "strobe", "flash", "cut", "rhythm"],
1679
- defaultDurationMs: 400,
1680
- // Accelerating strobe cut works best in short duration
1681
- params: [
1682
- { key: "flashRate", label: "Flash Rate", type: "range", value: 12, min: 4, max: 24, step: 1 },
1683
- { key: "useFlashColor", label: "Use Flash Color", type: "toggle", value: true },
1684
- { key: "flashColor", label: "Flash Color", type: "color", value: "#FFFFFF" }
1685
- ],
1686
- create(params) {
1687
- const useColor = params.useFlashColor ?? true ? 1 : 0;
1688
- const colorHex = params.flashColor ?? "#FFFFFF";
1689
- const colorVal = hexToVec3(colorHex);
1690
- return import_pixi8.Filter.from({
1691
- gl: { vertex: defaultVertexShader, fragment: fragment8 },
1692
- resources: {
1693
- transitionUniforms: {
1694
- uProgress: { value: 0, type: "f32" },
1695
- uFlashRate: { value: params.flashRate ?? 12, type: "f32" },
1696
- uUseFlashColor: { value: useColor, type: "f32" },
1697
- uFlashColor: { value: colorVal, type: "vec3<f32>" }
1698
- }
1699
- }
1700
- });
1701
- },
1702
- updateProgress(filter, progress, params) {
1703
- const u = filter.resources?.transitionUniforms?.uniforms;
1704
- if (u) {
1705
- u.uProgress = progress;
1706
- u.uFlashRate = params.flashRate ?? 12;
1707
- u.uUseFlashColor = params.useFlashColor ?? true ? 1 : 0;
1708
- const colorHex = params.flashColor ?? "#FFFFFF";
1709
- u.uFlashColor = hexToVec3(colorHex);
1710
- }
1711
- }
1712
- };
1713
-
1714
- // src/effects/transitions/temporal/FrameHoldStutterTransition.ts
1715
- var import_pixi9 = require("pixi.js");
1716
- var fragment9 = `
1717
- in vec2 vNormalizedCoord;
1718
- out vec4 finalColor;
1719
-
1720
- uniform sampler2D uFrom;
1721
- uniform sampler2D uTo;
1722
- uniform float uProgress;
1723
- uniform float uStutterCount;
1724
- uniform float uHoldRatio;
1725
-
1726
- void main(void) {
1727
- vec2 uv = vNormalizedCoord;
1728
-
1729
- vec4 color;
1730
-
1731
- if (uProgress < uHoldRatio) {
1732
- // Calculate fraction of current stutter step for pulse effects
1733
- float stepProgress = fract(uProgress * uStutterCount / uHoldRatio);
1734
- float shift = sin(stepProgress * 3.14159) * 0.015;
1735
-
1736
- // Sample outgoing clip with chromatic stutter pulse
1737
- float r = texture(uFrom, uv + vec2(shift, 0.0)).r;
1738
- float g = texture(uFrom, uv).g;
1739
- float b = texture(uFrom, uv - vec2(shift, 0.0)).b;
1740
- color = vec4(r, g, b, 1.0);
1741
- } else {
1742
- // Hard cut to incoming clip in the final percentage
1743
- color = texture(uTo, uv);
1744
- }
1745
-
1746
- finalColor = color;
1747
- }
1748
- `;
1749
- var FrameHoldStutterTransition = {
1750
- id: "frame-hold-stutter",
1751
- name: "Frame Hold Stutter",
1752
- category: "temporal",
1753
- description: "Freezes and stutters the outgoing clip rhythmically before cutting hard to the incoming clip.",
1754
- tags: ["temporal", "stutter", "freeze", "hold", "rhythm"],
1755
- defaultDurationMs: 600,
1756
- params: [
1757
- { key: "stutterCount", label: "Stutter Count", type: "range", value: 3, min: 2, max: 5, step: 1 },
1758
- { key: "holdRatio", label: "Hold Ratio", type: "range", value: 0.7, min: 0.5, max: 0.9, step: 0.05 }
1759
- ],
1760
- create(params) {
1761
- return import_pixi9.Filter.from({
1762
- gl: { vertex: defaultVertexShader, fragment: fragment9 },
1763
- resources: {
1764
- transitionUniforms: {
1765
- uProgress: { value: 0, type: "f32" },
1766
- uStutterCount: { value: params.stutterCount ?? 3, type: "f32" },
1767
- uHoldRatio: { value: params.holdRatio ?? 0.7, type: "f32" }
1768
- }
1769
- }
1770
- });
1771
- },
1772
- updateProgress(filter, progress, params) {
1773
- const u = filter.resources?.transitionUniforms?.uniforms;
1774
- if (u) {
1775
- const holdRatio = params.holdRatio ?? 0.7;
1776
- const stutterCount = params.stutterCount ?? 3;
1777
- let displayProgress = progress;
1778
- if (progress < holdRatio) {
1779
- const step = Math.floor(progress * stutterCount / holdRatio) / stutterCount;
1780
- displayProgress = step * holdRatio;
1781
- }
1782
- u.uProgress = displayProgress;
1783
- u.uStutterCount = stutterCount;
1784
- u.uHoldRatio = holdRatio;
1785
- }
1786
- }
1787
- };
1788
-
1789
- // src/effects/transitions/particle-dissolve/CrossDissolveTransition.ts
1790
- var import_pixi10 = require("pixi.js");
1791
- var fragment10 = `
1792
- in vec2 vNormalizedCoord;
1793
- out vec4 finalColor;
1794
-
1795
- uniform sampler2D uFrom;
1796
- uniform sampler2D uTo;
1797
- uniform float uProgress;
1798
- uniform float uEasing;
1799
- uniform vec3 uFadeColor;
1800
- uniform float uUseFadeColor;
1801
-
1802
- float easeIn(float t) {
1803
- return t * t;
1804
- }
1805
-
1806
- float easeOut(float t) {
1807
- return t * (2.0 - t);
1808
- }
1809
-
1810
- float easeInOut(float t) {
1811
- return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
1812
- }
1813
-
1814
- float smoothStepEase(float t) {
1815
- return t * t * (3.0 - 2.0 * t);
1816
- }
1817
-
1818
- float applyEasing(float t, float easingType) {
1819
- if (easingType < 0.5) return t; // linear
1820
- if (easingType < 1.5) return easeIn(t);
1821
- if (easingType < 2.5) return easeOut(t);
1822
- if (easingType < 3.5) return easeInOut(t);
1823
- return smoothStepEase(t);
1824
- }
1825
-
1826
- void main(void) {
1827
- vec2 uv = vNormalizedCoord;
1828
- float t = applyEasing(uProgress, uEasing);
1829
-
1830
- vec4 colorA = texture(uFrom, uv);
1831
- vec4 colorB = texture(uTo, uv);
1832
- vec4 result;
1833
-
1834
- if (uUseFadeColor > 0.5) {
1835
- if (t < 0.5) {
1836
- float fadeOut = t * 2.0;
1837
- result = mix(colorA, vec4(uFadeColor, 1.0), fadeOut);
1838
- } else {
1839
- float fadeIn = (t - 0.5) * 2.0;
1840
- result = mix(vec4(uFadeColor, 1.0), colorB, fadeIn);
1841
- }
1842
- } else {
1843
- result = mix(colorA, colorB, t);
1844
- }
1845
-
1846
- finalColor = result;
1847
- }
1848
- `;
1849
- var hexToVec32 = (hex) => {
1850
- const r = parseInt(hex.slice(1, 3), 16) / 255;
1851
- const g = parseInt(hex.slice(3, 5), 16) / 255;
1852
- const b = parseInt(hex.slice(5, 7), 16) / 255;
1853
- return [r, g, b];
1854
- };
1855
- var CrossDissolveTransition = {
1856
- id: "cross-dissolve",
1857
- name: "Cross Dissolve",
1858
- category: "particle-dissolve",
1859
- description: "Classic fade between two clips with alpha blending or optional solid color dip.",
1860
- tags: ["transition", "blend", "dissolve", "fade", "alpha"],
1861
- defaultDurationMs: 800,
1862
- params: [
1863
- { key: "easing", label: "Easing", type: "select", value: "linear", options: ["linear", "easeIn", "easeOut", "easeInOut", "smoothstep"] },
1864
- { key: "useFadeColor", label: "Fade Through Color", type: "toggle", value: false },
1865
- { key: "fadeColor", label: "Fade Color", type: "color", value: "#000000" }
1866
- ],
1867
- create(params) {
1868
- const easeStr = params.easing || "linear";
1869
- const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : easeStr === "easeInOut" ? 3 : 4;
1870
- const useFadeVal = params.useFadeColor ?? false ? 1 : 0;
1871
- const colorHex = params.fadeColor ?? "#000000";
1872
- const colorVal = hexToVec32(colorHex);
1873
- return import_pixi10.Filter.from({
1874
- gl: { vertex: defaultVertexShader, fragment: fragment10 },
1875
- resources: {
1876
- transitionUniforms: {
1877
- uProgress: { value: 0, type: "f32" },
1878
- uEasing: { value: easeVal, type: "f32" },
1879
- uUseFadeColor: { value: useFadeVal, type: "f32" },
1880
- uFadeColor: { value: colorVal, type: "vec3<f32>" }
1881
- }
1882
- }
1883
- });
1884
- },
1885
- updateProgress(filter, progress, params) {
1886
- const u = filter.resources?.transitionUniforms?.uniforms;
1887
- if (u) {
1888
- u.uProgress = progress;
1889
- const easeStr = params.easing || "linear";
1890
- u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : easeStr === "easeInOut" ? 3 : 4;
1891
- u.uUseFadeColor = params.useFadeColor ?? false ? 1 : 0;
1892
- const colorHex = params.fadeColor ?? "#000000";
1893
- u.uFadeColor = hexToVec32(colorHex);
1894
- }
1895
- }
1896
- };
1897
-
1898
- // src/effects/transitions/particle-dissolve/DirectionalDissolveTransition.ts
1899
- var import_pixi11 = require("pixi.js");
1900
- var fragment11 = `
1901
- in vec2 vNormalizedCoord;
1902
- out vec4 finalColor;
1903
-
1904
- uniform sampler2D uFrom;
1905
- uniform sampler2D uTo;
1906
- uniform float uProgress;
1907
- uniform float uDirection; // 0=horizontal, 1=vertical, 2=diagonal
1908
- uniform float uNoiseScale;
1909
- uniform float uEdgeSharpness;
1910
-
1911
- float hash(vec2 p) {
1912
- return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
1913
- }
1914
-
1915
- void main(void) {
1916
- vec2 uv = vNormalizedCoord;
1917
-
1918
- // Directional gradient
1919
- float grad = 0.0;
1920
- if (uDirection < 0.5) {
1921
- grad = uv.x;
1922
- } else if (uDirection < 1.5) {
1923
- grad = uv.y;
1924
- } else {
1925
- grad = (uv.x + uv.y) * 0.5;
1926
- }
1927
-
1928
- // Pixelated noise map
1929
- float noiseVal = hash(floor(uv * uNoiseScale));
1930
-
1931
- // Combine gradient and noise
1932
- float value = grad + (noiseVal - 0.5) * 0.3;
1933
-
1934
- // Map progress from 0.0 -> 1.3 to ensure clean complete state at both ends
1935
- float progressMapped = uProgress * 1.3;
1936
-
1937
- // Sharpness control
1938
- float width = 0.2 * (1.0 - uEdgeSharpness) + 0.001;
1939
- float alpha = smoothstep(progressMapped - width, progressMapped + width, value);
1940
-
1941
- vec4 fromColor = texture(uFrom, uv);
1942
- vec4 toColor = texture(uTo, uv);
1943
-
1944
- finalColor = mix(toColor, fromColor, alpha);
1945
- }
1946
- `;
1947
- var DirectionalDissolveTransition = {
1948
- id: "directional-dissolve",
1949
- name: "Directional Dissolve",
1950
- category: "particle-dissolve",
1951
- description: "Dissolves outgoing clip into incoming clip using a noise threshold that sweeps in a specified direction.",
1952
- tags: ["particle", "dissolve", "noise", "sweep", "wave"],
1953
- defaultDurationMs: 900,
1954
- params: [
1955
- { key: "direction", label: "Direction", type: "select", value: "horizontal", options: ["horizontal", "vertical", "diagonal"] },
1956
- { key: "noiseScale", label: "Noise Scale", type: "range", value: 15, min: 1, max: 30, step: 1 },
1957
- { key: "edgeSharpness", label: "Edge Sharpness", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
1958
- ],
1959
- create(params) {
1960
- const dirStr = params.direction || "horizontal";
1961
- const dirVal = dirStr === "horizontal" ? 0 : dirStr === "vertical" ? 1 : 2;
1962
- return import_pixi11.Filter.from({
1963
- gl: { vertex: defaultVertexShader, fragment: fragment11 },
1964
- resources: {
1965
- transitionUniforms: {
1966
- uProgress: { value: 0, type: "f32" },
1967
- uDirection: { value: dirVal, type: "f32" },
1968
- uNoiseScale: { value: params.noiseScale ?? 15, type: "f32" },
1969
- uEdgeSharpness: { value: params.edgeSharpness ?? 0.5, type: "f32" }
1970
- }
1971
- }
1972
- });
1973
- },
1974
- updateProgress(filter, progress, params) {
1975
- const u = filter.resources?.transitionUniforms?.uniforms;
1976
- if (u) {
1977
- u.uProgress = progress;
1978
- const dirStr = params.direction || "horizontal";
1979
- u.uDirection = dirStr === "horizontal" ? 0 : dirStr === "vertical" ? 1 : 2;
1980
- u.uNoiseScale = params.noiseScale ?? 15;
1981
- u.uEdgeSharpness = params.edgeSharpness ?? 0.5;
1982
- }
1983
- }
1984
- };
1985
-
1986
- // src/effects/transitions/particle-dissolve/PixelateCollapseTransition.ts
1987
- var import_pixi12 = require("pixi.js");
1988
- var fragment12 = `
1989
- in vec2 vNormalizedCoord;
1990
- out vec4 finalColor;
1991
-
1992
- uniform sampler2D uFrom;
1993
- uniform sampler2D uTo;
1994
- uniform float uProgress;
1995
- uniform float uMaxBlockSize;
1996
- uniform float uSymmetry;
1997
- uniform vec2 uResolution;
1998
-
1999
- void main(void) {
2000
- vec2 uv = vNormalizedCoord;
2001
-
2002
- // Calculate bell curve for block size peaking at progress = 0.5
2003
- float bellCurve = 0.0;
2004
- if (uProgress < 0.5) {
2005
- bellCurve = uProgress * 2.0;
2006
- } else {
2007
- // If asymmetric, make B resolve faster (decay speed = 4.0 instead of 2.0)
2008
- float decayFactor = (uSymmetry > 0.5) ? 2.0 : 4.0;
2009
- bellCurve = max(0.0, 1.0 - (uProgress - 0.5) * decayFactor);
2010
- }
2011
-
2012
- // Determine current pixel block size (1.0 = no pixelation)
2013
- float currentBlockSize = mix(1.0, uMaxBlockSize, bellCurve);
2014
-
2015
- // Quantize texture coordinates
2016
- vec2 blockResolution = uResolution / currentBlockSize;
2017
- vec2 pixelatedUv = floor(uv * blockResolution) / blockResolution;
2018
-
2019
- vec4 color;
2020
- if (uProgress < 0.5) {
2021
- color = texture(uFrom, pixelatedUv);
2022
- } else {
2023
- color = texture(uTo, pixelatedUv);
2024
- }
2025
-
2026
- finalColor = color;
2027
- }
2028
- `;
2029
- var PixelateCollapseTransition = {
2030
- id: "pixelate-collapse",
2031
- name: "Pixelate Collapse",
2032
- category: "particle-dissolve",
2033
- description: "The outgoing clip breaks into increasingly large pixel blocks before collapsing into the incoming clip.",
2034
- tags: ["pixelate", "collapse", "particle", "grid", "pixel"],
2035
- defaultDurationMs: 800,
2036
- params: [
2037
- { key: "maxBlockSize", label: "Max Block Size", type: "range", value: 32, min: 8, max: 64, step: 1 },
2038
- { key: "symmetry", label: "Symmetric Resolution", type: "toggle", value: true }
2039
- ],
2040
- create(params) {
2041
- const symmetryVal = params.symmetry ?? true ? 1 : 0;
2042
- return import_pixi12.Filter.from({
2043
- gl: { vertex: defaultVertexShader, fragment: fragment12 },
2044
- resources: {
2045
- transitionUniforms: {
2046
- uProgress: { value: 0, type: "f32" },
2047
- uMaxBlockSize: { value: params.maxBlockSize ?? 32, type: "f32" },
2048
- uSymmetry: { value: symmetryVal, type: "f32" },
2049
- uResolution: { value: [1280, 720], type: "vec2<f32>" }
2050
- }
2051
- }
2052
- });
2053
- },
2054
- updateProgress(filter, progress, params) {
2055
- const u = filter.resources?.transitionUniforms?.uniforms;
2056
- if (u) {
2057
- u.uProgress = progress;
2058
- u.uMaxBlockSize = params.maxBlockSize ?? 32;
2059
- u.uSymmetry = params.symmetry ?? true ? 1 : 0;
2060
- }
2061
- }
2062
- };
2063
-
2064
- // src/effects/transitions/light-based/LumaWipeTransition.ts
2065
- var import_pixi13 = require("pixi.js");
2066
- var fragment13 = `
2067
- in vec2 vNormalizedCoord;
2068
- out vec4 finalColor;
2069
-
2070
- uniform sampler2D uFrom;
2071
- uniform sampler2D uTo;
2072
- uniform float uProgress;
2073
- uniform float uSoftness;
2074
- uniform float uInvert;
2075
- uniform float uGradient; // 0=horizontal, 1=vertical, 2=diagonal, 3=radial, 4=noise
2076
- uniform float uEasing;
2077
-
2078
- float easeIn(float t) {
2079
- return t * t;
2080
- }
2081
-
2082
- float easeOut(float t) {
2083
- return t * (2.0 - t);
2084
- }
2085
-
2086
- float easeInOut(float t) {
2087
- return t < 0.5 ? 2.0 * t * t : -1.0 + (4.0 - 2.0 * t) * t;
2088
- }
2089
-
2090
- float applyEasing(float t, float easingType) {
2091
- if (easingType < 0.5) return t; // linear
2092
- if (easingType < 1.5) return easeIn(t);
2093
- if (easingType < 2.5) return easeOut(t);
2094
- return easeInOut(t);
2095
- }
2096
-
2097
- float rand(vec2 co) {
2098
- return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
2099
- }
2100
-
2101
- float getGradient(vec2 uv, float gradientType) {
2102
- if (gradientType < 0.5) {
2103
- return uv.x;
2104
- } else if (gradientType < 1.5) {
2105
- return uv.y;
2106
- } else if (gradientType < 2.5) {
2107
- return (uv.x + uv.y) * 0.5;
2108
- } else if (gradientType < 3.5) {
2109
- vec2 center = vec2(0.5, 0.5);
2110
- return length(uv - center) * 1.414; // normalize to 0-1
2111
- } else {
2112
- return rand(floor(uv * 20.0) / 20.0);
2113
- }
2114
- }
2115
-
2116
- void main(void) {
2117
- vec2 uv = vNormalizedCoord;
2118
- float t = applyEasing(uProgress, uEasing);
2119
-
2120
- float gradient = getGradient(uv, uGradient);
2121
-
2122
- if (uInvert > 0.5) {
2123
- gradient = 1.0 - gradient;
2124
- }
2125
-
2126
- // Scale threshold map to range [0.0 - softness, 1.0 + softness] to ensure complete wipe
2127
- float mappedThreshold = mix(-uSoftness, 1.0 + uSoftness, t);
2128
-
2129
- float lower = mappedThreshold - uSoftness;
2130
- float upper = mappedThreshold + uSoftness;
2131
-
2132
- float mask = smoothstep(lower, upper, gradient);
2133
-
2134
- vec4 colorA = texture(uFrom, uv);
2135
- vec4 colorB = texture(uTo, uv);
2136
-
2137
- finalColor = mix(colorA, colorB, mask);
2138
- }
2139
- `;
2140
- var LumaWipeTransition = {
2141
- id: "luma-wipe",
2142
- name: "Luma Wipe",
2143
- category: "light-based",
2144
- description: "Transitions between clips based on luminance threshold using a directional, radial, or noise gradient.",
2145
- tags: ["wipe", "luma", "mask", "reveal", "gradient"],
2146
- defaultDurationMs: 800,
2147
- params: [
2148
- { key: "gradient", label: "Gradient Type", type: "select", value: "diagonal", options: ["horizontal", "vertical", "diagonal", "radial", "noise"] },
2149
- { key: "softness", label: "Softness", type: "range", value: 0.1, min: 0, max: 0.5, step: 0.01 },
2150
- { key: "invert", label: "Invert", type: "toggle", value: false },
2151
- { key: "easing", label: "Easing", type: "select", value: "linear", options: ["linear", "easeIn", "easeOut", "easeInOut"] }
2152
- ],
2153
- create(params) {
2154
- const gradStr = params.gradient || "diagonal";
2155
- const gradVal = gradStr === "horizontal" ? 0 : gradStr === "vertical" ? 1 : gradStr === "diagonal" ? 2 : gradStr === "radial" ? 3 : 4;
2156
- const easeStr = params.easing || "linear";
2157
- const easeVal = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
2158
- const invertVal = params.invert ?? false ? 1 : 0;
2159
- return import_pixi13.Filter.from({
2160
- gl: { vertex: defaultVertexShader, fragment: fragment13 },
2161
- resources: {
2162
- transitionUniforms: {
2163
- uProgress: { value: 0, type: "f32" },
2164
- uSoftness: { value: params.softness ?? 0.1, type: "f32" },
2165
- uInvert: { value: invertVal, type: "f32" },
2166
- uGradient: { value: gradVal, type: "f32" },
2167
- uEasing: { value: easeVal, type: "f32" }
2168
- }
2169
- }
2170
- });
2171
- },
2172
- updateProgress(filter, progress, params) {
2173
- const u = filter.resources?.transitionUniforms?.uniforms;
2174
- if (u) {
2175
- u.uProgress = progress;
2176
- u.uSoftness = params.softness ?? 0.1;
2177
- u.uInvert = params.invert ?? false ? 1 : 0;
2178
- const gradStr = params.gradient || "diagonal";
2179
- u.uGradient = gradStr === "horizontal" ? 0 : gradStr === "vertical" ? 1 : gradStr === "diagonal" ? 2 : gradStr === "radial" ? 3 : 4;
2180
- const easeStr = params.easing || "linear";
2181
- u.uEasing = easeStr === "linear" ? 0 : easeStr === "easeIn" ? 1 : easeStr === "easeOut" ? 2 : 3;
2182
- }
2183
- }
2184
- };
2185
-
2186
- // src/effects/transitions/light-based/LightLeakSweepTransition.ts
2187
- var import_pixi14 = require("pixi.js");
2188
- var fragment14 = `
2189
- in vec2 vNormalizedCoord;
2190
- out vec4 finalColor;
2191
-
2192
- uniform sampler2D uFrom;
2193
- uniform sampler2D uTo;
2194
- uniform float uProgress;
2195
- uniform float uBandWidth;
2196
- uniform float uAngle; // in degrees
2197
- uniform vec3 uLeakColor;
2198
-
2199
- void main(void) {
2200
- vec2 uv = vNormalizedCoord;
2201
-
2202
- // Convert angle to radians
2203
- float rad = uAngle * 3.14159265 / 180.0;
2204
-
2205
- // Project UV onto the sweep axis
2206
- vec2 dir = vec2(cos(rad), sin(rad));
2207
- float linePos = dot(uv - vec2(0.5), dir) + 0.5;
2208
-
2209
- // Map sweep center position to sweep completely off edges
2210
- float sweepCenter = mix(-uBandWidth, 1.0 + uBandWidth, uProgress);
2211
- float dist = linePos - sweepCenter;
2212
-
2213
- // Wipe mask (0.0 = incoming, 1.0 = outgoing)
2214
- float mask = smoothstep(-uBandWidth * 0.5, uBandWidth * 0.5, dist);
2215
-
2216
- // Light leak glow band centered at the sweep line
2217
- float glow = smoothstep(uBandWidth, 0.0, abs(dist));
2218
-
2219
- vec4 fromColor = texture(uFrom, uv);
2220
- vec4 toColor = texture(uTo, uv);
2221
-
2222
- vec4 baseColor = mix(toColor, fromColor, mask);
2223
-
2224
- // Additive warm light leak sweep glow
2225
- finalColor = vec4(clamp(baseColor.rgb + uLeakColor * glow * 1.3, 0.0, 1.0), baseColor.a);
2226
- }
2227
- `;
2228
- var hexToVec33 = (hex) => {
2229
- const r = parseInt(hex.slice(1, 3), 16) / 255;
2230
- const g = parseInt(hex.slice(3, 5), 16) / 255;
2231
- const b = parseInt(hex.slice(5, 7), 16) / 255;
2232
- return [r, g, b];
2233
- };
2234
- var LightLeakSweepTransition = {
2235
- id: "light-leak-sweep",
2236
- name: "Light Leak Sweep",
2237
- category: "light-based",
2238
- description: "A warm light leak sweeps across the frame, wiping the outgoing clip into the incoming clip under the glow.",
2239
- tags: ["light", "leak", "sweep", "glow", "warm"],
2240
- defaultDurationMs: 900,
2241
- params: [
2242
- { key: "leakColor", label: "Leak Color", type: "color", value: "#FF9E3B" },
2243
- // Warm amber
2244
- { key: "bandWidth", label: "Band Width", type: "range", value: 0.3, min: 0.1, max: 0.5, step: 0.01 },
2245
- { key: "angle", label: "Sweep Angle", type: "range", value: 45, min: 0, max: 90, step: 1 }
2246
- ],
2247
- create(params) {
2248
- const colorHex = params.leakColor ?? "#FF9E3B";
2249
- const colorVal = hexToVec33(colorHex);
2250
- return import_pixi14.Filter.from({
2251
- gl: { vertex: defaultVertexShader, fragment: fragment14 },
2252
- resources: {
2253
- transitionUniforms: {
2254
- uProgress: { value: 0, type: "f32" },
2255
- uBandWidth: { value: params.bandWidth ?? 0.3, type: "f32" },
2256
- uAngle: { value: params.angle ?? 45, type: "f32" },
2257
- uLeakColor: { value: colorVal, type: "vec3<f32>" }
2258
- }
2259
- }
2260
- });
2261
- },
2262
- updateProgress(filter, progress, params) {
2263
- const u = filter.resources?.transitionUniforms?.uniforms;
2264
- if (u) {
2265
- u.uProgress = progress;
2266
- u.uBandWidth = params.bandWidth ?? 0.3;
2267
- u.uAngle = params.angle ?? 45;
2268
- const colorHex = params.leakColor ?? "#FF9E3B";
2269
- u.uLeakColor = hexToVec33(colorHex);
2270
- }
2271
- }
2272
- };
2273
-
2274
- // src/effects/transitions/light-based/FilmBurnWipeTransition.ts
2275
- var import_pixi15 = require("pixi.js");
2276
- var fragment15 = `
2277
- in vec2 vNormalizedCoord;
2278
- out vec4 finalColor;
2279
-
2280
- uniform sampler2D uFrom;
2281
- uniform sampler2D uTo;
2282
- uniform float uProgress;
2283
- uniform float uIrregularity;
2284
- uniform float uEdgeGlow;
2285
- uniform vec3 uBurnColor;
2286
-
2287
- float hash(vec2 p) {
2288
- return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
2289
- }
2290
-
2291
- float noise(vec2 p) {
2292
- vec2 i = floor(p);
2293
- vec2 f = fract(p);
2294
- vec2 u = f * f * (3.0 - 2.0 * f);
2295
- return mix(mix(hash(i + vec2(0.0, 0.0)), hash(i + vec2(1.0, 0.0)), u.x),
2296
- mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y);
2297
- }
2298
-
2299
- void main(void) {
2300
- vec2 uv = vNormalizedCoord;
2301
-
2302
- // Procedural layered noise for organic melting outline
2303
- float n = noise(uv * 6.0) * 0.7 + noise(uv * 12.0) * 0.3;
2304
- float burnValue = uv.x + n * uIrregularity * 0.4;
2305
-
2306
- // Map progress to sweep across the screen completely
2307
- float threshold = uProgress * 1.4;
2308
-
2309
- // Mask for clean swap (0.0 = burnt/To, 1.0 = normal/From)
2310
- float burnMask = smoothstep(threshold - 0.01, threshold + 0.01, burnValue);
2311
-
2312
- vec4 fromColor = texture(uFrom, uv);
2313
- vec4 toColor = texture(uTo, uv);
2314
- vec4 baseColor = mix(toColor, fromColor, burnMask);
2315
-
2316
- // Glowing border along the melting front
2317
- float edgeThickness = 0.05 * uEdgeGlow + 0.001;
2318
- float edgeVal = abs(burnValue - threshold);
2319
- float edge = 1.0 - smoothstep(0.0, edgeThickness, edgeVal);
2320
-
2321
- if (edge > 0.001) {
2322
- // Hot orange outer glow, blending into hot white uBurnColor at the core
2323
- vec3 fireGlow = vec3(1.0, 0.35, 0.05); // Hot orange
2324
- vec3 hotEdge = mix(fireGlow, uBurnColor, smoothstep(0.5, 1.0, edge));
2325
- baseColor.rgb = clamp(baseColor.rgb + hotEdge * edge * 1.6, 0.0, 1.0);
2326
- }
2327
-
2328
- finalColor = baseColor;
2329
- }
2330
- `;
2331
- var hexToVec34 = (hex) => {
2332
- const r = parseInt(hex.slice(1, 3), 16) / 255;
2333
- const g = parseInt(hex.slice(3, 5), 16) / 255;
2334
- const b = parseInt(hex.slice(5, 7), 16) / 255;
2335
- return [r, g, b];
2336
- };
2337
- var FilmBurnWipeTransition = {
2338
- id: "film-burn-wipe",
2339
- name: "Film Burn Wipe",
2340
- category: "light-based",
2341
- description: "An organic, irregular burn edge eats through the outgoing clip to reveal the incoming clip, with a hot glow along the melt line.",
2342
- tags: ["film", "burn", "wipe", "glow", "organic"],
2343
- defaultDurationMs: 950,
2344
- params: [
2345
- { key: "burnColor", label: "Burn Color", type: "color", value: "#FFFFFF" },
2346
- // Hot white core
2347
- { key: "irregularity", label: "Irregularity", type: "range", value: 0.6, min: 0, max: 1, step: 0.05 },
2348
- { key: "edgeGlow", label: "Edge Glow", type: "range", value: 0.7, min: 0, max: 1, step: 0.05 }
2349
- ],
2350
- create(params) {
2351
- const colorHex = params.burnColor ?? "#FFFFFF";
2352
- const colorVal = hexToVec34(colorHex);
2353
- return import_pixi15.Filter.from({
2354
- gl: { vertex: defaultVertexShader, fragment: fragment15 },
2355
- resources: {
2356
- transitionUniforms: {
2357
- uProgress: { value: 0, type: "f32" },
2358
- uIrregularity: { value: params.irregularity ?? 0.6, type: "f32" },
2359
- uEdgeGlow: { value: params.edgeGlow ?? 0.7, type: "f32" },
2360
- uBurnColor: { value: colorVal, type: "vec3<f32>" }
2361
- }
2362
- }
2363
- });
2364
- },
2365
- updateProgress(filter, progress, params) {
2366
- const u = filter.resources?.transitionUniforms?.uniforms;
2367
- if (u) {
2368
- u.uProgress = progress;
2369
- u.uIrregularity = params.irregularity ?? 0.6;
2370
- u.uEdgeGlow = params.edgeGlow ?? 0.7;
2371
- const colorHex = params.burnColor ?? "#FFFFFF";
2372
- u.uBurnColor = hexToVec34(colorHex);
2373
- }
2374
- }
2375
- };
2376
-
2377
- // src/effects/transitions/depth-based/DepthPushTransition.ts
2378
- var import_pixi16 = require("pixi.js");
2379
- var fragment16 = `
2380
- in vec2 vNormalizedCoord;
2381
- out vec4 finalColor;
2382
-
2383
- uniform sampler2D uFrom;
2384
- uniform sampler2D uTo;
2385
- uniform float uProgress;
2386
- uniform float uDepthCurve; // 0=linear, 1=ease-in, 2=ease-out
2387
- uniform float uAtmosphericFade; // 0 to 1
2388
-
2389
- float applyDepthCurve(float t, float curveType) {
2390
- if (curveType < 0.5) return t; // linear
2391
- if (curveType < 1.5) return t * t; // ease-in
2392
- return t * (2.0 - t); // ease-out
2393
- }
2394
-
2395
- void main() {
2396
- float t = applyDepthCurve(uProgress, uDepthCurve);
2397
-
2398
- // uTo scales from 0.3 to 1.0 (dolly in towards uTo)
2399
- float scaleTo = 0.3 + 0.7 * t;
2400
- // uFrom scales from 1.0 to 1.4 (zooms past the camera)
2401
- float scaleFrom = 1.0 + 0.4 * t;
2402
-
2403
- vec2 center = vec2(0.5);
2404
- vec2 uvTo = (vNormalizedCoord - center) / scaleTo + center;
2405
- vec2 uvFrom = (vNormalizedCoord - center) / scaleFrom + center;
2406
-
2407
- bool inTo = (uvTo.x >= 0.0 && uvTo.x <= 1.0 && uvTo.y >= 0.0 && uvTo.y <= 1.0);
2408
- bool inFrom = (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0);
2409
-
2410
- vec4 colorFrom = vec4(0.0);
2411
- if (inFrom) {
2412
- colorFrom = texture(uFrom, uvFrom);
2413
- // Darken the receding clip to simulate atmospheric/physical depth
2414
- colorFrom.rgb *= (1.0 - t * uAtmosphericFade);
2415
- }
2416
-
2417
- vec4 colorTo = vec4(0.0);
2418
- if (inTo) {
2419
- colorTo = texture(uTo, uvTo);
2420
- }
2421
-
2422
- vec4 color;
2423
- if (inTo) {
2424
- // uTo is layered on top, blending in as progress increases
2425
- color = mix(colorFrom, colorTo, t);
2426
- } else {
2427
- // Outside uTo bounds, show the fading uFrom
2428
- color = colorFrom * (1.0 - t);
2429
- }
2430
-
2431
- finalColor = color;
2432
- }
2433
- `;
2434
- var DepthPushTransition = {
2435
- id: "depth-push",
2436
- name: "Depth Push",
2437
- category: "depth-based",
2438
- description: "The incoming clip grows and brightens from deep space while the outgoing clip scales up and recedes.",
2439
- tags: ["depth", "dolly", "3d", "scale"],
2440
- defaultDurationMs: 1e3,
2441
- params: [
2442
- { key: "depthCurve", label: "Depth Curve", type: "select", value: "ease-in", options: ["linear", "ease-in", "ease-out"] },
2443
- { key: "atmosphericFade", label: "Atmospheric Fade", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
2444
- ],
2445
- create(params) {
2446
- const curveStr = params.depthCurve || "ease-in";
2447
- const curveVal = curveStr === "linear" ? 0 : curveStr === "ease-in" ? 1 : 2;
2448
- const fadeVal = params.atmosphericFade ?? 0.5;
2449
- return import_pixi16.Filter.from({
2450
- gl: { vertex: defaultVertexShader, fragment: fragment16 },
2451
- resources: {
2452
- transitionUniforms: {
2453
- uProgress: { value: 0, type: "f32" },
2454
- uDepthCurve: { value: curveVal, type: "f32" },
2455
- uAtmosphericFade: { value: fadeVal, type: "f32" }
2456
- }
2457
- }
2458
- });
2459
- },
2460
- updateProgress(filter, progress, params) {
2461
- const u = filter.resources?.transitionUniforms?.uniforms;
2462
- if (u) {
2463
- u.uProgress = progress;
2464
- const curveStr = params.depthCurve || "ease-in";
2465
- u.uDepthCurve = curveStr === "linear" ? 0 : curveStr === "ease-in" ? 1 : 2;
2466
- u.uAtmosphericFade = params.atmosphericFade ?? 0.5;
2467
- }
2468
- }
2469
- };
2470
-
2471
- // src/effects/transitions/depth-based/RackFocusBlendTransition.ts
2472
- var import_pixi17 = require("pixi.js");
2473
- var fragment17 = `
2474
- in vec2 vNormalizedCoord;
2475
- out vec4 finalColor;
2476
-
2477
- uniform sampler2D uFrom;
2478
- uniform sampler2D uTo;
2479
- uniform float uProgress;
2480
- uniform float uMaxBlur;
2481
- uniform float uFocusOffset;
2482
-
2483
- #define PI 3.14159265359
2484
-
2485
- // Smooth 8-tap single-pass blur mimicking Kawase blur
2486
- vec4 sampleBlur(sampler2D tex, vec2 uv, float blurAmount) {
2487
- if (blurAmount < 0.1) {
2488
- return texture(tex, uv);
2489
- }
2490
-
2491
- vec4 sum = vec4(0.0);
2492
- float offset = blurAmount * 0.0008;
2493
-
2494
- // First ring
2495
- sum += texture(tex, uv + vec2(-1.0, -1.0) * offset) * 0.125;
2496
- sum += texture(tex, uv + vec2(1.0, -1.0) * offset) * 0.125;
2497
- sum += texture(tex, uv + vec2(-1.0, 1.0) * offset) * 0.125;
2498
- sum += texture(tex, uv + vec2(1.0, 1.0) * offset) * 0.125;
2499
-
2500
- // Second ring (simulating deeper multi-pass blur offsets)
2501
- float offset2 = offset * 2.0;
2502
- sum += texture(tex, uv + vec2(-1.5, 0.0) * offset2) * 0.125;
2503
- sum += texture(tex, uv + vec2(1.5, 0.0) * offset2) * 0.125;
2504
- sum += texture(tex, uv + vec2(0.0, -1.5) * offset2) * 0.125;
2505
- sum += texture(tex, uv + vec2(0.0, 1.5) * offset2) * 0.125;
2506
-
2507
- return sum;
2508
- }
2509
-
2510
- void main() {
2511
- // Offset the bell curves for each clip to break symmetry and shift the focus peak
2512
- float tFrom = clamp(uProgress + uFocusOffset, 0.0, 1.0);
2513
- float tTo = clamp(uProgress - uFocusOffset, 0.0, 1.0);
2514
-
2515
- float blurFrom = uMaxBlur * sin(tFrom * PI);
2516
- float blurTo = uMaxBlur * sin(tTo * PI);
2517
-
2518
- vec2 uv = vNormalizedCoord;
2519
-
2520
- vec4 colorFrom = sampleBlur(uFrom, uv, blurFrom);
2521
- vec4 colorTo = sampleBlur(uTo, uv, blurTo);
2522
-
2523
- // Smooth crossfade underneath the blur
2524
- finalColor = mix(colorFrom, colorTo, uProgress);
2525
- }
2526
- `;
2527
- var RackFocusBlendTransition = {
2528
- id: "rack-focus-blend",
2529
- name: "Rack Focus Blend",
2530
- category: "depth-based",
2531
- description: "Defocuses the outgoing clip and sharpens the incoming clip, shifting the focal plane near the midpoint.",
2532
- tags: ["depth", "blur", "lens", "focus"],
2533
- defaultDurationMs: 1200,
2534
- params: [
2535
- { key: "maxBlur", label: "Max Blur", type: "range", value: 12, min: 4, max: 24, step: 1 },
2536
- { key: "focusOffset", label: "Focus Offset", type: "range", value: 0, min: -0.3, max: 0.3, step: 0.05 }
2537
- ],
2538
- create(params) {
2539
- const maxBlurVal = params.maxBlur ?? 12;
2540
- const offsetVal = params.focusOffset ?? 0;
2541
- return import_pixi17.Filter.from({
2542
- gl: { vertex: defaultVertexShader, fragment: fragment17 },
2543
- resources: {
2544
- transitionUniforms: {
2545
- uProgress: { value: 0, type: "f32" },
2546
- uMaxBlur: { value: maxBlurVal, type: "f32" },
2547
- uFocusOffset: { value: offsetVal, type: "f32" }
2548
- }
2549
- }
2550
- });
2551
- },
2552
- updateProgress(filter, progress, params) {
2553
- const u = filter.resources?.transitionUniforms?.uniforms;
2554
- if (u) {
2555
- u.uProgress = progress;
2556
- u.uMaxBlur = params.maxBlur ?? 12;
2557
- u.uFocusOffset = params.focusOffset ?? 0;
2558
- }
2559
- }
2560
- };
2561
-
2562
- // src/effects/transitions/depth-based/ParallaxLayerSplitTransition.ts
2563
- var import_pixi18 = require("pixi.js");
2564
- var fragment18 = `
2565
- in vec2 vNormalizedCoord;
2566
- out vec4 finalColor;
2567
-
2568
- uniform sampler2D uFrom;
2569
- uniform sampler2D uTo;
2570
- uniform float uProgress;
2571
- uniform float uBandCount;
2572
- uniform float uParallaxStrength;
2573
- uniform float uStaggerDelay;
2574
-
2575
- void main() {
2576
- vec2 uv = vNormalizedCoord;
2577
-
2578
- // Determine which horizontal band this pixel belongs to
2579
- float bandIndex = floor(uv.y * uBandCount);
2580
-
2581
- // Stagger progress per band
2582
- float delay = bandIndex * uStaggerDelay;
2583
- float maxDelay = (uBandCount - 1.0) * uStaggerDelay;
2584
- float denom = max(1.0 - maxDelay, 0.01);
2585
- float t = clamp((uProgress - delay) / denom, 0.0, 1.0);
2586
-
2587
- // Parallax speed based on band index
2588
- float speed = 1.0 + bandIndex * uParallaxStrength;
2589
-
2590
- // Shift horizontally. We shift left (adding offset to UV)
2591
- float offset = t * speed;
2592
- vec2 uvFrom = uv + vec2(offset, 0.0);
2593
-
2594
- vec4 color;
2595
- if (uvFrom.x >= 0.0 && uvFrom.x <= 1.0) {
2596
- color = texture(uFrom, uvFrom);
2597
- } else {
2598
- // Reveal the incoming clip static underneath in the gaps
2599
- color = texture(uTo, uv);
2600
- }
2601
-
2602
- finalColor = color;
2603
- }
2604
- `;
2605
- var ParallaxLayerSplitTransition = {
2606
- id: "parallax-layer-split",
2607
- name: "Parallax Layer Split",
2608
- category: "depth-based",
2609
- description: "Splits the frame into staggered horizontal strips shifting at different speeds to reveal the next clip.",
2610
- tags: ["depth", "slide", "stagger", "parallax"],
2611
- defaultDurationMs: 1e3,
2612
- params: [
2613
- { key: "bandCount", label: "Band Count", type: "range", value: 3, min: 2, max: 5, step: 1 },
2614
- { key: "parallaxStrength", label: "Parallax Strength", type: "range", value: 0.5, min: 0.2, max: 1, step: 0.05 },
2615
- { key: "staggerDelay", label: "Stagger Delay", type: "range", value: 0.1, min: 0, max: 0.3, step: 0.05 }
2616
- ],
2617
- create(params) {
2618
- const bandVal = params.bandCount ?? 3;
2619
- const strengthVal = params.parallaxStrength ?? 0.5;
2620
- const delayVal = params.staggerDelay ?? 0.1;
2621
- return import_pixi18.Filter.from({
2622
- gl: { vertex: defaultVertexShader, fragment: fragment18 },
2623
- resources: {
2624
- transitionUniforms: {
2625
- uProgress: { value: 0, type: "f32" },
2626
- uBandCount: { value: bandVal, type: "f32" },
2627
- uParallaxStrength: { value: strengthVal, type: "f32" },
2628
- uStaggerDelay: { value: delayVal, type: "f32" }
2629
- }
2630
- }
2631
- });
2632
- },
2633
- updateProgress(filter, progress, params) {
2634
- const u = filter.resources?.transitionUniforms?.uniforms;
2635
- if (u) {
2636
- u.uProgress = progress;
2637
- u.uBandCount = params.bandCount ?? 3;
2638
- u.uParallaxStrength = params.parallaxStrength ?? 0.5;
2639
- u.uStaggerDelay = params.staggerDelay ?? 0.1;
2640
- }
2641
- }
2642
- };
2643
-
2644
- // src/effects/transitions/physics-simulated/ShatterBurstTransition.ts
2645
- var import_pixi19 = require("pixi.js");
2646
- var fragment19 = `
2647
- in vec2 vNormalizedCoord;
2648
- out vec4 finalColor;
2649
-
2650
- uniform sampler2D uFrom;
2651
- uniform sampler2D uTo;
2652
- uniform float uProgress;
2653
- uniform float uGridRes;
2654
- uniform float uExplosionForce;
2655
- uniform float uRotationAmount;
2656
-
2657
- vec2 hash22(vec2 p) {
2658
- vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));
2659
- p3 += dot(p3, p3.yzx + 33.33);
2660
- return fract((p3.xx + p3.yz) * p3.zy);
2661
- }
2662
-
2663
- void main() {
2664
- vec2 uv = vNormalizedCoord;
2665
-
2666
- float minDist = 999.0;
2667
- vec2 closestCell = vec2(-99.0);
2668
- vec2 closestTransformedCenter = vec2(0.5);
2669
- vec2 closestOriginalCenter = vec2(0.5);
2670
-
2671
- vec2 g = floor(uv * uGridRes);
2672
-
2673
- // 5x5 neighborhood search in destination space to find the closest transformed cell center
2674
- for (float dx = -2.0; dx <= 2.0; dx += 1.0) {
2675
- for (float dy = -2.0; dy <= 2.0; dy += 1.0) {
2676
- vec2 cell = g + vec2(dx, dy);
2677
-
2678
- // Skip out-of-grid cells
2679
- if (cell.x < 0.0 || cell.x >= uGridRes || cell.y < 0.0 || cell.y >= uGridRes) {
2680
- continue;
2681
- }
2682
-
2683
- vec2 rand = hash22(cell);
2684
- vec2 origCenter = (cell + rand) / uGridRes;
2685
-
2686
- // Outward velocity vector relative to frame center with random variation
2687
- vec2 toCenter = origCenter - vec2(0.5);
2688
- vec2 velocity = (normalize(toCenter) + (rand - 0.5) * 0.3) * uExplosionForce;
2689
-
2690
- // Transformed center under quadratic acceleration
2691
- vec2 transCenter = origCenter + velocity * uProgress * uProgress;
2692
-
2693
- float d = distance(uv, transCenter);
2694
- if (d < minDist) {
2695
- minDist = d;
2696
- closestCell = cell;
2697
- closestTransformedCenter = transCenter;
2698
- closestOriginalCenter = origCenter;
2699
- }
2700
- }
2701
- }
2702
-
2703
- // Calculate rotation for the selected cell
2704
- vec2 randVal = hash22(closestCell);
2705
- float randRot = (randVal.x - 0.5) * 2.0;
2706
- float angle = randRot * uRotationAmount * uProgress * 4.0;
2707
-
2708
- // Rotate pixel relative to transformed center, then translate back to original cell space
2709
- vec2 relUv = uv - closestTransformedCenter;
2710
- float cosA = cos(-angle);
2711
- float sinA = sin(-angle);
2712
- vec2 rotatedUv = vec2(relUv.x * cosA - relUv.y * sinA, relUv.x * sinA + relUv.y * cosA);
2713
- vec2 uvFrom = rotatedUv + closestOriginalCenter;
2714
-
2715
- // Check if the traced-back pixel uvFrom actually lands inside the same Voronoi cell
2716
- bool inside = false;
2717
- if (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0) {
2718
- vec2 gFrom = floor(uvFrom * uGridRes);
2719
- float minDistFrom = 999.0;
2720
- vec2 closestCellFrom = vec2(-99.0);
2721
-
2722
- // 3x3 search in original space
2723
- for (float dx = -1.0; dx <= 1.0; dx += 1.0) {
2724
- for (float dy = -1.0; dy <= 1.0; dy += 1.0) {
2725
- vec2 cell = gFrom + vec2(dx, dy);
2726
- if (cell.x < 0.0 || cell.x >= uGridRes || cell.y < 0.0 || cell.y >= uGridRes) {
2727
- continue;
2728
- }
2729
- vec2 rand = hash22(cell);
2730
- vec2 origCenter = (cell + rand) / uGridRes;
2731
- float d = distance(uvFrom, origCenter);
2732
- if (d < minDistFrom) {
2733
- minDistFrom = d;
2734
- closestCellFrom = cell;
2735
- }
2736
- }
2737
- }
2738
-
2739
- if (distance(closestCellFrom, closestCell) < 0.1) {
2740
- inside = true;
2741
- }
2742
- }
2743
-
2744
- vec4 color;
2745
- if (inside) {
2746
- color = texture(uFrom, uvFrom);
2747
- } else {
2748
- // Reveal the incoming clip in the gaps
2749
- color = texture(uTo, uv);
2750
- }
2751
-
2752
- finalColor = color;
2753
- }
2754
- `;
2755
- var ShatterBurstTransition = {
2756
- id: "shatter-burst",
2757
- name: "Shatter Burst",
2758
- category: "physics-simulated",
2759
- description: "Breaks the outgoing clip into polygonal shards that explode outwards, revealing the incoming clip.",
2760
- tags: ["physics", "shatter", "particles", "creative"],
2761
- defaultDurationMs: 1e3,
2762
- params: [
2763
- { key: "shardCount", label: "Shard Count", type: "range", value: 24, min: 8, max: 40, step: 1 },
2764
- { key: "explosionForce", label: "Explosion Force", type: "range", value: 1.5, min: 0.5, max: 3, step: 0.1 },
2765
- { key: "rotationAmount", label: "Rotation Amount", type: "range", value: 0.5, min: 0, max: 1, step: 0.05 }
2766
- ],
2767
- create(params) {
2768
- const shardVal = params.shardCount ?? 24;
2769
- const gridResVal = Math.floor(Math.sqrt(shardVal));
2770
- const forceVal = params.explosionForce ?? 1.5;
2771
- const rotVal = params.rotationAmount ?? 0.5;
2772
- return import_pixi19.Filter.from({
2773
- gl: { vertex: defaultVertexShader, fragment: fragment19 },
2774
- resources: {
2775
- transitionUniforms: {
2776
- uProgress: { value: 0, type: "f32" },
2777
- uGridRes: { value: gridResVal, type: "f32" },
2778
- uExplosionForce: { value: forceVal, type: "f32" },
2779
- uRotationAmount: { value: rotVal, type: "f32" }
2780
- }
2781
- }
2782
- });
2783
- },
2784
- updateProgress(filter, progress, params) {
2785
- const u = filter.resources?.transitionUniforms?.uniforms;
2786
- if (u) {
2787
- u.uProgress = progress;
2788
- const shardVal = params.shardCount ?? 24;
2789
- u.uGridRes = Math.floor(Math.sqrt(shardVal));
2790
- u.uExplosionForce = params.explosionForce ?? 1.5;
2791
- u.uRotationAmount = params.rotationAmount ?? 0.5;
2792
- }
2793
- }
2794
- };
2795
-
2796
- // src/effects/transitions/physics-simulated/ElasticSnapCutTransition.ts
2797
- var import_pixi20 = require("pixi.js");
2798
- var fragment20 = `
2799
- in vec2 vNormalizedCoord;
2800
- out vec4 finalColor;
2801
-
2802
- uniform sampler2D uFrom;
2803
- uniform sampler2D uTo;
2804
- uniform float uProgress;
2805
- uniform float uAmplitude;
2806
- uniform float uDamping;
2807
- uniform float uFrequency;
2808
-
2809
- #define TWO_PI 6.28318530718
2810
-
2811
- void main() {
2812
- float t = uProgress;
2813
- vec4 color;
2814
-
2815
- // Snap to the incoming clip at the end of the transition (progress >= 0.99)
2816
- if (t >= 0.99) {
2817
- color = texture(uTo, vNormalizedCoord);
2818
- } else {
2819
- // Damped harmonic oscillation curve
2820
- float scale = 1.0 + uAmplitude * exp(-uDamping * t) * sin(uFrequency * t * TWO_PI);
2821
-
2822
- // Squash and stretch relative to center (preserving volume/area)
2823
- float scaleX = scale;
2824
- float scaleY = 2.0 - scale;
2825
-
2826
- vec2 center = vec2(0.5);
2827
- vec2 uv = (vNormalizedCoord - center) / vec2(scaleX, scaleY) + center;
2828
-
2829
- if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) {
2830
- color = texture(uFrom, uv);
2831
- } else {
2832
- // Fallback to black for out-of-bounds UV coordinates
2833
- color = vec4(0.0, 0.0, 0.0, 1.0);
2834
- }
2835
- }
2836
-
2837
- finalColor = color;
2838
- }
2839
- `;
2840
- var ElasticSnapCutTransition = {
2841
- id: "elastic-snap-cut",
2842
- name: "Elastic Snap Cut",
2843
- category: "physics-simulated",
2844
- description: "Squashes and stretches the outgoing clip under spring-dampener physics before snapping to a clean cut.",
2845
- tags: ["physics", "stretch", "bounce", "spring"],
2846
- defaultDurationMs: 800,
2847
- params: [
2848
- { key: "amplitude", label: "Amplitude", type: "range", value: 0.15, min: 0.05, max: 0.3, step: 0.01 },
2849
- { key: "damping", label: "Damping", type: "range", value: 4, min: 1, max: 8, step: 0.1 },
2850
- { key: "frequency", label: "Frequency", type: "range", value: 5, min: 2, max: 10, step: 0.5 }
2851
- ],
2852
- create(params) {
2853
- const ampVal = params.amplitude ?? 0.15;
2854
- const dampVal = params.damping ?? 4;
2855
- const freqVal = params.frequency ?? 5;
2856
- return import_pixi20.Filter.from({
2857
- gl: { vertex: defaultVertexShader, fragment: fragment20 },
2858
- resources: {
2859
- transitionUniforms: {
2860
- uProgress: { value: 0, type: "f32" },
2861
- uAmplitude: { value: ampVal, type: "f32" },
2862
- uDamping: { value: dampVal, type: "f32" },
2863
- uFrequency: { value: freqVal, type: "f32" }
2864
- }
2865
- }
2866
- });
2867
- },
2868
- updateProgress(filter, progress, params) {
2869
- const u = filter.resources?.transitionUniforms?.uniforms;
2870
- if (u) {
2871
- u.uProgress = progress;
2872
- u.uAmplitude = params.amplitude ?? 0.15;
2873
- u.uDamping = params.damping ?? 4;
2874
- u.uFrequency = params.frequency ?? 5;
2875
- }
2876
- }
2877
- };
2878
-
2879
- // src/effects/transitions/physics-simulated/GravityDropTransition.ts
2880
- var import_pixi21 = require("pixi.js");
2881
- var fragment21 = `
2882
- in vec2 vNormalizedCoord;
2883
- out vec4 finalColor;
2884
-
2885
- uniform sampler2D uFrom;
2886
- uniform sampler2D uTo;
2887
- uniform float uProgress;
2888
- uniform float uDropDistance;
2889
- uniform float uBounceStrength;
2890
- uniform float uGravity;
2891
-
2892
- // Standard ease-out bounce implementation
2893
- float bounceCurve(float t) {
2894
- float d1 = 2.75;
2895
- if (t < 1.0 / d1) {
2896
- return 7.5625 * t * t;
2897
- } else if (t < 2.0 / d1) {
2898
- float t2 = t - 1.5 / d1;
2899
- return 1.0 - (0.25 - 7.5625 * t2 * t2);
2900
- } else if (t < 2.5 / d1) {
2901
- float t2 = t - 2.25 / d1;
2902
- return 1.0 - (0.0625 - 7.5625 * t2 * t2);
2903
- } else {
2904
- float t2 = t - 2.625 / d1;
2905
- return 1.0 - (0.015625 - 7.5625 * t2 * t2);
2906
- }
2907
- }
2908
-
2909
- void main() {
2910
- float t = uProgress;
2911
-
2912
- // Outgoing clip moves downward under gravity (quadratic acceleration)
2913
- float yOffsetFrom = t * t * uGravity * uDropDistance;
2914
- vec2 uvFrom = vNormalizedCoord + vec2(0.0, yOffsetFrom);
2915
-
2916
- // Incoming clip settles with a bounce curve.
2917
- // If bounce strength is 0, it behaves like a smooth quadratic ease-out.
2918
- float smoothVal = t * (2.0 - t);
2919
- float bounceVal = bounceCurve(t);
2920
- float b = mix(smoothVal, bounceVal, uBounceStrength);
2921
-
2922
- // Incoming clip starts above the screen and moves down to center
2923
- float yOffsetTo = -uDropDistance * (1.0 - b);
2924
- vec2 uvTo = vNormalizedCoord + vec2(0.0, yOffsetTo);
2925
-
2926
- bool inTo = (uvTo.x >= 0.0 && uvTo.x <= 1.0 && uvTo.y >= 0.0 && uvTo.y <= 1.0);
2927
- bool inFrom = (uvFrom.x >= 0.0 && uvFrom.x <= 1.0 && uvFrom.y >= 0.0 && uvFrom.y <= 1.0);
2928
-
2929
- vec4 color = vec4(0.0, 0.0, 0.0, 1.0); // Black background
2930
-
2931
- // Composite: incoming uTo on top
2932
- if (inTo) {
2933
- color = texture(uTo, uvTo);
2934
- } else if (inFrom) {
2935
- color = texture(uFrom, uvFrom);
2936
- }
2937
-
2938
- finalColor = color;
2939
- }
2940
- `;
2941
- var GravityDropTransition = {
2942
- id: "gravity-drop",
2943
- name: "Gravity Drop",
2944
- category: "physics-simulated",
2945
- description: "The outgoing clip falls downward under gravity while the incoming clip drops in from the top with a physical bounce settle.",
2946
- tags: ["physics", "gravity", "bounce", "slide"],
2947
- defaultDurationMs: 1e3,
2948
- params: [
2949
- { key: "dropDistance", label: "Drop Distance", type: "range", value: 1, min: 0.5, max: 2, step: 0.1 },
2950
- { key: "bounceStrength", label: "Bounce Strength", type: "range", value: 0.2, min: 0, max: 0.4, step: 0.05 },
2951
- { key: "gravity", label: "Gravity", type: "range", value: 1.5, min: 0.5, max: 3, step: 0.1 }
2952
- ],
2953
- create(params) {
2954
- const dropVal = params.dropDistance ?? 1;
2955
- const bounceVal = params.bounceStrength ?? 0.2;
2956
- const gravVal = params.gravity ?? 1.5;
2957
- return import_pixi21.Filter.from({
2958
- gl: { vertex: defaultVertexShader, fragment: fragment21 },
2959
- resources: {
2960
- transitionUniforms: {
2961
- uProgress: { value: 0, type: "f32" },
2962
- uDropDistance: { value: dropVal, type: "f32" },
2963
- uBounceStrength: { value: bounceVal, type: "f32" },
2964
- uGravity: { value: gravVal, type: "f32" }
2965
- }
2966
- }
2967
- });
2968
- },
2969
- updateProgress(filter, progress, params) {
2970
- const u = filter.resources?.transitionUniforms?.uniforms;
2971
- if (u) {
2972
- u.uProgress = progress;
2973
- u.uDropDistance = params.dropDistance ?? 1;
2974
- u.uBounceStrength = params.bounceStrength ?? 0.2;
2975
- u.uGravity = params.gravity ?? 1.5;
2976
- }
2977
- }
2978
- };
2979
-
2980
- // src/effects/transitions/index.ts
2981
- var ALL_TRANSITIONS = [
2982
- PushTransition,
2983
- IrisRevealTransition,
2984
- FoldTurnTransition,
2985
- ZoomTransition,
2986
- ChromaticPushTransition,
2987
- RefractionWarpTransition,
2988
- GlitchTransition,
2989
- StrobeCutTransition,
2990
- FrameHoldStutterTransition,
2991
- CrossDissolveTransition,
2992
- DirectionalDissolveTransition,
2993
- PixelateCollapseTransition,
2994
- LumaWipeTransition,
2995
- LightLeakSweepTransition,
2996
- FilmBurnWipeTransition,
2997
- DepthPushTransition,
2998
- RackFocusBlendTransition,
2999
- ParallaxLayerSplitTransition,
3000
- ShatterBurstTransition,
3001
- ElasticSnapCutTransition,
3002
- GravityDropTransition
3003
- ];
3004
- var transitionEffects = ALL_TRANSITIONS;
3005
- var transitionEffectsById = Object.fromEntries(
3006
- ALL_TRANSITIONS.map((t) => [t.id, t])
3007
- );
3008
- function getTransitionEffect(id) {
3009
- return transitionEffectsById[id];
3010
- }
838
+ // src/transitions/index.ts
839
+ var ALL_TRANSITIONS = TRANSITION_PRESETS.map((preset) => ({
840
+ id: preset.id,
841
+ name: preset.name,
842
+ category: preset.category,
843
+ description: preset.description,
844
+ tags: preset.tags,
845
+ defaultDurationMs: preset.defaultDurationMs,
846
+ renderer: preset.renderer,
847
+ params: Object.entries(preset.params).map(([key, value]) => ({
848
+ key,
849
+ label: key.replace(/[-_]/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase()),
850
+ type: typeof value === "number" ? "range" : typeof value === "boolean" ? "toggle" : "text",
851
+ value
852
+ }))
853
+ }));
3011
854
  // Annotate the CommonJS export names for ESM import in node:
3012
855
  0 && (module.exports = {
3013
856
  ALL_TRANSITIONS,
3014
- ChromaticPushTransition,
3015
- CrossDissolveTransition,
3016
- DepthPushTransition,
3017
- DirectionalDissolveTransition,
3018
- ElasticSnapCutTransition,
3019
- FilmBurnWipeTransition,
3020
- FoldTurnTransition,
3021
- FrameHoldStutterTransition,
3022
- GlitchTransition,
3023
- GravityDropTransition,
3024
- IrisRevealTransition,
3025
- LightLeakSweepTransition,
3026
- LumaWipeTransition,
3027
- ParallaxLayerSplitTransition,
3028
- PixelateCollapseTransition,
3029
- PushTransition,
3030
- RackFocusBlendTransition,
3031
- RefractionWarpTransition,
3032
- ShatterBurstTransition,
3033
- StrobeCutTransition,
3034
857
  TRANSITION_CATEGORIES,
3035
858
  TRANSITION_PRESETS,
3036
859
  TransitionRenderer,
3037
- ZoomTransition,
3038
860
  getAllTransitionTags,
3039
861
  getAllTransitions,
3040
862
  getRecommendedDuration,
@@ -3042,11 +864,8 @@ function getTransitionEffect(id) {
3042
864
  getTransitionByRenderer,
3043
865
  getTransitionCategories,
3044
866
  getTransitionCountByCategory,
3045
- getTransitionEffect,
3046
867
  getTransitionsByCategory,
3047
868
  getTransitionsByTags,
3048
- searchTransitions,
3049
- transitionEffects,
3050
- transitionEffectsById
869
+ searchTransitions
3051
870
  });
3052
871
  //# sourceMappingURL=index.cjs.map