@microfox/remotion 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +255 -20
- package/dist/index.d.ts +255 -20
- package/dist/index.js +2272 -794
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2217 -749
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,24 +29,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
|
-
AudioAtom: () =>
|
|
33
|
-
AudioAtomConfig: () =>
|
|
32
|
+
AudioAtom: () => Atom6,
|
|
33
|
+
AudioAtomConfig: () => config15,
|
|
34
34
|
BaseLayout: () => Layout,
|
|
35
|
-
BaseLayoutConfig: () =>
|
|
35
|
+
BaseLayoutConfig: () => config10,
|
|
36
36
|
BlurEffect: () => BlurEffect,
|
|
37
37
|
BlurEffectConfig: () => config2,
|
|
38
|
+
CanvasAtom: () => Atom,
|
|
39
|
+
CanvasAtomConfig: () => config9,
|
|
40
|
+
CanvasContentAwareReveal: () => CanvasContentAwareReveal,
|
|
41
|
+
CanvasGlitchEffect: () => CanvasGlitchEffect,
|
|
42
|
+
CanvasParticleEffect: () => CanvasParticleEffect,
|
|
43
|
+
CanvasWipeReveal: () => CanvasWipeReveal,
|
|
38
44
|
ComponentRenderer: () => ComponentRenderer,
|
|
39
45
|
Composition: () => Composition,
|
|
40
46
|
CompositionLayout: () => CompositionLayout,
|
|
41
47
|
CompositionProvider: () => CompositionProvider,
|
|
42
48
|
Frame: () => Frame,
|
|
43
49
|
GenericEffectPresets: () => GenericEffectPresets,
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
HTMLBlockAtom: () => Atom8,
|
|
51
|
+
HTMLBlockAtomConfig: () => config17,
|
|
52
|
+
ImageAtom: () => Atom3,
|
|
53
|
+
ImageAtomConfig: () => config12,
|
|
46
54
|
LoopEffect: () => LoopEffect,
|
|
47
55
|
LoopEffectConfig: () => config3,
|
|
48
|
-
LottieAtom: () =>
|
|
49
|
-
LottieAtomConfig: () =>
|
|
56
|
+
LottieAtom: () => Atom7,
|
|
57
|
+
LottieAtomConfig: () => config16,
|
|
50
58
|
NextjsLogo: () => NextjsLogo,
|
|
51
59
|
PanEffect: () => PanEffect,
|
|
52
60
|
PanEffectConfig: () => config4,
|
|
@@ -56,19 +64,21 @@ __export(index_exports, {
|
|
|
56
64
|
SceneFrame: () => SceneFrame,
|
|
57
65
|
ShakeEffect: () => ShakeEffect,
|
|
58
66
|
ShakeEffectConfig: () => config6,
|
|
59
|
-
ShapeAtom: () =>
|
|
60
|
-
ShapeAtomConfig: () =>
|
|
67
|
+
ShapeAtom: () => Atom2,
|
|
68
|
+
ShapeAtomConfig: () => config11,
|
|
61
69
|
StretchEffect: () => StretchEffect,
|
|
62
70
|
StretchEffectConfig: () => config7,
|
|
63
|
-
TextAtom: () =>
|
|
64
|
-
TextAtomConfig: () =>
|
|
71
|
+
TextAtom: () => Atom4,
|
|
72
|
+
TextAtomConfig: () => config13,
|
|
65
73
|
TextFade: () => TextFade,
|
|
66
74
|
UniversalEffect: () => UniversalEffect,
|
|
67
75
|
UniversalEffectProvider: () => UniversalEffectProvider,
|
|
68
|
-
VideoAtom: () =>
|
|
69
|
-
VideoAtomConfig: () =>
|
|
76
|
+
VideoAtom: () => Atom5,
|
|
77
|
+
VideoAtomConfig: () => config14,
|
|
70
78
|
Waveform: () => Waveform,
|
|
71
79
|
WaveformCircle: () => WaveformCircle,
|
|
80
|
+
WaveformEffect: () => WaveformEffect,
|
|
81
|
+
WaveformEffectConfig: () => config8,
|
|
72
82
|
WaveformHistogram: () => WaveformHistogram,
|
|
73
83
|
WaveformHistogramRanged: () => WaveformHistogramRanged,
|
|
74
84
|
WaveformLine: () => WaveformLine,
|
|
@@ -135,21 +145,21 @@ var ComponentRegistryManager = class {
|
|
|
135
145
|
this.registry = {};
|
|
136
146
|
this.packageRegistry = {};
|
|
137
147
|
}
|
|
138
|
-
registerComponent(name, component, type,
|
|
139
|
-
this.registry[name] = { component, config:
|
|
148
|
+
registerComponent(name, component, type, config18 = { displayName: "" }, packageName) {
|
|
149
|
+
this.registry[name] = { component, config: config18 };
|
|
140
150
|
if (packageName) {
|
|
141
151
|
if (!this.packageRegistry[packageName]) {
|
|
142
152
|
this.packageRegistry[packageName] = {};
|
|
143
153
|
}
|
|
144
|
-
this.packageRegistry[packageName][name] = { component, config:
|
|
154
|
+
this.packageRegistry[packageName][name] = { component, config: config18 };
|
|
145
155
|
}
|
|
146
156
|
}
|
|
147
|
-
registerEffect(name, component,
|
|
157
|
+
registerEffect(name, component, config18 = { displayName: "" }, packageName) {
|
|
148
158
|
this.registerComponent(
|
|
149
159
|
name?.includes("effect-") ? name : `effect-${name}`,
|
|
150
160
|
component,
|
|
151
161
|
"layout",
|
|
152
|
-
|
|
162
|
+
config18,
|
|
153
163
|
packageName
|
|
154
164
|
);
|
|
155
165
|
}
|
|
@@ -164,8 +174,8 @@ var ComponentRegistryManager = class {
|
|
|
164
174
|
}
|
|
165
175
|
registerPackage(packageName, components) {
|
|
166
176
|
this.packageRegistry[packageName] = components;
|
|
167
|
-
Object.entries(components).forEach(([name, { component, config:
|
|
168
|
-
this.registry[`${packageName}:${name}`] = { component, config:
|
|
177
|
+
Object.entries(components).forEach(([name, { component, config: config18 }]) => {
|
|
178
|
+
this.registry[`${packageName}:${name}`] = { component, config: config18 };
|
|
169
179
|
});
|
|
170
180
|
}
|
|
171
181
|
getPackageComponents(packageName) {
|
|
@@ -180,17 +190,17 @@ var ComponentRegistryManager = class {
|
|
|
180
190
|
}
|
|
181
191
|
};
|
|
182
192
|
var componentRegistry = new ComponentRegistryManager();
|
|
183
|
-
var registerComponent = (name, component, type,
|
|
193
|
+
var registerComponent = (name, component, type, config18 = { displayName: "" }, packageName) => {
|
|
184
194
|
componentRegistry.registerComponent(
|
|
185
195
|
name,
|
|
186
196
|
component,
|
|
187
197
|
type,
|
|
188
|
-
|
|
198
|
+
config18,
|
|
189
199
|
packageName
|
|
190
200
|
);
|
|
191
201
|
};
|
|
192
|
-
var registerEffect = (name, component,
|
|
193
|
-
componentRegistry.registerEffect(name, component,
|
|
202
|
+
var registerEffect = (name, component, config18 = { displayName: "" }, packageName) => {
|
|
203
|
+
componentRegistry.registerEffect(name, component, config18, packageName);
|
|
194
204
|
};
|
|
195
205
|
var registerPackage = (packageName, components) => {
|
|
196
206
|
componentRegistry.registerPackage(packageName, components);
|
|
@@ -273,9 +283,9 @@ var calculateComponentDuration = async (component) => {
|
|
|
273
283
|
} else {
|
|
274
284
|
}
|
|
275
285
|
};
|
|
276
|
-
var calculateDuration = async (childrenData,
|
|
286
|
+
var calculateDuration = async (childrenData, config18) => {
|
|
277
287
|
let calculatedDuration = void 0;
|
|
278
|
-
const targetIds = Array.isArray(
|
|
288
|
+
const targetIds = Array.isArray(config18.fitDurationTo) ? config18.fitDurationTo : [config18.fitDurationTo];
|
|
279
289
|
const matchingComponents = findMatchingComponents(
|
|
280
290
|
childrenData || [],
|
|
281
291
|
targetIds
|
|
@@ -629,8 +639,8 @@ var ComponentRenderer = ({
|
|
|
629
639
|
context
|
|
630
640
|
};
|
|
631
641
|
if (type === "layout") {
|
|
632
|
-
const
|
|
633
|
-
const isInnerSequence =
|
|
642
|
+
const config18 = getComponentConfig(componentId);
|
|
643
|
+
const isInnerSequence = config18?.isInnerSequence;
|
|
634
644
|
if (isInnerSequence) {
|
|
635
645
|
return /* @__PURE__ */ import_react3.default.createElement(RenderContext.Provider, { value: newContext }, /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...props }, effects && effects.length > 0 ? /* @__PURE__ */ import_react3.default.createElement(EffectWrapper, { effects, context: newContext }, childrenData?.map((child) => /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child }))) : childrenData?.map((child) => /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child }))));
|
|
636
646
|
}
|
|
@@ -673,8 +683,8 @@ var SceneFrame = ({ children }) => {
|
|
|
673
683
|
};
|
|
674
684
|
|
|
675
685
|
// src/components/layouts/BaseLayout.tsx
|
|
676
|
-
var
|
|
677
|
-
var
|
|
686
|
+
var import_react20 = __toESM(require("react"));
|
|
687
|
+
var import_remotion14 = require("remotion");
|
|
678
688
|
|
|
679
689
|
// src/components/effects/BlurEffect.tsx
|
|
680
690
|
var import_react7 = __toESM(require("react"));
|
|
@@ -688,10 +698,45 @@ var parseFunctionsString = (functions) => {
|
|
|
688
698
|
if (!functions) {
|
|
689
699
|
return result;
|
|
690
700
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
701
|
+
let i = 0;
|
|
702
|
+
while (i < functions.length) {
|
|
703
|
+
while (i < functions.length && /\s/.test(functions[i])) {
|
|
704
|
+
i++;
|
|
705
|
+
}
|
|
706
|
+
if (i >= functions.length) break;
|
|
707
|
+
const nameStart = i;
|
|
708
|
+
while (i < functions.length && /[\w-]/.test(functions[i])) {
|
|
709
|
+
i++;
|
|
710
|
+
}
|
|
711
|
+
if (i === nameStart) break;
|
|
712
|
+
const functionName = functions.substring(nameStart, i);
|
|
713
|
+
while (i < functions.length && /\s/.test(functions[i])) {
|
|
714
|
+
i++;
|
|
715
|
+
}
|
|
716
|
+
if (i >= functions.length || functions[i] !== "(") {
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
i++;
|
|
720
|
+
let depth = 1;
|
|
721
|
+
const contentStart = i;
|
|
722
|
+
while (i < functions.length && depth > 0) {
|
|
723
|
+
if (functions[i] === "(") {
|
|
724
|
+
depth++;
|
|
725
|
+
} else if (functions[i] === ")") {
|
|
726
|
+
depth--;
|
|
727
|
+
}
|
|
728
|
+
if (depth > 0) {
|
|
729
|
+
i++;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
if (depth === 0) {
|
|
733
|
+
const content = functions.substring(contentStart, i);
|
|
734
|
+
const fullFunction = `${functionName}(${content})`;
|
|
735
|
+
result.set(functionName, fullFunction);
|
|
736
|
+
i++;
|
|
737
|
+
} else {
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
695
740
|
}
|
|
696
741
|
return result;
|
|
697
742
|
};
|
|
@@ -855,11 +900,20 @@ var parseHexColor = (hex) => {
|
|
|
855
900
|
var parseRgbaColor = (rgba) => {
|
|
856
901
|
const match = rgba.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);
|
|
857
902
|
if (match) {
|
|
903
|
+
let alpha = 1;
|
|
904
|
+
if (match[4]) {
|
|
905
|
+
const alphaValue = parseFloat(match[4]);
|
|
906
|
+
if (alphaValue > 1) {
|
|
907
|
+
alpha = Math.max(0, Math.min(1, alphaValue / 100));
|
|
908
|
+
} else {
|
|
909
|
+
alpha = Math.max(0, Math.min(1, alphaValue));
|
|
910
|
+
}
|
|
911
|
+
}
|
|
858
912
|
return {
|
|
859
913
|
r: Math.max(0, Math.min(255, parseInt(match[1], 10))),
|
|
860
914
|
g: Math.max(0, Math.min(255, parseInt(match[2], 10))),
|
|
861
915
|
b: Math.max(0, Math.min(255, parseInt(match[3], 10))),
|
|
862
|
-
a:
|
|
916
|
+
a: alpha
|
|
863
917
|
};
|
|
864
918
|
}
|
|
865
919
|
return { r: 0, g: 0, b: 0, a: 1 };
|
|
@@ -873,14 +927,21 @@ var parseColor = (color) => {
|
|
|
873
927
|
}
|
|
874
928
|
return { r: 0, g: 0, b: 0, a: 1 };
|
|
875
929
|
};
|
|
876
|
-
var rgbaToString = (color) => {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
930
|
+
var rgbaToString = (color, preserveFormat) => {
|
|
931
|
+
const r = Math.round(color.r);
|
|
932
|
+
const g = Math.round(color.g);
|
|
933
|
+
const b = Math.round(color.b);
|
|
934
|
+
const a = color.a;
|
|
935
|
+
if (preserveFormat) {
|
|
936
|
+
if (preserveFormat.hasSpaces) {
|
|
937
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
938
|
+
} else {
|
|
939
|
+
return `rgba(${r},${g},${b},${a})`;
|
|
940
|
+
}
|
|
881
941
|
}
|
|
942
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
882
943
|
};
|
|
883
|
-
var interpolateColors = (color1, color2, progress) => {
|
|
944
|
+
var interpolateColors = (color1, color2, progress, preserveFormat) => {
|
|
884
945
|
const parsedColor1 = parseColor(color1);
|
|
885
946
|
const parsedColor2 = parseColor(color2);
|
|
886
947
|
const interpolatedColor = {
|
|
@@ -889,7 +950,75 @@ var interpolateColors = (color1, color2, progress) => {
|
|
|
889
950
|
b: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.b, parsedColor2.b]),
|
|
890
951
|
a: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.a, parsedColor2.a])
|
|
891
952
|
};
|
|
892
|
-
return rgbaToString(interpolatedColor);
|
|
953
|
+
return rgbaToString(interpolatedColor, preserveFormat);
|
|
954
|
+
};
|
|
955
|
+
var findColorsInString = (str) => {
|
|
956
|
+
const matches = [];
|
|
957
|
+
const rgbaPattern = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g;
|
|
958
|
+
let match;
|
|
959
|
+
rgbaPattern.lastIndex = 0;
|
|
960
|
+
while ((match = rgbaPattern.exec(str)) !== null) {
|
|
961
|
+
matches.push({
|
|
962
|
+
fullMatch: match[0],
|
|
963
|
+
color: match[0],
|
|
964
|
+
startIndex: match.index,
|
|
965
|
+
endIndex: match.index + match[0].length
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
const hexPattern = /#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\b/g;
|
|
969
|
+
hexPattern.lastIndex = 0;
|
|
970
|
+
while ((match = hexPattern.exec(str)) !== null) {
|
|
971
|
+
matches.push({
|
|
972
|
+
fullMatch: match[0],
|
|
973
|
+
color: match[0],
|
|
974
|
+
startIndex: match.index,
|
|
975
|
+
endIndex: match.index + match[0].length
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
return matches.sort((a, b) => a.startIndex - b.startIndex);
|
|
979
|
+
};
|
|
980
|
+
var interpolateColorsInString = (str1, str2, progress) => {
|
|
981
|
+
const colors1 = findColorsInString(str1);
|
|
982
|
+
const colors2 = findColorsInString(str2);
|
|
983
|
+
if (colors1.length === 0 && colors2.length === 0) {
|
|
984
|
+
return str1;
|
|
985
|
+
}
|
|
986
|
+
if (colors1.length === 0 || colors2.length === 0) {
|
|
987
|
+
return str1;
|
|
988
|
+
}
|
|
989
|
+
const minLength = Math.min(colors1.length, colors2.length);
|
|
990
|
+
const replacements = [];
|
|
991
|
+
for (let i = 0; i < minLength; i++) {
|
|
992
|
+
const color1 = colors1[i];
|
|
993
|
+
const color2 = colors2[i];
|
|
994
|
+
const originalColor = color1.color;
|
|
995
|
+
const hasSpaces = originalColor.includes(", ");
|
|
996
|
+
const interpolatedColor = interpolateColors(color1.color, color2.color, progress, { hasSpaces });
|
|
997
|
+
replacements.push({
|
|
998
|
+
startIndex: color1.startIndex,
|
|
999
|
+
endIndex: color1.endIndex,
|
|
1000
|
+
replacement: interpolatedColor
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
replacements.sort((a, b) => b.startIndex - a.startIndex);
|
|
1004
|
+
let result = str1;
|
|
1005
|
+
for (const replacement of replacements) {
|
|
1006
|
+
const originalSubstring = result.substring(replacement.startIndex, replacement.endIndex);
|
|
1007
|
+
const expectedColor = colors1.find((c) => c.startIndex === replacement.startIndex);
|
|
1008
|
+
if (expectedColor && (originalSubstring === expectedColor.color || originalSubstring.trim().match(/^rgba?\(/i))) {
|
|
1009
|
+
result = result.substring(0, replacement.startIndex) + replacement.replacement + result.substring(replacement.endIndex);
|
|
1010
|
+
} else {
|
|
1011
|
+
const currentColors = findColorsInString(result);
|
|
1012
|
+
const matchingColor = currentColors.find(
|
|
1013
|
+
(c) => Math.abs(c.startIndex - replacement.startIndex) < 30
|
|
1014
|
+
// Allow some offset
|
|
1015
|
+
);
|
|
1016
|
+
if (matchingColor) {
|
|
1017
|
+
result = result.substring(0, matchingColor.startIndex) + replacement.replacement + result.substring(matchingColor.endIndex);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return result;
|
|
893
1022
|
};
|
|
894
1023
|
var calculateAnimatedValue = (ranges, progress, key) => {
|
|
895
1024
|
const sortedRanges = [...ranges].sort((a, b) => a.prog - b.prog);
|
|
@@ -925,6 +1054,11 @@ var calculateAnimatedValue = (ranges, progress, key) => {
|
|
|
925
1054
|
if (isColor(currentValue) && isColor(nextValue)) {
|
|
926
1055
|
return interpolateColors(currentValue, nextValue, localProgress);
|
|
927
1056
|
}
|
|
1057
|
+
const colors1 = findColorsInString(currentValue);
|
|
1058
|
+
const colors2 = findColorsInString(nextValue);
|
|
1059
|
+
if (colors1.length > 0 || colors2.length > 0) {
|
|
1060
|
+
return interpolateColorsInString(currentValue, nextValue, localProgress);
|
|
1061
|
+
}
|
|
928
1062
|
const getUnitAndValue = (str) => {
|
|
929
1063
|
const units = ["vmax", "vmin", "rem", "deg", "bpm", "vh", "vw", "px", "em", "ms", "hz", "db", "fr", "s", "%"];
|
|
930
1064
|
for (const unit of units) {
|
|
@@ -973,7 +1107,7 @@ var rangesToCSSProperties = (ranges, progress) => {
|
|
|
973
1107
|
const value = calculateAnimatedValue(keyRanges, progress, key);
|
|
974
1108
|
switch (key) {
|
|
975
1109
|
case "scale":
|
|
976
|
-
styles.transform =
|
|
1110
|
+
styles.transform = `${styles.transform || ""} scale(${value})`.trim();
|
|
977
1111
|
break;
|
|
978
1112
|
case "rotate":
|
|
979
1113
|
const rotateValue = typeof value === "string" && value.includes("deg") ? value : `${value}deg`;
|
|
@@ -1879,226 +2013,1743 @@ var config7 = {
|
|
|
1879
2013
|
}
|
|
1880
2014
|
};
|
|
1881
2015
|
|
|
1882
|
-
// src/components/effects/
|
|
1883
|
-
var
|
|
1884
|
-
{ key: "opacity", val: 0, prog: 0 },
|
|
1885
|
-
{ key: "opacity", val: 1, prog: 1 }
|
|
1886
|
-
];
|
|
1887
|
-
var fadeOutPreset = [
|
|
1888
|
-
{ key: "opacity", val: 1, prog: 0 },
|
|
1889
|
-
{ key: "opacity", val: 0, prog: 1 }
|
|
1890
|
-
];
|
|
1891
|
-
var scaleInPreset = [
|
|
1892
|
-
{ key: "scale", val: 0, prog: 0 },
|
|
1893
|
-
{ key: "scale", val: 1, prog: 1 }
|
|
1894
|
-
];
|
|
1895
|
-
var scaleOutPreset = [
|
|
1896
|
-
{ key: "scale", val: 1, prog: 0 },
|
|
1897
|
-
{ key: "scale", val: 0, prog: 1 }
|
|
1898
|
-
];
|
|
1899
|
-
var slideInLeftPreset = [
|
|
1900
|
-
{ key: "translateX", val: -100, prog: 0 },
|
|
1901
|
-
{ key: "translateX", val: 0, prog: 1 }
|
|
1902
|
-
];
|
|
1903
|
-
var slideInRightPreset = [
|
|
1904
|
-
{ key: "translateX", val: 100, prog: 0 },
|
|
1905
|
-
{ key: "translateX", val: 0, prog: 1 }
|
|
1906
|
-
];
|
|
1907
|
-
var slideInTopPreset = [
|
|
1908
|
-
{ key: "translateY", val: -100, prog: 0 },
|
|
1909
|
-
{ key: "translateY", val: 0, prog: 1 }
|
|
1910
|
-
];
|
|
1911
|
-
var slideInBottomPreset = [
|
|
1912
|
-
{ key: "translateY", val: 100, prog: 0 },
|
|
1913
|
-
{ key: "translateY", val: 0, prog: 1 }
|
|
1914
|
-
];
|
|
1915
|
-
var bouncePreset = [
|
|
1916
|
-
{ key: "scale", val: 0, prog: 0 },
|
|
1917
|
-
{ key: "scale", val: 1.2, prog: 0.6 },
|
|
1918
|
-
{ key: "scale", val: 1, prog: 1 }
|
|
1919
|
-
];
|
|
1920
|
-
var pulsePreset = [
|
|
1921
|
-
{ key: "scale", val: 1, prog: 0 },
|
|
1922
|
-
{ key: "scale", val: 1.1, prog: 0.5 },
|
|
1923
|
-
{ key: "scale", val: 1, prog: 1 }
|
|
1924
|
-
];
|
|
1925
|
-
var rotateInPreset = [
|
|
1926
|
-
{ key: "rotate", val: -180, prog: 0 },
|
|
1927
|
-
{ key: "rotate", val: 0, prog: 1 }
|
|
1928
|
-
];
|
|
1929
|
-
var blurInPreset = [
|
|
1930
|
-
{ key: "blur", val: 10, prog: 0 },
|
|
1931
|
-
{ key: "blur", val: 0, prog: 1 }
|
|
1932
|
-
];
|
|
1933
|
-
var fadeInScalePreset = [
|
|
1934
|
-
{ key: "opacity", val: 0, prog: 0 },
|
|
1935
|
-
{ key: "opacity", val: 1, prog: 1 },
|
|
1936
|
-
{ key: "scale", val: 0.8, prog: 0 },
|
|
1937
|
-
{ key: "scale", val: 1, prog: 1 }
|
|
1938
|
-
];
|
|
1939
|
-
var slideInFadePreset = [
|
|
1940
|
-
{ key: "translateX", val: -50, prog: 0 },
|
|
1941
|
-
{ key: "translateX", val: 0, prog: 1 },
|
|
1942
|
-
{ key: "opacity", val: 0, prog: 0 },
|
|
1943
|
-
{ key: "opacity", val: 1, prog: 1 }
|
|
1944
|
-
];
|
|
1945
|
-
var slideInLeftStringPreset = [
|
|
1946
|
-
{ key: "translateX", val: "-100px", prog: 0 },
|
|
1947
|
-
{ key: "translateX", val: "0px", prog: 1 }
|
|
1948
|
-
];
|
|
1949
|
-
var slideInRightStringPreset = [
|
|
1950
|
-
{ key: "translateX", val: "100px", prog: 0 },
|
|
1951
|
-
{ key: "translateX", val: "0px", prog: 1 }
|
|
1952
|
-
];
|
|
1953
|
-
var slideInTopStringPreset = [
|
|
1954
|
-
{ key: "translateY", val: "-100px", prog: 0 },
|
|
1955
|
-
{ key: "translateY", val: "0px", prog: 1 }
|
|
1956
|
-
];
|
|
1957
|
-
var slideInBottomStringPreset = [
|
|
1958
|
-
{ key: "translateY", val: "100px", prog: 0 },
|
|
1959
|
-
{ key: "translateY", val: "0px", prog: 1 }
|
|
1960
|
-
];
|
|
1961
|
-
var rotateInStringPreset = [
|
|
1962
|
-
{ key: "rotate", val: "-180deg", prog: 0 },
|
|
1963
|
-
{ key: "rotate", val: "0deg", prog: 1 }
|
|
1964
|
-
];
|
|
1965
|
-
var blurInStringPreset = [
|
|
1966
|
-
{ key: "blur", val: "10px", prog: 0 },
|
|
1967
|
-
{ key: "blur", val: "0px", prog: 1 }
|
|
1968
|
-
];
|
|
1969
|
-
var scaleInStringPreset = [
|
|
1970
|
-
{ key: "scale", val: 0, prog: 0 },
|
|
1971
|
-
{ key: "scale", val: 1, prog: 1 }
|
|
1972
|
-
];
|
|
1973
|
-
var slideInLeftResponsivePreset = [
|
|
1974
|
-
{ key: "translateX", val: "-50vw", prog: 0 },
|
|
1975
|
-
{ key: "translateX", val: "0vw", prog: 1 }
|
|
1976
|
-
];
|
|
1977
|
-
var slideInTopResponsivePreset = [
|
|
1978
|
-
{ key: "translateY", val: "-50vh", prog: 0 },
|
|
1979
|
-
{ key: "translateY", val: "0vh", prog: 1 }
|
|
1980
|
-
];
|
|
1981
|
-
var backgroundColorPreset = [
|
|
1982
|
-
{ key: "backgroundColor", val: "#ff0000", prog: 0 },
|
|
1983
|
-
{ key: "backgroundColor", val: "#0000ff", prog: 1 }
|
|
1984
|
-
];
|
|
1985
|
-
var borderRadiusPreset = [
|
|
1986
|
-
{ key: "borderRadius", val: "0px", prog: 0 },
|
|
1987
|
-
{ key: "borderRadius", val: "50px", prog: 1 }
|
|
1988
|
-
];
|
|
1989
|
-
var boxShadowPreset = [
|
|
1990
|
-
{ key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
1991
|
-
{ key: "boxShadow", val: "10px 10px 20px rgba(0,0,0,0.5)", prog: 1 }
|
|
1992
|
-
];
|
|
1993
|
-
var fontSizePreset = [
|
|
1994
|
-
{ key: "fontSize", val: "12px", prog: 0 },
|
|
1995
|
-
{ key: "fontSize", val: "24px", prog: 1 }
|
|
1996
|
-
];
|
|
1997
|
-
var letterSpacingPreset = [
|
|
1998
|
-
{ key: "letterSpacing", val: "0px", prog: 0 },
|
|
1999
|
-
{ key: "letterSpacing", val: "5px", prog: 1 }
|
|
2000
|
-
];
|
|
2001
|
-
var lineHeightPreset = [
|
|
2002
|
-
{ key: "lineHeight", val: "1", prog: 0 },
|
|
2003
|
-
{ key: "lineHeight", val: "2", prog: 1 }
|
|
2004
|
-
];
|
|
2005
|
-
var textShadowPreset = [
|
|
2006
|
-
{ key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
2007
|
-
{ key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
|
|
2008
|
-
];
|
|
2009
|
-
var widthPreset = [
|
|
2010
|
-
{ key: "width", val: "0px", prog: 0 },
|
|
2011
|
-
{ key: "width", val: "100%", prog: 1 }
|
|
2012
|
-
];
|
|
2013
|
-
var heightPreset = [
|
|
2014
|
-
{ key: "height", val: "0px", prog: 0 },
|
|
2015
|
-
{ key: "height", val: "100%", prog: 1 }
|
|
2016
|
-
];
|
|
2017
|
-
var marginPreset = [
|
|
2018
|
-
{ key: "margin", val: "0px", prog: 0 },
|
|
2019
|
-
{ key: "margin", val: "20px", prog: 1 }
|
|
2020
|
-
];
|
|
2021
|
-
var paddingPreset = [
|
|
2022
|
-
{ key: "padding", val: "0px", prog: 0 },
|
|
2023
|
-
{ key: "padding", val: "20px", prog: 1 }
|
|
2024
|
-
];
|
|
2025
|
-
var morphingCardPreset = [
|
|
2026
|
-
{ key: "borderRadius", val: "0px", prog: 0 },
|
|
2027
|
-
{ key: "borderRadius", val: "20px", prog: 0.5 },
|
|
2028
|
-
{ key: "borderRadius", val: "50px", prog: 1 },
|
|
2029
|
-
{ key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
2030
|
-
{ key: "boxShadow", val: "0px 10px 30px rgba(0,0,0,0.3)", prog: 1 },
|
|
2031
|
-
{ key: "backgroundColor", val: "#ffffff", prog: 0 },
|
|
2032
|
-
{ key: "backgroundColor", val: "#f0f0f0", prog: 1 }
|
|
2033
|
-
];
|
|
2034
|
-
var textRevealPreset = [
|
|
2035
|
-
{ key: "opacity", val: 0, prog: 0 },
|
|
2036
|
-
{ key: "opacity", val: 1, prog: 1 },
|
|
2037
|
-
{ key: "letterSpacing", val: "10px", prog: 0 },
|
|
2038
|
-
{ key: "letterSpacing", val: "0px", prog: 1 },
|
|
2039
|
-
{ key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
2040
|
-
{ key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
|
|
2041
|
-
];
|
|
2042
|
-
var GenericEffectPresets = {
|
|
2043
|
-
fadeInPreset,
|
|
2044
|
-
fadeOutPreset,
|
|
2045
|
-
scaleInPreset,
|
|
2046
|
-
scaleOutPreset,
|
|
2047
|
-
slideInLeftPreset,
|
|
2048
|
-
slideInRightPreset,
|
|
2049
|
-
slideInTopPreset,
|
|
2050
|
-
slideInBottomPreset,
|
|
2051
|
-
bouncePreset,
|
|
2052
|
-
pulsePreset,
|
|
2053
|
-
rotateInPreset,
|
|
2054
|
-
blurInPreset,
|
|
2055
|
-
fadeInScalePreset,
|
|
2056
|
-
slideInFadePreset,
|
|
2057
|
-
// String-based presets
|
|
2058
|
-
slideInLeftStringPreset,
|
|
2059
|
-
slideInRightStringPreset,
|
|
2060
|
-
slideInTopStringPreset,
|
|
2061
|
-
slideInBottomStringPreset,
|
|
2062
|
-
rotateInStringPreset,
|
|
2063
|
-
blurInStringPreset,
|
|
2064
|
-
scaleInStringPreset,
|
|
2065
|
-
slideInLeftResponsivePreset,
|
|
2066
|
-
slideInTopResponsivePreset,
|
|
2067
|
-
// Custom CSS property presets
|
|
2068
|
-
backgroundColorPreset,
|
|
2069
|
-
borderRadiusPreset,
|
|
2070
|
-
boxShadowPreset,
|
|
2071
|
-
fontSizePreset,
|
|
2072
|
-
letterSpacingPreset,
|
|
2073
|
-
lineHeightPreset,
|
|
2074
|
-
textShadowPreset,
|
|
2075
|
-
widthPreset,
|
|
2076
|
-
heightPreset,
|
|
2077
|
-
marginPreset,
|
|
2078
|
-
paddingPreset,
|
|
2079
|
-
morphingCardPreset,
|
|
2080
|
-
textRevealPreset
|
|
2081
|
-
};
|
|
2082
|
-
|
|
2083
|
-
// src/components/effects/index.ts
|
|
2084
|
-
registerEffect(config2.displayName, BlurEffect, config2);
|
|
2085
|
-
registerEffect(config3.displayName, LoopEffect, config3);
|
|
2086
|
-
registerEffect(config4.displayName, PanEffect, config4);
|
|
2087
|
-
registerEffect(config5.displayName, ZoomEffect, config5);
|
|
2088
|
-
registerEffect("generic", UniversalEffect, config);
|
|
2089
|
-
registerEffect(config6.displayName, ShakeEffect, config6);
|
|
2090
|
-
registerEffect(
|
|
2091
|
-
config7.displayName,
|
|
2092
|
-
StretchEffect,
|
|
2093
|
-
config7
|
|
2094
|
-
);
|
|
2016
|
+
// src/components/effects/WaveformEffect.tsx
|
|
2017
|
+
var import_react14 = __toESM(require("react"));
|
|
2095
2018
|
|
|
2096
|
-
// src/
|
|
2097
|
-
var
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2019
|
+
// src/templates/waveform/hooks/useWaveformData.ts
|
|
2020
|
+
var import_react13 = require("react");
|
|
2021
|
+
var import_media_utils = require("@remotion/media-utils");
|
|
2022
|
+
var import_remotion9 = require("remotion");
|
|
2023
|
+
var isValidPowerOfTwo = (num) => {
|
|
2024
|
+
return num > 0 && (num & num - 1) === 0;
|
|
2025
|
+
};
|
|
2026
|
+
var getClosestPowerOfTwo = (num) => {
|
|
2027
|
+
if (num <= 0) return 32;
|
|
2028
|
+
let power = 1;
|
|
2029
|
+
while (power < num) {
|
|
2030
|
+
power *= 2;
|
|
2031
|
+
}
|
|
2032
|
+
const lower = power / 2;
|
|
2033
|
+
const upper = power;
|
|
2034
|
+
return Math.abs(num - lower) < Math.abs(num - upper) ? lower : upper;
|
|
2035
|
+
};
|
|
2036
|
+
var useWaveformData = (config18) => {
|
|
2037
|
+
const {
|
|
2038
|
+
audioSrc,
|
|
2039
|
+
numberOfSamples,
|
|
2040
|
+
windowInSeconds,
|
|
2041
|
+
dataOffsetInSeconds = 0,
|
|
2042
|
+
normalize = false,
|
|
2043
|
+
frame,
|
|
2044
|
+
fps,
|
|
2045
|
+
posterize,
|
|
2046
|
+
includeFrequencyData = false,
|
|
2047
|
+
minDb = -100,
|
|
2048
|
+
maxDb = -30,
|
|
2049
|
+
smoothNormalisation = 1
|
|
2050
|
+
} = config18;
|
|
2051
|
+
const { root } = useComposition();
|
|
2052
|
+
const validatedNumberOfSamples = (0, import_react13.useMemo)(() => {
|
|
2053
|
+
if (!isValidPowerOfTwo(numberOfSamples)) {
|
|
2054
|
+
console.warn(
|
|
2055
|
+
`numberOfSamples must be a power of 2. Adjusting ${numberOfSamples} to ${getClosestPowerOfTwo(numberOfSamples)}`
|
|
2056
|
+
);
|
|
2057
|
+
return getClosestPowerOfTwo(numberOfSamples);
|
|
2058
|
+
}
|
|
2059
|
+
return numberOfSamples;
|
|
2060
|
+
}, [numberOfSamples]);
|
|
2061
|
+
const { source, audioStartsFrom } = (0, import_react13.useMemo)(() => {
|
|
2062
|
+
if (audioSrc.startsWith("http")) {
|
|
2063
|
+
return { source: audioSrc, audioStartsFrom: void 0 };
|
|
2064
|
+
}
|
|
2065
|
+
if (audioSrc.startsWith("ref:")) {
|
|
2066
|
+
const matchingComponent = findMatchingComponents(root, [
|
|
2067
|
+
audioSrc.replace("ref:", "")
|
|
2068
|
+
]);
|
|
2069
|
+
if (matchingComponent.length > 0) {
|
|
2070
|
+
const firstMatchingComponent = matchingComponent[0];
|
|
2071
|
+
if (firstMatchingComponent.componentId === "AudioAtom") {
|
|
2072
|
+
return {
|
|
2073
|
+
source: firstMatchingComponent.data.src,
|
|
2074
|
+
audioStartsFrom: firstMatchingComponent.data?.startFrom ?? void 0
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
if (firstMatchingComponent.type === "layout" || firstMatchingComponent.type === "scene") {
|
|
2078
|
+
const audioComponents = findMatchingComponentsByQuery(
|
|
2079
|
+
firstMatchingComponent.childrenData,
|
|
2080
|
+
{ componentId: "AudioAtom" }
|
|
2081
|
+
);
|
|
2082
|
+
if (audioComponents.length > 0) {
|
|
2083
|
+
return {
|
|
2084
|
+
source: audioComponents[0].data.src,
|
|
2085
|
+
audioStartsFrom: audioComponents[0].data?.startFrom ?? void 0
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
return { source: (0, import_remotion9.staticFile)(audioSrc), audioStartsFrom: void 0 };
|
|
2092
|
+
}, [audioSrc]);
|
|
2093
|
+
const audioData = (0, import_media_utils.useAudioData)(source);
|
|
2094
|
+
const adjustedFrame = (0, import_react13.useMemo)(() => {
|
|
2095
|
+
if (posterize && posterize > 1) {
|
|
2096
|
+
return Math.round(frame / posterize) * posterize;
|
|
2097
|
+
}
|
|
2098
|
+
let offset = 0;
|
|
2099
|
+
if (audioStartsFrom && audioStartsFrom != 0) {
|
|
2100
|
+
offset += Math.round(audioStartsFrom * fps);
|
|
2101
|
+
}
|
|
2102
|
+
if (dataOffsetInSeconds != 0) {
|
|
2103
|
+
offset += Math.round(dataOffsetInSeconds * fps);
|
|
2104
|
+
}
|
|
2105
|
+
return frame + offset;
|
|
2106
|
+
}, [frame, posterize, dataOffsetInSeconds, audioStartsFrom]);
|
|
2107
|
+
const waveformData = (0, import_react13.useMemo)(() => {
|
|
2108
|
+
if (!audioData) return null;
|
|
2109
|
+
try {
|
|
2110
|
+
const baseSmoothingFrames = 3;
|
|
2111
|
+
const smoothingFrames = smoothNormalisation > 0 ? Math.floor(smoothNormalisation * baseSmoothingFrames) : 0;
|
|
2112
|
+
const samples = [];
|
|
2113
|
+
if (smoothingFrames === 0) {
|
|
2114
|
+
const waveform = (0, import_media_utils.visualizeAudioWaveform)({
|
|
2115
|
+
fps,
|
|
2116
|
+
frame: adjustedFrame,
|
|
2117
|
+
audioData,
|
|
2118
|
+
numberOfSamples: validatedNumberOfSamples,
|
|
2119
|
+
windowInSeconds,
|
|
2120
|
+
dataOffsetInSeconds: 0,
|
|
2121
|
+
normalize
|
|
2122
|
+
});
|
|
2123
|
+
return waveform;
|
|
2124
|
+
}
|
|
2125
|
+
for (let offset = -smoothingFrames; offset <= smoothingFrames; offset++) {
|
|
2126
|
+
const sampleFrame = adjustedFrame + offset;
|
|
2127
|
+
if (sampleFrame >= 0) {
|
|
2128
|
+
try {
|
|
2129
|
+
const waveform = (0, import_media_utils.visualizeAudioWaveform)({
|
|
2130
|
+
fps,
|
|
2131
|
+
frame: sampleFrame,
|
|
2132
|
+
audioData,
|
|
2133
|
+
numberOfSamples: validatedNumberOfSamples,
|
|
2134
|
+
windowInSeconds,
|
|
2135
|
+
dataOffsetInSeconds: 0,
|
|
2136
|
+
normalize
|
|
2137
|
+
});
|
|
2138
|
+
if (waveform && waveform.length > 0) {
|
|
2139
|
+
samples.push(waveform);
|
|
2140
|
+
}
|
|
2141
|
+
} catch (e) {
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
if (samples.length === 0) {
|
|
2146
|
+
const waveform = (0, import_media_utils.visualizeAudioWaveform)({
|
|
2147
|
+
fps,
|
|
2148
|
+
frame: adjustedFrame,
|
|
2149
|
+
audioData,
|
|
2150
|
+
numberOfSamples: validatedNumberOfSamples,
|
|
2151
|
+
windowInSeconds,
|
|
2152
|
+
dataOffsetInSeconds: 0,
|
|
2153
|
+
normalize
|
|
2154
|
+
});
|
|
2155
|
+
return waveform;
|
|
2156
|
+
}
|
|
2157
|
+
const averaged = new Array(validatedNumberOfSamples).fill(0);
|
|
2158
|
+
for (let i = 0; i < validatedNumberOfSamples; i++) {
|
|
2159
|
+
let sum = 0;
|
|
2160
|
+
let count = 0;
|
|
2161
|
+
for (const sample of samples) {
|
|
2162
|
+
if (sample[i] !== void 0) {
|
|
2163
|
+
sum += sample[i];
|
|
2164
|
+
count++;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
averaged[i] = count > 0 ? sum / count : 0;
|
|
2168
|
+
}
|
|
2169
|
+
return averaged;
|
|
2170
|
+
} catch (error2) {
|
|
2171
|
+
console.error("Error generating waveform:", error2);
|
|
2172
|
+
return null;
|
|
2173
|
+
}
|
|
2174
|
+
}, [
|
|
2175
|
+
audioData,
|
|
2176
|
+
adjustedFrame,
|
|
2177
|
+
fps,
|
|
2178
|
+
validatedNumberOfSamples,
|
|
2179
|
+
windowInSeconds,
|
|
2180
|
+
dataOffsetInSeconds,
|
|
2181
|
+
normalize,
|
|
2182
|
+
smoothNormalisation
|
|
2183
|
+
]);
|
|
2184
|
+
const {
|
|
2185
|
+
frequencyData,
|
|
2186
|
+
amplitudes,
|
|
2187
|
+
bass,
|
|
2188
|
+
mid,
|
|
2189
|
+
treble,
|
|
2190
|
+
bassValues,
|
|
2191
|
+
midValues,
|
|
2192
|
+
trebleValues
|
|
2193
|
+
} = (0, import_react13.useMemo)(() => {
|
|
2194
|
+
if (!audioData || !includeFrequencyData) {
|
|
2195
|
+
return {
|
|
2196
|
+
frequencyData: null,
|
|
2197
|
+
amplitudes: null,
|
|
2198
|
+
bass: null,
|
|
2199
|
+
mid: null,
|
|
2200
|
+
treble: null,
|
|
2201
|
+
bassValues: null,
|
|
2202
|
+
midValues: null,
|
|
2203
|
+
trebleValues: null
|
|
2204
|
+
};
|
|
2205
|
+
}
|
|
2206
|
+
try {
|
|
2207
|
+
const baseSmoothingFrames = 3;
|
|
2208
|
+
const smoothingFrames = smoothNormalisation > 0 ? Math.floor(smoothNormalisation * baseSmoothingFrames) : 0;
|
|
2209
|
+
const frequencySamples = [];
|
|
2210
|
+
let frequencyData2;
|
|
2211
|
+
if (smoothingFrames === 0) {
|
|
2212
|
+
frequencyData2 = (0, import_media_utils.visualizeAudio)({
|
|
2213
|
+
fps,
|
|
2214
|
+
frame: adjustedFrame,
|
|
2215
|
+
audioData,
|
|
2216
|
+
numberOfSamples: validatedNumberOfSamples
|
|
2217
|
+
});
|
|
2218
|
+
} else {
|
|
2219
|
+
for (let offset = -smoothingFrames; offset <= smoothingFrames; offset++) {
|
|
2220
|
+
const sampleFrame = adjustedFrame + offset;
|
|
2221
|
+
if (sampleFrame >= 0) {
|
|
2222
|
+
try {
|
|
2223
|
+
const freqData = (0, import_media_utils.visualizeAudio)({
|
|
2224
|
+
fps,
|
|
2225
|
+
frame: sampleFrame,
|
|
2226
|
+
audioData,
|
|
2227
|
+
numberOfSamples: validatedNumberOfSamples
|
|
2228
|
+
});
|
|
2229
|
+
if (freqData && freqData.length > 0) {
|
|
2230
|
+
frequencySamples.push(freqData);
|
|
2231
|
+
}
|
|
2232
|
+
} catch (e) {
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
if (frequencySamples.length === 0) {
|
|
2237
|
+
frequencyData2 = (0, import_media_utils.visualizeAudio)({
|
|
2238
|
+
fps,
|
|
2239
|
+
frame: adjustedFrame,
|
|
2240
|
+
audioData,
|
|
2241
|
+
numberOfSamples: validatedNumberOfSamples
|
|
2242
|
+
});
|
|
2243
|
+
} else {
|
|
2244
|
+
frequencyData2 = new Array(validatedNumberOfSamples).fill(0);
|
|
2245
|
+
for (let i = 0; i < validatedNumberOfSamples; i++) {
|
|
2246
|
+
let sum = 0;
|
|
2247
|
+
let count = 0;
|
|
2248
|
+
for (const sample of frequencySamples) {
|
|
2249
|
+
if (sample[i] !== void 0) {
|
|
2250
|
+
sum += sample[i];
|
|
2251
|
+
count++;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
frequencyData2[i] = count > 0 ? sum / count : 0;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
const { sampleRate } = audioData;
|
|
2259
|
+
const bassValues2 = [];
|
|
2260
|
+
const midValues2 = [];
|
|
2261
|
+
const trebleValues2 = [];
|
|
2262
|
+
for (let i = 0; i < frequencyData2.length; i++) {
|
|
2263
|
+
const freq = i * sampleRate / (2 * frequencyData2.length);
|
|
2264
|
+
const value = frequencyData2[i];
|
|
2265
|
+
if (freq >= 0 && freq < 250) {
|
|
2266
|
+
bassValues2.push(value * 2.5);
|
|
2267
|
+
} else if (freq >= 250 && freq < 4e3) {
|
|
2268
|
+
midValues2.push(value * 3);
|
|
2269
|
+
midValues2.push(value * 4.5);
|
|
2270
|
+
midValues2.push(value * 5);
|
|
2271
|
+
} else if (freq >= 4e3 && freq < sampleRate / 2) {
|
|
2272
|
+
trebleValues2.push(value * 30);
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
const getAverage = (arr) => arr.length > 0 ? arr.reduce((a, b) => a + b, 0) / arr.length : 0;
|
|
2276
|
+
const bass2 = getAverage(bassValues2);
|
|
2277
|
+
const mid2 = getAverage(midValues2);
|
|
2278
|
+
const treble2 = getAverage(trebleValues2);
|
|
2279
|
+
const amplitudes2 = frequencyData2.map((value) => {
|
|
2280
|
+
const db = 20 * Math.log10(value);
|
|
2281
|
+
const scaled = (db - minDb) / (maxDb - minDb);
|
|
2282
|
+
return Math.max(0, Math.min(1, scaled));
|
|
2283
|
+
});
|
|
2284
|
+
return {
|
|
2285
|
+
frequencyData: frequencyData2,
|
|
2286
|
+
amplitudes: amplitudes2,
|
|
2287
|
+
bass: bass2,
|
|
2288
|
+
mid: mid2,
|
|
2289
|
+
treble: treble2,
|
|
2290
|
+
bassValues: bassValues2,
|
|
2291
|
+
midValues: midValues2,
|
|
2292
|
+
trebleValues: trebleValues2.reverse()
|
|
2293
|
+
};
|
|
2294
|
+
} catch (error2) {
|
|
2295
|
+
console.error("Error generating frequency data:", error2);
|
|
2296
|
+
return {
|
|
2297
|
+
frequencyData: null,
|
|
2298
|
+
amplitudes: null,
|
|
2299
|
+
bass: null,
|
|
2300
|
+
mid: null,
|
|
2301
|
+
treble: null
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
}, [
|
|
2305
|
+
audioData,
|
|
2306
|
+
includeFrequencyData,
|
|
2307
|
+
adjustedFrame,
|
|
2308
|
+
fps,
|
|
2309
|
+
validatedNumberOfSamples,
|
|
2310
|
+
windowInSeconds,
|
|
2311
|
+
dataOffsetInSeconds,
|
|
2312
|
+
minDb,
|
|
2313
|
+
maxDb,
|
|
2314
|
+
smoothNormalisation
|
|
2315
|
+
]);
|
|
2316
|
+
const isLoading = !audioData;
|
|
2317
|
+
const error = audioData === null && !isLoading ? "Failed to load audio data" : null;
|
|
2318
|
+
return {
|
|
2319
|
+
waveformData,
|
|
2320
|
+
frequencyData,
|
|
2321
|
+
amplitudes,
|
|
2322
|
+
audioData,
|
|
2323
|
+
isLoading,
|
|
2324
|
+
error,
|
|
2325
|
+
bass,
|
|
2326
|
+
bassValues,
|
|
2327
|
+
mid,
|
|
2328
|
+
midValues,
|
|
2329
|
+
treble,
|
|
2330
|
+
trebleValues
|
|
2331
|
+
};
|
|
2332
|
+
};
|
|
2333
|
+
|
|
2334
|
+
// src/components/effects/WaveformEffect.tsx
|
|
2335
|
+
var WaveformEffect = ({
|
|
2336
|
+
id,
|
|
2337
|
+
componentId,
|
|
2338
|
+
type,
|
|
2339
|
+
data,
|
|
2340
|
+
children,
|
|
2341
|
+
context
|
|
2342
|
+
}) => {
|
|
2343
|
+
const { progress, frame, mode, targetIds, effectData, fps } = useUniversalAnimation(data, context);
|
|
2344
|
+
const {
|
|
2345
|
+
audioSrc,
|
|
2346
|
+
numberOfSamples = 128,
|
|
2347
|
+
windowInSeconds,
|
|
2348
|
+
dataOffsetInSeconds = 0,
|
|
2349
|
+
normalize = false,
|
|
2350
|
+
useFrequencyData = true,
|
|
2351
|
+
audioProperty = "bass",
|
|
2352
|
+
sensitivity = 1,
|
|
2353
|
+
threshold = 0,
|
|
2354
|
+
smoothing = 0.5,
|
|
2355
|
+
smoothNormalisation = 1,
|
|
2356
|
+
effectType = "zoom",
|
|
2357
|
+
intensity = 1,
|
|
2358
|
+
minValue,
|
|
2359
|
+
maxValue,
|
|
2360
|
+
shakeAxis = "both",
|
|
2361
|
+
baseScale = 1,
|
|
2362
|
+
baseBrightness = 1,
|
|
2363
|
+
rotationRange = 15
|
|
2364
|
+
} = effectData;
|
|
2365
|
+
const parentContext = useUniversalEffectOptional();
|
|
2366
|
+
const analysisWindow = smoothNormalisation === 0 ? windowInSeconds || 1 / fps : windowInSeconds || Math.max(1 / fps, 0.05);
|
|
2367
|
+
const { bass, mid, treble, waveformData } = useWaveformData({
|
|
2368
|
+
audioSrc,
|
|
2369
|
+
numberOfSamples,
|
|
2370
|
+
windowInSeconds: analysisWindow,
|
|
2371
|
+
dataOffsetInSeconds,
|
|
2372
|
+
normalize,
|
|
2373
|
+
frame,
|
|
2374
|
+
fps,
|
|
2375
|
+
includeFrequencyData: useFrequencyData,
|
|
2376
|
+
smoothNormalisation
|
|
2377
|
+
});
|
|
2378
|
+
const audioIntensity = (0, import_react14.useMemo)(() => {
|
|
2379
|
+
let rawValue = 0;
|
|
2380
|
+
switch (audioProperty) {
|
|
2381
|
+
case "bass":
|
|
2382
|
+
rawValue = bass || 0;
|
|
2383
|
+
break;
|
|
2384
|
+
case "mid":
|
|
2385
|
+
rawValue = mid || 0;
|
|
2386
|
+
break;
|
|
2387
|
+
case "treble":
|
|
2388
|
+
rawValue = treble || 0;
|
|
2389
|
+
break;
|
|
2390
|
+
case "waveform":
|
|
2391
|
+
if (waveformData && waveformData.length > 0) {
|
|
2392
|
+
rawValue = waveformData.reduce((sum, val) => sum + Math.abs(val), 0) / waveformData.length;
|
|
2393
|
+
}
|
|
2394
|
+
break;
|
|
2395
|
+
case "frequency":
|
|
2396
|
+
rawValue = bass || 0;
|
|
2397
|
+
break;
|
|
2398
|
+
default:
|
|
2399
|
+
rawValue = bass || 0;
|
|
2400
|
+
}
|
|
2401
|
+
const thresholdedValue = Math.max(0, rawValue - threshold);
|
|
2402
|
+
const sensitizedValue = thresholdedValue * sensitivity;
|
|
2403
|
+
return Math.min(1, Math.max(0, sensitizedValue));
|
|
2404
|
+
}, [audioProperty, bass, mid, treble, waveformData, threshold, sensitivity]);
|
|
2405
|
+
const smoothedIntensity = (0, import_react14.useMemo)(() => {
|
|
2406
|
+
if (smoothNormalisation === 0) {
|
|
2407
|
+
return audioIntensity;
|
|
2408
|
+
}
|
|
2409
|
+
const smoothingPower = 1 + smoothing * 2;
|
|
2410
|
+
const smoothed = Math.pow(audioIntensity, smoothingPower);
|
|
2411
|
+
const baseline = 0.1;
|
|
2412
|
+
const filtered = smoothed * (1 - baseline * smoothing) + baseline * smoothing;
|
|
2413
|
+
return Math.min(1, Math.max(0, filtered));
|
|
2414
|
+
}, [audioIntensity, smoothing, smoothNormalisation]);
|
|
2415
|
+
const animatedStyles = (0, import_react14.useMemo)(() => {
|
|
2416
|
+
const intensityValue = smoothedIntensity || audioIntensity;
|
|
2417
|
+
let effectValue = intensityValue * intensity;
|
|
2418
|
+
if (minValue !== void 0 || maxValue !== void 0) {
|
|
2419
|
+
const defaultMin = effectType === "zoom" || effectType === "scale" ? baseScale : 0;
|
|
2420
|
+
const defaultMax = effectType === "zoom" || effectType === "scale" ? baseScale + intensity : intensity;
|
|
2421
|
+
const min = minValue !== void 0 ? minValue : defaultMin;
|
|
2422
|
+
const max = maxValue !== void 0 ? maxValue : defaultMax;
|
|
2423
|
+
effectValue = min + intensityValue * (max - min);
|
|
2424
|
+
} else {
|
|
2425
|
+
switch (effectType) {
|
|
2426
|
+
case "zoom":
|
|
2427
|
+
case "scale":
|
|
2428
|
+
effectValue = baseScale + intensityValue * intensity;
|
|
2429
|
+
break;
|
|
2430
|
+
case "exposure":
|
|
2431
|
+
effectValue = baseBrightness + intensityValue * intensity;
|
|
2432
|
+
break;
|
|
2433
|
+
case "blur":
|
|
2434
|
+
effectValue = intensityValue * intensity * 10;
|
|
2435
|
+
break;
|
|
2436
|
+
case "rotate":
|
|
2437
|
+
effectValue = (intensityValue - 0.5) * 2 * rotationRange;
|
|
2438
|
+
break;
|
|
2439
|
+
case "translateX":
|
|
2440
|
+
case "translateY":
|
|
2441
|
+
effectValue = (intensityValue - 0.5) * 2 * intensity * 50;
|
|
2442
|
+
break;
|
|
2443
|
+
default:
|
|
2444
|
+
effectValue = intensityValue * intensity;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
const styles = {};
|
|
2448
|
+
switch (effectType) {
|
|
2449
|
+
case "zoom":
|
|
2450
|
+
case "scale":
|
|
2451
|
+
styles.transform = `scale(${effectValue})`;
|
|
2452
|
+
break;
|
|
2453
|
+
case "shake":
|
|
2454
|
+
const shakeFrequency = 0.1;
|
|
2455
|
+
const shakeTime = frame * shakeFrequency;
|
|
2456
|
+
const shakeAmplitude = intensityValue * intensity * 20;
|
|
2457
|
+
const shakeX = shakeAxis === "x" || shakeAxis === "both" ? Math.sin(shakeTime * 2.3) * shakeAmplitude : 0;
|
|
2458
|
+
const shakeY = shakeAxis === "y" || shakeAxis === "both" ? Math.cos(shakeTime * 1.7) * shakeAmplitude : 0;
|
|
2459
|
+
styles.transform = `translateX(${shakeX}px) translateY(${shakeY}px)`;
|
|
2460
|
+
break;
|
|
2461
|
+
case "exposure":
|
|
2462
|
+
styles.filter = `brightness(${effectValue})`;
|
|
2463
|
+
break;
|
|
2464
|
+
case "blur":
|
|
2465
|
+
styles.filter = `blur(${effectValue}px)`;
|
|
2466
|
+
break;
|
|
2467
|
+
case "rotate":
|
|
2468
|
+
styles.transform = `rotate(${effectValue}deg)`;
|
|
2469
|
+
break;
|
|
2470
|
+
case "translateX":
|
|
2471
|
+
styles.transform = `translateX(${effectValue}px)`;
|
|
2472
|
+
break;
|
|
2473
|
+
case "translateY":
|
|
2474
|
+
styles.transform = `translateY(${effectValue}px)`;
|
|
2475
|
+
break;
|
|
2476
|
+
default:
|
|
2477
|
+
styles.transform = `scale(${effectValue})`;
|
|
2478
|
+
}
|
|
2479
|
+
if (parentContext && mode === "provider") {
|
|
2480
|
+
const combinedStyles = mergeCSSStyles_default(parentContext.animatedStyles, styles);
|
|
2481
|
+
return combinedStyles;
|
|
2482
|
+
}
|
|
2483
|
+
return styles;
|
|
2484
|
+
}, [
|
|
2485
|
+
smoothedIntensity,
|
|
2486
|
+
audioIntensity,
|
|
2487
|
+
effectType,
|
|
2488
|
+
intensity,
|
|
2489
|
+
minValue,
|
|
2490
|
+
maxValue,
|
|
2491
|
+
baseScale,
|
|
2492
|
+
baseBrightness,
|
|
2493
|
+
rotationRange,
|
|
2494
|
+
shakeAxis,
|
|
2495
|
+
mode,
|
|
2496
|
+
parentContext?.animatedStyles,
|
|
2497
|
+
frame
|
|
2498
|
+
// Add frame dependency for shake effect
|
|
2499
|
+
]);
|
|
2500
|
+
const contextValue = (0, import_react14.useMemo)(
|
|
2501
|
+
() => ({
|
|
2502
|
+
animatedStyles,
|
|
2503
|
+
targetIds,
|
|
2504
|
+
effectType: "waveform"
|
|
2505
|
+
}),
|
|
2506
|
+
[animatedStyles, targetIds]
|
|
2507
|
+
);
|
|
2508
|
+
if (mode === "provider") {
|
|
2509
|
+
return /* @__PURE__ */ import_react14.default.createElement(UniversalEffectContext.Provider, { value: contextValue }, children);
|
|
2510
|
+
}
|
|
2511
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", { ...effectData.props, style: animatedStyles }, children);
|
|
2512
|
+
};
|
|
2513
|
+
var config8 = {
|
|
2514
|
+
displayName: "waveform",
|
|
2515
|
+
description: "Waveform-driven effect that reacts to audio data (bass, mid, treble, waveform)",
|
|
2516
|
+
isInnerSequence: false,
|
|
2517
|
+
props: {
|
|
2518
|
+
audioSrc: {
|
|
2519
|
+
type: "string",
|
|
2520
|
+
required: true,
|
|
2521
|
+
description: "Audio source URL or ref:componentId"
|
|
2522
|
+
},
|
|
2523
|
+
audioProperty: {
|
|
2524
|
+
type: "enum",
|
|
2525
|
+
values: ["bass", "mid", "treble", "waveform", "frequency"],
|
|
2526
|
+
default: "bass",
|
|
2527
|
+
description: "Which audio property to react to"
|
|
2528
|
+
},
|
|
2529
|
+
effectType: {
|
|
2530
|
+
type: "enum",
|
|
2531
|
+
values: ["zoom", "shake", "exposure", "blur", "scale", "rotate", "translateX", "translateY"],
|
|
2532
|
+
default: "zoom",
|
|
2533
|
+
description: "Type of effect to apply"
|
|
2534
|
+
},
|
|
2535
|
+
intensity: {
|
|
2536
|
+
type: "number",
|
|
2537
|
+
default: 1,
|
|
2538
|
+
description: "Effect intensity multiplier"
|
|
2539
|
+
},
|
|
2540
|
+
sensitivity: {
|
|
2541
|
+
type: "number",
|
|
2542
|
+
default: 1,
|
|
2543
|
+
description: "Sensitivity multiplier for audio detection"
|
|
2544
|
+
},
|
|
2545
|
+
threshold: {
|
|
2546
|
+
type: "number",
|
|
2547
|
+
default: 0,
|
|
2548
|
+
description: "Minimum audio value to trigger effect"
|
|
2549
|
+
},
|
|
2550
|
+
smoothing: {
|
|
2551
|
+
type: "number",
|
|
2552
|
+
default: 0.5,
|
|
2553
|
+
description: "Smoothing factor (0-1) for audio data"
|
|
2554
|
+
},
|
|
2555
|
+
smoothNormalisation: {
|
|
2556
|
+
type: "number",
|
|
2557
|
+
default: 1,
|
|
2558
|
+
description: "Frame-based smoothing control (0 = no smoothing, 1 = default, >1 = more smoothing)"
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
};
|
|
2562
|
+
|
|
2563
|
+
// src/components/effects/CanvasWipeReveal.tsx
|
|
2564
|
+
var import_react16 = __toESM(require("react"));
|
|
2565
|
+
var import_remotion10 = require("remotion");
|
|
2566
|
+
var import_zod3 = require("zod");
|
|
2567
|
+
|
|
2568
|
+
// src/components/atoms/CanvasAtom.tsx
|
|
2569
|
+
var import_react15 = __toESM(require("react"));
|
|
2570
|
+
var import_zod2 = require("zod");
|
|
2571
|
+
var CanvasAtomDataProps = import_zod2.z.object({
|
|
2572
|
+
className: import_zod2.z.string().optional(),
|
|
2573
|
+
style: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.any()).optional()
|
|
2574
|
+
});
|
|
2575
|
+
var Atom = import_react15.default.forwardRef(({ data, id }, ref) => {
|
|
2576
|
+
const { className, style } = data;
|
|
2577
|
+
return /* @__PURE__ */ import_react15.default.createElement("canvas", { ref, className, style, id });
|
|
2578
|
+
});
|
|
2579
|
+
var config9 = {
|
|
2580
|
+
displayName: "CanvasAtom",
|
|
2581
|
+
type: "atom",
|
|
2582
|
+
isInnerSequence: false,
|
|
2583
|
+
props: CanvasAtomDataProps
|
|
2584
|
+
// The config points to the Zod schema for data
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
// src/components/effects/CanvasWipeReveal.tsx
|
|
2588
|
+
var mulberry32 = (seed) => {
|
|
2589
|
+
return () => {
|
|
2590
|
+
let t = seed += 1831565813;
|
|
2591
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
2592
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
2593
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
2594
|
+
};
|
|
2595
|
+
};
|
|
2596
|
+
var CanvasWipeRevealProps = import_zod3.z.object({
|
|
2597
|
+
imageUrl: import_zod3.z.string().url(),
|
|
2598
|
+
revealDurationInFrames: import_zod3.z.number().min(1),
|
|
2599
|
+
revealType: import_zod3.z.enum(["wipe", "radial"]).default("wipe"),
|
|
2600
|
+
angle: import_zod3.z.number().default(0),
|
|
2601
|
+
fit: import_zod3.z.enum(["cover", "contain"]).default("cover"),
|
|
2602
|
+
edgeStyle: import_zod3.z.enum(["straight", "organic", "burn"]).default("straight"),
|
|
2603
|
+
edgeWaviness: import_zod3.z.number().default(30),
|
|
2604
|
+
edgeFrequency: import_zod3.z.number().default(4),
|
|
2605
|
+
backgroundColor: import_zod3.z.string().default("rgba(0,0,0,0)"),
|
|
2606
|
+
burnGlow: import_zod3.z.boolean().default(true),
|
|
2607
|
+
burnGlowColor: import_zod3.z.string().default("#ff6600"),
|
|
2608
|
+
burnGlowIntensity: import_zod3.z.number().default(1),
|
|
2609
|
+
organicRandomAmplitude: import_zod3.z.boolean().default(true),
|
|
2610
|
+
organicRandomWavelength: import_zod3.z.boolean().default(false)
|
|
2611
|
+
});
|
|
2612
|
+
var CanvasWipeReveal = ({ data, id }) => {
|
|
2613
|
+
const {
|
|
2614
|
+
imageUrl,
|
|
2615
|
+
revealDurationInFrames,
|
|
2616
|
+
revealType,
|
|
2617
|
+
angle,
|
|
2618
|
+
fit,
|
|
2619
|
+
edgeStyle,
|
|
2620
|
+
edgeWaviness,
|
|
2621
|
+
edgeFrequency,
|
|
2622
|
+
backgroundColor,
|
|
2623
|
+
burnGlow,
|
|
2624
|
+
burnGlowColor,
|
|
2625
|
+
burnGlowIntensity,
|
|
2626
|
+
organicRandomAmplitude,
|
|
2627
|
+
organicRandomWavelength
|
|
2628
|
+
} = data;
|
|
2629
|
+
const frame = (0, import_remotion10.useCurrentFrame)();
|
|
2630
|
+
const { width, height } = (0, import_remotion10.useVideoConfig)();
|
|
2631
|
+
const canvasRef = (0, import_react16.useRef)(null);
|
|
2632
|
+
const [image, setImage] = (0, import_react16.useState)(null);
|
|
2633
|
+
(0, import_react16.useEffect)(() => {
|
|
2634
|
+
const img = new window.Image();
|
|
2635
|
+
img.crossOrigin = "Anonymous";
|
|
2636
|
+
img.src = imageUrl;
|
|
2637
|
+
img.onload = () => setImage(img);
|
|
2638
|
+
}, [imageUrl]);
|
|
2639
|
+
(0, import_react16.useEffect)(() => {
|
|
2640
|
+
if (!canvasRef.current || !image) return;
|
|
2641
|
+
const context = canvasRef.current.getContext("2d");
|
|
2642
|
+
if (!context) return;
|
|
2643
|
+
context.canvas.width = width;
|
|
2644
|
+
context.canvas.height = height;
|
|
2645
|
+
context.fillStyle = backgroundColor;
|
|
2646
|
+
context.fillRect(0, 0, width, height);
|
|
2647
|
+
const progress = Math.min(frame / revealDurationInFrames, 1);
|
|
2648
|
+
if (progress === 0 && backgroundColor === "rgba(0,0,0,0)") return;
|
|
2649
|
+
const seed = id.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
2650
|
+
context.save();
|
|
2651
|
+
context.beginPath();
|
|
2652
|
+
if (revealType === "radial") {
|
|
2653
|
+
const baseRadius = Math.sqrt(width * width + height * height) / 2 * progress;
|
|
2654
|
+
if (edgeStyle === "organic") {
|
|
2655
|
+
const points = 120;
|
|
2656
|
+
const random = mulberry32(seed);
|
|
2657
|
+
const amplitudes = Array.from(
|
|
2658
|
+
{ length: points + 1 },
|
|
2659
|
+
() => organicRandomAmplitude ? 0.5 + random() : 1
|
|
2660
|
+
);
|
|
2661
|
+
const wavelengths = Array.from(
|
|
2662
|
+
{ length: points + 1 },
|
|
2663
|
+
() => organicRandomWavelength ? 0.5 + random() * 1.5 : 1
|
|
2664
|
+
);
|
|
2665
|
+
for (let i = 0; i <= points; i++) {
|
|
2666
|
+
const p = i / points;
|
|
2667
|
+
const angle2 = p * Math.PI * 2;
|
|
2668
|
+
const wave = Math.sin(
|
|
2669
|
+
p * Math.PI * edgeFrequency * wavelengths[i] + frame * 0.1
|
|
2670
|
+
) * edgeWaviness * progress * amplitudes[i];
|
|
2671
|
+
const radius = baseRadius + wave;
|
|
2672
|
+
const x = width / 2 + Math.cos(angle2) * radius;
|
|
2673
|
+
const y = height / 2 + Math.sin(angle2) * radius;
|
|
2674
|
+
if (i === 0) context.moveTo(x, y);
|
|
2675
|
+
else context.lineTo(x, y);
|
|
2676
|
+
}
|
|
2677
|
+
context.closePath();
|
|
2678
|
+
} else if (edgeStyle === "burn") {
|
|
2679
|
+
const points = 120;
|
|
2680
|
+
const random = mulberry32(seed);
|
|
2681
|
+
const randomValues = Array.from({ length: points + 1 }, () => random());
|
|
2682
|
+
const phaseOffsets = Array.from(
|
|
2683
|
+
{ length: points + 1 },
|
|
2684
|
+
() => random() * Math.PI * 2
|
|
2685
|
+
);
|
|
2686
|
+
const sparklePoints = [];
|
|
2687
|
+
for (let i = 0; i <= points; i++) {
|
|
2688
|
+
const p = i / points;
|
|
2689
|
+
const angle2 = p * Math.PI * 2;
|
|
2690
|
+
const flicker = Math.sin(frame * 0.3 + phaseOffsets[i]);
|
|
2691
|
+
const burnOffset = (randomValues[i] * 2 - 1) * flicker * edgeWaviness * progress;
|
|
2692
|
+
const radius = baseRadius + burnOffset;
|
|
2693
|
+
const x = width / 2 + Math.cos(angle2) * radius;
|
|
2694
|
+
const y = height / 2 + Math.sin(angle2) * radius;
|
|
2695
|
+
if (burnGlow && i % 5 === 0 && flicker > 0.3) {
|
|
2696
|
+
sparklePoints.push({ x, y, intensity: flicker });
|
|
2697
|
+
}
|
|
2698
|
+
if (i === 0) context.moveTo(x, y);
|
|
2699
|
+
else context.lineTo(x, y);
|
|
2700
|
+
}
|
|
2701
|
+
context.closePath();
|
|
2702
|
+
if (burnGlow && sparklePoints.length > 0) {
|
|
2703
|
+
sparklePoints.forEach((point) => {
|
|
2704
|
+
const glowSize = 3 + point.intensity * 5 * burnGlowIntensity;
|
|
2705
|
+
if (isFinite(point.x) && isFinite(point.y) && isFinite(glowSize) && glowSize > 0) {
|
|
2706
|
+
const gradient = context.createRadialGradient(
|
|
2707
|
+
point.x,
|
|
2708
|
+
point.y,
|
|
2709
|
+
0,
|
|
2710
|
+
point.x,
|
|
2711
|
+
point.y,
|
|
2712
|
+
glowSize
|
|
2713
|
+
);
|
|
2714
|
+
gradient.addColorStop(0, burnGlowColor);
|
|
2715
|
+
gradient.addColorStop(0.5, burnGlowColor + "80");
|
|
2716
|
+
gradient.addColorStop(1, burnGlowColor + "00");
|
|
2717
|
+
context.fillStyle = gradient;
|
|
2718
|
+
context.fillRect(
|
|
2719
|
+
point.x - glowSize,
|
|
2720
|
+
point.y - glowSize,
|
|
2721
|
+
glowSize * 2,
|
|
2722
|
+
glowSize * 2
|
|
2723
|
+
);
|
|
2724
|
+
}
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
} else {
|
|
2728
|
+
context.arc(width / 2, height / 2, baseRadius, 0, Math.PI * 2);
|
|
2729
|
+
}
|
|
2730
|
+
} else {
|
|
2731
|
+
const angleInRadians = angle * Math.PI / 180;
|
|
2732
|
+
const diagonal = Math.sqrt(width * width + height * height);
|
|
2733
|
+
context.translate(width / 2, height / 2);
|
|
2734
|
+
context.rotate(angleInRadians);
|
|
2735
|
+
const wipeEdgePosition = progress * diagonal - diagonal / 2;
|
|
2736
|
+
if (edgeStyle === "burn") {
|
|
2737
|
+
const points = 100;
|
|
2738
|
+
const random = mulberry32(seed);
|
|
2739
|
+
const randomValues = Array.from({ length: points + 1 }, () => random());
|
|
2740
|
+
const phaseOffsets = Array.from(
|
|
2741
|
+
{ length: points + 1 },
|
|
2742
|
+
() => random() * Math.PI * 2
|
|
2743
|
+
);
|
|
2744
|
+
const edgePoints = [];
|
|
2745
|
+
context.moveTo(wipeEdgePosition, -diagonal / 2);
|
|
2746
|
+
for (let i = 0; i <= points; i++) {
|
|
2747
|
+
const p = i / points;
|
|
2748
|
+
const y = (p - 0.5) * diagonal;
|
|
2749
|
+
const flicker = Math.sin(frame * 0.3 + phaseOffsets[i]);
|
|
2750
|
+
const x = wipeEdgePosition + (randomValues[i] * 2 - 1) * flicker * edgeWaviness;
|
|
2751
|
+
context.lineTo(x, y);
|
|
2752
|
+
edgePoints.push({ x, y });
|
|
2753
|
+
}
|
|
2754
|
+
context.lineTo(wipeEdgePosition, diagonal / 2);
|
|
2755
|
+
context.lineTo(-diagonal / 2, diagonal / 2);
|
|
2756
|
+
context.lineTo(-diagonal / 2, -diagonal / 2);
|
|
2757
|
+
context.closePath();
|
|
2758
|
+
if (burnGlow && progress > 0.01) {
|
|
2759
|
+
const random2 = mulberry32(seed + frame);
|
|
2760
|
+
for (let i = 0; i < edgePoints.length; i += 3) {
|
|
2761
|
+
const point = edgePoints[i];
|
|
2762
|
+
const flicker = Math.sin(frame * 0.3 + phaseOffsets[i]);
|
|
2763
|
+
if (flicker > 0.2) {
|
|
2764
|
+
const glowSize = 4 + random2() * 6 * flicker * burnGlowIntensity;
|
|
2765
|
+
if (isFinite(point.x) && isFinite(point.y) && isFinite(glowSize) && glowSize > 0) {
|
|
2766
|
+
const gradient = context.createRadialGradient(
|
|
2767
|
+
point.x,
|
|
2768
|
+
point.y,
|
|
2769
|
+
0,
|
|
2770
|
+
point.x,
|
|
2771
|
+
point.y,
|
|
2772
|
+
glowSize
|
|
2773
|
+
);
|
|
2774
|
+
gradient.addColorStop(0, burnGlowColor);
|
|
2775
|
+
gradient.addColorStop(0.4, burnGlowColor + "CC");
|
|
2776
|
+
gradient.addColorStop(1, burnGlowColor + "00");
|
|
2777
|
+
context.fillStyle = gradient;
|
|
2778
|
+
context.fillRect(
|
|
2779
|
+
point.x - glowSize,
|
|
2780
|
+
point.y - glowSize,
|
|
2781
|
+
glowSize * 2,
|
|
2782
|
+
glowSize * 2
|
|
2783
|
+
);
|
|
2784
|
+
if (random2() > 0.85) {
|
|
2785
|
+
const sparkleSize = 2 + random2() * 3;
|
|
2786
|
+
context.fillStyle = "#ffffff";
|
|
2787
|
+
context.fillRect(
|
|
2788
|
+
point.x - sparkleSize / 2,
|
|
2789
|
+
point.y - sparkleSize / 2,
|
|
2790
|
+
sparkleSize,
|
|
2791
|
+
sparkleSize
|
|
2792
|
+
);
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
} else if (edgeStyle === "organic") {
|
|
2799
|
+
const points = 100;
|
|
2800
|
+
const random = mulberry32(seed);
|
|
2801
|
+
const amplitudes = Array.from(
|
|
2802
|
+
{ length: points + 1 },
|
|
2803
|
+
() => organicRandomAmplitude ? 0.5 + random() : 1
|
|
2804
|
+
);
|
|
2805
|
+
const wavelengths = Array.from(
|
|
2806
|
+
{ length: points + 1 },
|
|
2807
|
+
() => organicRandomWavelength ? 0.5 + random() * 1.5 : 1
|
|
2808
|
+
);
|
|
2809
|
+
context.moveTo(wipeEdgePosition, -diagonal / 2);
|
|
2810
|
+
for (let i = 0; i <= points; i++) {
|
|
2811
|
+
const p = i / points;
|
|
2812
|
+
const y = (p - 0.5) * diagonal;
|
|
2813
|
+
const wave = Math.sin(
|
|
2814
|
+
p * edgeFrequency * wavelengths[i] * Math.PI + frame * 0.1
|
|
2815
|
+
) * edgeWaviness * amplitudes[i];
|
|
2816
|
+
context.lineTo(wipeEdgePosition + wave, y);
|
|
2817
|
+
}
|
|
2818
|
+
context.lineTo(wipeEdgePosition, diagonal / 2);
|
|
2819
|
+
context.lineTo(-diagonal / 2, diagonal / 2);
|
|
2820
|
+
context.lineTo(-diagonal / 2, -diagonal / 2);
|
|
2821
|
+
context.closePath();
|
|
2822
|
+
} else {
|
|
2823
|
+
context.rect(
|
|
2824
|
+
-diagonal / 2,
|
|
2825
|
+
-diagonal / 2,
|
|
2826
|
+
wipeEdgePosition + diagonal / 2,
|
|
2827
|
+
diagonal
|
|
2828
|
+
);
|
|
2829
|
+
}
|
|
2830
|
+
context.rotate(-angleInRadians);
|
|
2831
|
+
context.translate(-width / 2, -height / 2);
|
|
2832
|
+
}
|
|
2833
|
+
context.clip();
|
|
2834
|
+
let sx = 0, sy = 0, sWidth = image.width, sHeight = image.height;
|
|
2835
|
+
if (fit === "cover") {
|
|
2836
|
+
const imgAspect = image.width / image.height;
|
|
2837
|
+
const canvasAspect = width / height;
|
|
2838
|
+
if (imgAspect > canvasAspect) {
|
|
2839
|
+
sWidth = image.height * canvasAspect;
|
|
2840
|
+
sx = (image.width - sWidth) / 2;
|
|
2841
|
+
} else {
|
|
2842
|
+
sHeight = image.width / canvasAspect;
|
|
2843
|
+
sy = (image.height - sHeight) / 2;
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
|
|
2847
|
+
context.restore();
|
|
2848
|
+
}, [
|
|
2849
|
+
frame,
|
|
2850
|
+
image,
|
|
2851
|
+
width,
|
|
2852
|
+
height,
|
|
2853
|
+
revealDurationInFrames,
|
|
2854
|
+
fit,
|
|
2855
|
+
revealType,
|
|
2856
|
+
angle,
|
|
2857
|
+
edgeStyle,
|
|
2858
|
+
edgeWaviness,
|
|
2859
|
+
edgeFrequency,
|
|
2860
|
+
id,
|
|
2861
|
+
backgroundColor,
|
|
2862
|
+
burnGlow,
|
|
2863
|
+
burnGlowColor,
|
|
2864
|
+
burnGlowIntensity,
|
|
2865
|
+
organicRandomAmplitude,
|
|
2866
|
+
organicRandomWavelength
|
|
2867
|
+
]);
|
|
2868
|
+
return /* @__PURE__ */ import_react16.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
|
|
2869
|
+
};
|
|
2870
|
+
|
|
2871
|
+
// src/components/effects/CanvasContentAwareReveal.tsx
|
|
2872
|
+
var import_react17 = __toESM(require("react"));
|
|
2873
|
+
var import_remotion11 = require("remotion");
|
|
2874
|
+
var import_zod4 = require("zod");
|
|
2875
|
+
var CanvasContentAwareRevealProps = import_zod4.z.object({
|
|
2876
|
+
imageUrl: import_zod4.z.string().url(),
|
|
2877
|
+
revealDurationInFrames: import_zod4.z.number().min(1),
|
|
2878
|
+
fit: import_zod4.z.enum(["cover", "contain"]).default("cover"),
|
|
2879
|
+
backgroundColor: import_zod4.z.string().default("rgba(0,0,0,0)"),
|
|
2880
|
+
burnColorOrder: import_zod4.z.enum(["vibgyor", "luminance", "random"]).default("vibgyor"),
|
|
2881
|
+
revealMode: import_zod4.z.enum(["color", "direction", "combined"]).default("combined").describe("Reveal mode: color-only, direction-only, or combined"),
|
|
2882
|
+
direction: import_zod4.z.enum(["horizontal", "vertical", "diagonal-down", "diagonal-up", "top-to-bottom"]).default("top-to-bottom"),
|
|
2883
|
+
directionLayers: import_zod4.z.number().default(10).describe("Number of layers for horizontal/vertical patterns")
|
|
2884
|
+
});
|
|
2885
|
+
var CanvasContentAwareReveal = ({ data, id }) => {
|
|
2886
|
+
const {
|
|
2887
|
+
imageUrl,
|
|
2888
|
+
revealDurationInFrames,
|
|
2889
|
+
fit,
|
|
2890
|
+
backgroundColor,
|
|
2891
|
+
burnColorOrder,
|
|
2892
|
+
revealMode,
|
|
2893
|
+
direction,
|
|
2894
|
+
directionLayers
|
|
2895
|
+
} = data;
|
|
2896
|
+
const frame = (0, import_remotion11.useCurrentFrame)();
|
|
2897
|
+
const { width, height } = (0, import_remotion11.useVideoConfig)();
|
|
2898
|
+
const canvasRef = (0, import_react17.useRef)(null);
|
|
2899
|
+
const [image, setImage] = (0, import_react17.useState)(null);
|
|
2900
|
+
const [pixelBurnMap, setPixelBurnMap] = (0, import_react17.useState)(null);
|
|
2901
|
+
const [isProcessing, setIsProcessing] = (0, import_react17.useState)(false);
|
|
2902
|
+
const burnMapGeneratedRef = (0, import_react17.useRef)(false);
|
|
2903
|
+
const rgbToHsv = (r, g, b) => {
|
|
2904
|
+
r /= 255;
|
|
2905
|
+
g /= 255;
|
|
2906
|
+
b /= 255;
|
|
2907
|
+
const max = Math.max(r, g, b), min = Math.min(r, g, b), delta = max - min;
|
|
2908
|
+
let h = 0;
|
|
2909
|
+
if (delta !== 0) {
|
|
2910
|
+
if (max === r) h = (g - b) / delta % 6;
|
|
2911
|
+
else if (max === g) h = (b - r) / delta + 2;
|
|
2912
|
+
else h = (r - g) / delta + 4;
|
|
2913
|
+
h *= 60;
|
|
2914
|
+
if (h < 0) h += 360;
|
|
2915
|
+
}
|
|
2916
|
+
return [h, max === 0 ? 0 : delta / max, max];
|
|
2917
|
+
};
|
|
2918
|
+
const getLuminance = (r, g, b) => 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2919
|
+
const hueToVibgyorOrder = (hue) => {
|
|
2920
|
+
if (hue >= 260 && hue <= 290) return 0;
|
|
2921
|
+
if (hue >= 240 && hue < 260) return 0.15;
|
|
2922
|
+
if (hue >= 200 && hue < 240) return 0.3;
|
|
2923
|
+
if (hue >= 120 && hue < 200) return 0.5;
|
|
2924
|
+
if (hue >= 50 && hue < 120) return 0.65;
|
|
2925
|
+
if (hue >= 20 && hue < 50) return 0.8;
|
|
2926
|
+
if (hue >= 290 || hue < 20) return 1;
|
|
2927
|
+
return hue / 360;
|
|
2928
|
+
};
|
|
2929
|
+
(0, import_react17.useEffect)(() => {
|
|
2930
|
+
const img = new window.Image();
|
|
2931
|
+
img.crossOrigin = "Anonymous";
|
|
2932
|
+
img.src = imageUrl;
|
|
2933
|
+
img.onload = () => {
|
|
2934
|
+
setImage(img);
|
|
2935
|
+
burnMapGeneratedRef.current = false;
|
|
2936
|
+
};
|
|
2937
|
+
}, [imageUrl]);
|
|
2938
|
+
(0, import_react17.useEffect)(() => {
|
|
2939
|
+
if (!image || isProcessing || burnMapGeneratedRef.current) return;
|
|
2940
|
+
setIsProcessing(true);
|
|
2941
|
+
setTimeout(() => {
|
|
2942
|
+
try {
|
|
2943
|
+
const canvas = document.createElement("canvas");
|
|
2944
|
+
const ctx = canvas.getContext("2d");
|
|
2945
|
+
if (!ctx) return;
|
|
2946
|
+
canvas.width = image.width;
|
|
2947
|
+
canvas.height = image.height;
|
|
2948
|
+
ctx.drawImage(image, 0, 0);
|
|
2949
|
+
const imageData = ctx.getImageData(0, 0, image.width, image.height);
|
|
2950
|
+
const pixels = imageData.data;
|
|
2951
|
+
const burnMap = new Float32Array(image.width * image.height);
|
|
2952
|
+
const rawValues = [];
|
|
2953
|
+
for (let i = 0; i < pixels.length; i += 4) {
|
|
2954
|
+
const pixelIndex = i / 4;
|
|
2955
|
+
const [r, g, b] = [pixels[i], pixels[i + 1], pixels[i + 2]];
|
|
2956
|
+
let burnValue = 0;
|
|
2957
|
+
if (burnColorOrder === "vibgyor") {
|
|
2958
|
+
const [h, s] = rgbToHsv(r, g, b);
|
|
2959
|
+
burnValue = hueToVibgyorOrder(h) * s + 0.5 * (1 - s);
|
|
2960
|
+
} else if (burnColorOrder === "luminance") {
|
|
2961
|
+
burnValue = getLuminance(r, g, b) / 255;
|
|
2962
|
+
} else {
|
|
2963
|
+
burnValue = pixelIndex * 2654435761 % 2147483648 / 2147483648;
|
|
2964
|
+
}
|
|
2965
|
+
rawValues.push(burnValue);
|
|
2966
|
+
}
|
|
2967
|
+
const numBuckets = 200;
|
|
2968
|
+
const buckets = new Array(numBuckets).fill(0);
|
|
2969
|
+
rawValues.forEach((val) => {
|
|
2970
|
+
buckets[Math.min(Math.floor(val * numBuckets), numBuckets - 1)]++;
|
|
2971
|
+
});
|
|
2972
|
+
const cumulative = new Array(numBuckets);
|
|
2973
|
+
cumulative[0] = buckets[0];
|
|
2974
|
+
for (let i = 1; i < numBuckets; i++) {
|
|
2975
|
+
cumulative[i] = cumulative[i - 1] + buckets[i];
|
|
2976
|
+
}
|
|
2977
|
+
rawValues.forEach((val, idx) => {
|
|
2978
|
+
const bucket = Math.min(Math.floor(val * numBuckets), numBuckets - 1);
|
|
2979
|
+
burnMap[idx] = cumulative[bucket] / (image.width * image.height);
|
|
2980
|
+
});
|
|
2981
|
+
if (revealMode === "direction" || revealMode === "combined") {
|
|
2982
|
+
for (let idx = 0; idx < image.width * image.height; idx++) {
|
|
2983
|
+
const x = idx % image.width;
|
|
2984
|
+
const y = Math.floor(idx / image.width);
|
|
2985
|
+
let directionValue = 0;
|
|
2986
|
+
if (direction === "horizontal") {
|
|
2987
|
+
const layer = Math.floor(y / (image.height / directionLayers));
|
|
2988
|
+
const isReverse = layer % 2 === 1;
|
|
2989
|
+
const xNorm = isReverse ? (image.width - x) / image.width : x / image.width;
|
|
2990
|
+
directionValue = layer / directionLayers + xNorm / directionLayers;
|
|
2991
|
+
} else if (direction === "vertical") {
|
|
2992
|
+
const layer = Math.floor(x / (image.width / directionLayers));
|
|
2993
|
+
const isReverse = layer % 2 === 1;
|
|
2994
|
+
const yNorm = isReverse ? (image.height - y) / image.height : y / image.height;
|
|
2995
|
+
directionValue = layer / directionLayers + yNorm / directionLayers;
|
|
2996
|
+
} else if (direction === "top-to-bottom") {
|
|
2997
|
+
directionValue = y / image.height;
|
|
2998
|
+
} else if (direction === "diagonal-down") {
|
|
2999
|
+
directionValue = (x + y) / (image.width + image.height);
|
|
3000
|
+
} else {
|
|
3001
|
+
directionValue = (x + (image.height - y)) / (image.width + image.height);
|
|
3002
|
+
}
|
|
3003
|
+
burnMap[idx] = revealMode === "combined" ? burnMap[idx] * 0.6 + directionValue * 0.4 : directionValue;
|
|
3004
|
+
}
|
|
3005
|
+
let minVal = burnMap[0];
|
|
3006
|
+
let maxVal = burnMap[0];
|
|
3007
|
+
for (let i = 1; i < burnMap.length; i++) {
|
|
3008
|
+
if (burnMap[i] < minVal) minVal = burnMap[i];
|
|
3009
|
+
if (burnMap[i] > maxVal) maxVal = burnMap[i];
|
|
3010
|
+
}
|
|
3011
|
+
const range = maxVal - minVal;
|
|
3012
|
+
if (range > 0) {
|
|
3013
|
+
for (let i = 0; i < burnMap.length; i++) {
|
|
3014
|
+
burnMap[i] = (burnMap[i] - minVal) / range;
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
setPixelBurnMap(burnMap);
|
|
3019
|
+
burnMapGeneratedRef.current = true;
|
|
3020
|
+
} finally {
|
|
3021
|
+
setIsProcessing(false);
|
|
3022
|
+
}
|
|
3023
|
+
}, 0);
|
|
3024
|
+
}, [
|
|
3025
|
+
image,
|
|
3026
|
+
burnColorOrder,
|
|
3027
|
+
revealMode,
|
|
3028
|
+
direction,
|
|
3029
|
+
directionLayers
|
|
3030
|
+
]);
|
|
3031
|
+
(0, import_react17.useEffect)(() => {
|
|
3032
|
+
if (!canvasRef.current || !image || !pixelBurnMap) return;
|
|
3033
|
+
const context = canvasRef.current.getContext("2d");
|
|
3034
|
+
if (!context) return;
|
|
3035
|
+
context.canvas.width = width;
|
|
3036
|
+
context.canvas.height = height;
|
|
3037
|
+
context.fillStyle = backgroundColor;
|
|
3038
|
+
context.fillRect(0, 0, width, height);
|
|
3039
|
+
const progress = Math.min(frame / revealDurationInFrames, 1);
|
|
3040
|
+
if (progress >= 1) {
|
|
3041
|
+
let sx2 = 0, sy2 = 0, sWidth2 = image.width, sHeight2 = image.height;
|
|
3042
|
+
if (fit === "cover") {
|
|
3043
|
+
const imgAspect = image.width / image.height;
|
|
3044
|
+
const canvasAspect = width / height;
|
|
3045
|
+
if (imgAspect > canvasAspect) {
|
|
3046
|
+
sWidth2 = image.height * canvasAspect;
|
|
3047
|
+
sx2 = (image.width - sWidth2) / 2;
|
|
3048
|
+
} else {
|
|
3049
|
+
sHeight2 = image.width / canvasAspect;
|
|
3050
|
+
sy2 = (image.height - sHeight2) / 2;
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
context.drawImage(image, sx2, sy2, sWidth2, sHeight2, 0, 0, width, height);
|
|
3054
|
+
return;
|
|
3055
|
+
}
|
|
3056
|
+
const tempCanvas = document.createElement("canvas");
|
|
3057
|
+
tempCanvas.width = image.width;
|
|
3058
|
+
tempCanvas.height = image.height;
|
|
3059
|
+
const tempCtx = tempCanvas.getContext("2d");
|
|
3060
|
+
if (!tempCtx) return;
|
|
3061
|
+
tempCtx.drawImage(image, 0, 0);
|
|
3062
|
+
const imageData = tempCtx.getImageData(0, 0, image.width, image.height);
|
|
3063
|
+
const pixels = imageData.data;
|
|
3064
|
+
const transitionWidth = Math.max(
|
|
3065
|
+
0.02,
|
|
3066
|
+
Math.min(0.15, 3 / (revealDurationInFrames / 100))
|
|
3067
|
+
);
|
|
3068
|
+
for (let i = 0; i < pixels.length; i += 4) {
|
|
3069
|
+
const pixelIndex = i / 4;
|
|
3070
|
+
const burnProgress = (progress - pixelBurnMap[pixelIndex]) / transitionWidth;
|
|
3071
|
+
pixels[i + 3] = Math.floor(
|
|
3072
|
+
pixels[i + 3] * Math.max(0, Math.min(1, burnProgress))
|
|
3073
|
+
);
|
|
3074
|
+
}
|
|
3075
|
+
tempCtx.putImageData(imageData, 0, 0);
|
|
3076
|
+
let sx = 0, sy = 0, sWidth = image.width, sHeight = image.height;
|
|
3077
|
+
if (fit === "cover") {
|
|
3078
|
+
const imgAspect = image.width / image.height;
|
|
3079
|
+
const canvasAspect = width / height;
|
|
3080
|
+
if (imgAspect > canvasAspect) {
|
|
3081
|
+
sWidth = image.height * canvasAspect;
|
|
3082
|
+
sx = (image.width - sWidth) / 2;
|
|
3083
|
+
} else {
|
|
3084
|
+
sHeight = image.width / canvasAspect;
|
|
3085
|
+
sy = (image.height - sHeight) / 2;
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
context.drawImage(tempCanvas, sx, sy, sWidth, sHeight, 0, 0, width, height);
|
|
3089
|
+
}, [
|
|
3090
|
+
frame,
|
|
3091
|
+
image,
|
|
3092
|
+
width,
|
|
3093
|
+
height,
|
|
3094
|
+
pixelBurnMap,
|
|
3095
|
+
revealDurationInFrames,
|
|
3096
|
+
fit,
|
|
3097
|
+
backgroundColor
|
|
3098
|
+
]);
|
|
3099
|
+
return /* @__PURE__ */ import_react17.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
|
|
3100
|
+
};
|
|
3101
|
+
|
|
3102
|
+
// src/components/effects/CanvasGlitchEffect.tsx
|
|
3103
|
+
var import_react18 = __toESM(require("react"));
|
|
3104
|
+
var import_remotion12 = require("remotion");
|
|
3105
|
+
var import_zod5 = require("zod");
|
|
3106
|
+
var CanvasGlitchEffectProps = import_zod5.z.object({
|
|
3107
|
+
imageUrl: import_zod5.z.string().url(),
|
|
3108
|
+
durationInFrames: import_zod5.z.number().min(1),
|
|
3109
|
+
fit: import_zod5.z.enum(["cover", "contain"]).default("cover"),
|
|
3110
|
+
backgroundColor: import_zod5.z.string().default("rgba(0,0,0,0)"),
|
|
3111
|
+
glitchType: import_zod5.z.enum(["rgb-shift", "slice", "corrupt", "static", "scan"]).default("rgb-shift"),
|
|
3112
|
+
intensity: import_zod5.z.number().default(10).describe("Intensity of glitch effect"),
|
|
3113
|
+
frequency: import_zod5.z.number().default(0.3).describe("How often glitches occur (0-1)"),
|
|
3114
|
+
continuous: import_zod5.z.boolean().default(false).describe("Continuous glitch vs periodic"),
|
|
3115
|
+
glitchStartFrame: import_zod5.z.number().default(0).describe("Frame to start glitching"),
|
|
3116
|
+
glitchEndFrame: import_zod5.z.number().default(-1).describe("Frame to end glitching (-1 = duration)")
|
|
3117
|
+
});
|
|
3118
|
+
var CanvasGlitchEffect = ({ data, id }) => {
|
|
3119
|
+
const {
|
|
3120
|
+
imageUrl,
|
|
3121
|
+
durationInFrames,
|
|
3122
|
+
fit,
|
|
3123
|
+
backgroundColor,
|
|
3124
|
+
glitchType,
|
|
3125
|
+
intensity,
|
|
3126
|
+
frequency,
|
|
3127
|
+
continuous,
|
|
3128
|
+
glitchStartFrame,
|
|
3129
|
+
glitchEndFrame
|
|
3130
|
+
} = data;
|
|
3131
|
+
const frame = (0, import_remotion12.useCurrentFrame)();
|
|
3132
|
+
const { width, height } = (0, import_remotion12.useVideoConfig)();
|
|
3133
|
+
const canvasRef = (0, import_react18.useRef)(null);
|
|
3134
|
+
const [image, setImage] = (0, import_react18.useState)(null);
|
|
3135
|
+
(0, import_react18.useEffect)(() => {
|
|
3136
|
+
const img = new window.Image();
|
|
3137
|
+
img.crossOrigin = "Anonymous";
|
|
3138
|
+
img.src = imageUrl;
|
|
3139
|
+
img.onload = () => setImage(img);
|
|
3140
|
+
}, [imageUrl]);
|
|
3141
|
+
(0, import_react18.useEffect)(() => {
|
|
3142
|
+
if (!canvasRef.current || !image) return;
|
|
3143
|
+
const context = canvasRef.current.getContext("2d");
|
|
3144
|
+
if (!context) return;
|
|
3145
|
+
context.canvas.width = width;
|
|
3146
|
+
context.canvas.height = height;
|
|
3147
|
+
context.fillStyle = backgroundColor;
|
|
3148
|
+
context.fillRect(0, 0, width, height);
|
|
3149
|
+
const endFrame = glitchEndFrame === -1 ? durationInFrames : glitchEndFrame;
|
|
3150
|
+
const isInGlitchRange = frame >= glitchStartFrame && frame <= endFrame;
|
|
3151
|
+
const seed = Math.floor(frame / 3);
|
|
3152
|
+
const random = (seed * 9301 + 49297) % 233280 / 233280;
|
|
3153
|
+
const isGlitching = isInGlitchRange && (continuous || random < frequency);
|
|
3154
|
+
let sx = 0, sy = 0, sWidth = image.width, sHeight = image.height;
|
|
3155
|
+
if (fit === "cover") {
|
|
3156
|
+
const imgAspect = image.width / image.height;
|
|
3157
|
+
const canvasAspect = width / height;
|
|
3158
|
+
if (imgAspect > canvasAspect) {
|
|
3159
|
+
sWidth = image.height * canvasAspect;
|
|
3160
|
+
sx = (image.width - sWidth) / 2;
|
|
3161
|
+
} else {
|
|
3162
|
+
sHeight = image.width / canvasAspect;
|
|
3163
|
+
sy = (image.height - sHeight) / 2;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
if (!isGlitching) {
|
|
3167
|
+
context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
|
|
3168
|
+
return;
|
|
3169
|
+
}
|
|
3170
|
+
if (glitchType === "rgb-shift") {
|
|
3171
|
+
const tempCanvas = document.createElement("canvas");
|
|
3172
|
+
tempCanvas.width = image.width;
|
|
3173
|
+
tempCanvas.height = image.height;
|
|
3174
|
+
const tempCtx = tempCanvas.getContext("2d");
|
|
3175
|
+
if (!tempCtx) return;
|
|
3176
|
+
tempCtx.drawImage(image, 0, 0);
|
|
3177
|
+
const imageData = tempCtx.getImageData(0, 0, image.width, image.height);
|
|
3178
|
+
const pixels = imageData.data;
|
|
3179
|
+
const shift = intensity * (random * 2 - 1);
|
|
3180
|
+
const redData = tempCtx.createImageData(image.width, image.height);
|
|
3181
|
+
const greenData = tempCtx.createImageData(image.width, image.height);
|
|
3182
|
+
const blueData = tempCtx.createImageData(image.width, image.height);
|
|
3183
|
+
for (let i = 0; i < pixels.length; i += 4) {
|
|
3184
|
+
redData.data[i] = pixels[i];
|
|
3185
|
+
redData.data[i + 3] = pixels[i + 3];
|
|
3186
|
+
greenData.data[i + 1] = pixels[i + 1];
|
|
3187
|
+
greenData.data[i + 3] = pixels[i + 3];
|
|
3188
|
+
blueData.data[i + 2] = pixels[i + 2];
|
|
3189
|
+
blueData.data[i + 3] = pixels[i + 3];
|
|
3190
|
+
}
|
|
3191
|
+
context.save();
|
|
3192
|
+
context.globalCompositeOperation = "screen";
|
|
3193
|
+
tempCtx.putImageData(redData, 0, 0);
|
|
3194
|
+
context.drawImage(
|
|
3195
|
+
tempCanvas,
|
|
3196
|
+
sx + shift,
|
|
3197
|
+
sy,
|
|
3198
|
+
sWidth,
|
|
3199
|
+
sHeight,
|
|
3200
|
+
shift,
|
|
3201
|
+
0,
|
|
3202
|
+
width,
|
|
3203
|
+
height
|
|
3204
|
+
);
|
|
3205
|
+
tempCtx.putImageData(greenData, 0, 0);
|
|
3206
|
+
context.drawImage(
|
|
3207
|
+
tempCanvas,
|
|
3208
|
+
sx,
|
|
3209
|
+
sy,
|
|
3210
|
+
sWidth,
|
|
3211
|
+
sHeight,
|
|
3212
|
+
0,
|
|
3213
|
+
0,
|
|
3214
|
+
width,
|
|
3215
|
+
height
|
|
3216
|
+
);
|
|
3217
|
+
tempCtx.putImageData(blueData, 0, 0);
|
|
3218
|
+
context.drawImage(
|
|
3219
|
+
tempCanvas,
|
|
3220
|
+
sx - shift,
|
|
3221
|
+
sy,
|
|
3222
|
+
sWidth,
|
|
3223
|
+
sHeight,
|
|
3224
|
+
-shift,
|
|
3225
|
+
0,
|
|
3226
|
+
width,
|
|
3227
|
+
height
|
|
3228
|
+
);
|
|
3229
|
+
context.restore();
|
|
3230
|
+
} else if (glitchType === "slice") {
|
|
3231
|
+
const sliceCount = 20;
|
|
3232
|
+
const sliceHeight = height / sliceCount;
|
|
3233
|
+
for (let i = 0; i < sliceCount; i++) {
|
|
3234
|
+
const offset = (random * 2 - 1) * intensity * (i % 2 === 0 ? 1 : -1);
|
|
3235
|
+
const sy_slice = sy + sHeight / sliceCount * i;
|
|
3236
|
+
const dy = sliceHeight * i;
|
|
3237
|
+
context.drawImage(
|
|
3238
|
+
image,
|
|
3239
|
+
sx,
|
|
3240
|
+
sy_slice,
|
|
3241
|
+
sWidth,
|
|
3242
|
+
sHeight / sliceCount,
|
|
3243
|
+
offset,
|
|
3244
|
+
dy,
|
|
3245
|
+
width,
|
|
3246
|
+
sliceHeight
|
|
3247
|
+
);
|
|
3248
|
+
}
|
|
3249
|
+
} else if (glitchType === "corrupt") {
|
|
3250
|
+
context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
|
|
3251
|
+
const blockCount = Math.floor(intensity / 2);
|
|
3252
|
+
for (let i = 0; i < blockCount; i++) {
|
|
3253
|
+
const blockW = Math.random() * width * 0.3;
|
|
3254
|
+
const blockH = Math.random() * height * 0.2;
|
|
3255
|
+
const blockX = Math.random() * (width - blockW);
|
|
3256
|
+
const blockY = Math.random() * (height - blockH);
|
|
3257
|
+
const sourceX = Math.random() * (width - blockW);
|
|
3258
|
+
const sourceY = Math.random() * (height - blockH);
|
|
3259
|
+
try {
|
|
3260
|
+
const imgData = context.getImageData(
|
|
3261
|
+
sourceX,
|
|
3262
|
+
sourceY,
|
|
3263
|
+
blockW,
|
|
3264
|
+
blockH
|
|
3265
|
+
);
|
|
3266
|
+
context.putImageData(imgData, blockX, blockY);
|
|
3267
|
+
} catch (e) {
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
} else if (glitchType === "static") {
|
|
3271
|
+
context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
|
|
3272
|
+
const imageData = context.getImageData(0, 0, width, height);
|
|
3273
|
+
const pixels = imageData.data;
|
|
3274
|
+
for (let i = 0; i < pixels.length; i += 4) {
|
|
3275
|
+
if (Math.random() < intensity / 100) {
|
|
3276
|
+
const noise = Math.random() * 255;
|
|
3277
|
+
pixels[i] = noise;
|
|
3278
|
+
pixels[i + 1] = noise;
|
|
3279
|
+
pixels[i + 2] = noise;
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
context.putImageData(imageData, 0, 0);
|
|
3283
|
+
} else if (glitchType === "scan") {
|
|
3284
|
+
context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
|
|
3285
|
+
const scanY = frame * 5 % height;
|
|
3286
|
+
context.fillStyle = `rgba(255, 255, 255, ${intensity / 100})`;
|
|
3287
|
+
context.fillRect(0, scanY, width, 3);
|
|
3288
|
+
const distortY = Math.max(0, scanY - 10);
|
|
3289
|
+
const distortHeight = Math.min(20, height - distortY);
|
|
3290
|
+
if (distortHeight > 0) {
|
|
3291
|
+
try {
|
|
3292
|
+
const imgData = context.getImageData(
|
|
3293
|
+
0,
|
|
3294
|
+
distortY,
|
|
3295
|
+
width,
|
|
3296
|
+
distortHeight
|
|
3297
|
+
);
|
|
3298
|
+
const shiftAmount = intensity * (random * 2 - 1);
|
|
3299
|
+
context.putImageData(imgData, shiftAmount, distortY);
|
|
3300
|
+
} catch (e) {
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
}, [
|
|
3305
|
+
frame,
|
|
3306
|
+
image,
|
|
3307
|
+
width,
|
|
3308
|
+
height,
|
|
3309
|
+
durationInFrames,
|
|
3310
|
+
fit,
|
|
3311
|
+
backgroundColor,
|
|
3312
|
+
glitchType,
|
|
3313
|
+
intensity,
|
|
3314
|
+
frequency,
|
|
3315
|
+
continuous,
|
|
3316
|
+
glitchStartFrame,
|
|
3317
|
+
glitchEndFrame
|
|
3318
|
+
]);
|
|
3319
|
+
return /* @__PURE__ */ import_react18.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
|
|
3320
|
+
};
|
|
3321
|
+
|
|
3322
|
+
// src/components/effects/CanvasParticleEffect.tsx
|
|
3323
|
+
var import_react19 = __toESM(require("react"));
|
|
3324
|
+
var import_remotion13 = require("remotion");
|
|
3325
|
+
var import_zod6 = require("zod");
|
|
3326
|
+
var CanvasParticleEffectProps = import_zod6.z.object({
|
|
3327
|
+
imageUrl: import_zod6.z.string().url(),
|
|
3328
|
+
revealDurationInFrames: import_zod6.z.number().min(1),
|
|
3329
|
+
fit: import_zod6.z.enum(["cover", "contain"]).default("cover"),
|
|
3330
|
+
backgroundColor: import_zod6.z.string().default("rgba(0,0,0,0)"),
|
|
3331
|
+
particleCount: import_zod6.z.number().default(2e3).describe("Number of particles"),
|
|
3332
|
+
particleSize: import_zod6.z.number().default(3).describe("Size of each particle"),
|
|
3333
|
+
particleEffect: import_zod6.z.enum(["assemble", "disassemble", "explode", "pixelate"]).default("assemble"),
|
|
3334
|
+
assembleFrom: import_zod6.z.enum(["center", "edges", "random", "bottom"]).default("random"),
|
|
3335
|
+
speed: import_zod6.z.number().default(1).describe("Animation speed multiplier"),
|
|
3336
|
+
rotation: import_zod6.z.boolean().default(false).describe("Add rotation to particles")
|
|
3337
|
+
});
|
|
3338
|
+
var CanvasParticleEffect = ({ data, id }) => {
|
|
3339
|
+
const {
|
|
3340
|
+
imageUrl,
|
|
3341
|
+
revealDurationInFrames,
|
|
3342
|
+
fit,
|
|
3343
|
+
backgroundColor,
|
|
3344
|
+
particleCount,
|
|
3345
|
+
particleSize,
|
|
3346
|
+
particleEffect,
|
|
3347
|
+
assembleFrom,
|
|
3348
|
+
speed,
|
|
3349
|
+
rotation
|
|
3350
|
+
} = data;
|
|
3351
|
+
const frame = (0, import_remotion13.useCurrentFrame)();
|
|
3352
|
+
const { width, height } = (0, import_remotion13.useVideoConfig)();
|
|
3353
|
+
const canvasRef = (0, import_react19.useRef)(null);
|
|
3354
|
+
const [image, setImage] = (0, import_react19.useState)(null);
|
|
3355
|
+
const [particles, setParticles] = (0, import_react19.useState)(null);
|
|
3356
|
+
(0, import_react19.useEffect)(() => {
|
|
3357
|
+
const img = new window.Image();
|
|
3358
|
+
img.crossOrigin = "Anonymous";
|
|
3359
|
+
img.src = imageUrl;
|
|
3360
|
+
img.onload = () => setImage(img);
|
|
3361
|
+
}, [imageUrl]);
|
|
3362
|
+
(0, import_react19.useEffect)(() => {
|
|
3363
|
+
if (!image) return;
|
|
3364
|
+
const canvas = document.createElement("canvas");
|
|
3365
|
+
const ctx = canvas.getContext("2d");
|
|
3366
|
+
if (!ctx) return;
|
|
3367
|
+
canvas.width = image.width;
|
|
3368
|
+
canvas.height = image.height;
|
|
3369
|
+
ctx.drawImage(image, 0, 0);
|
|
3370
|
+
const imageData = ctx.getImageData(0, 0, image.width, image.height);
|
|
3371
|
+
const pixels = imageData.data;
|
|
3372
|
+
const particleArray = [];
|
|
3373
|
+
const step = Math.floor(
|
|
3374
|
+
Math.sqrt(image.width * image.height / particleCount)
|
|
3375
|
+
);
|
|
3376
|
+
for (let y = 0; y < image.height; y += step) {
|
|
3377
|
+
for (let x = 0; x < image.width; x += step) {
|
|
3378
|
+
const i = (y * image.width + x) * 4;
|
|
3379
|
+
const [r, g, b, a] = [
|
|
3380
|
+
pixels[i],
|
|
3381
|
+
pixels[i + 1],
|
|
3382
|
+
pixels[i + 2],
|
|
3383
|
+
pixels[i + 3]
|
|
3384
|
+
];
|
|
3385
|
+
if (a > 128) {
|
|
3386
|
+
const targetX = x;
|
|
3387
|
+
const targetY = y;
|
|
3388
|
+
let startX = targetX, startY = targetY;
|
|
3389
|
+
if (particleEffect === "assemble") {
|
|
3390
|
+
if (assembleFrom === "center") {
|
|
3391
|
+
startX = image.width / 2;
|
|
3392
|
+
startY = image.height / 2;
|
|
3393
|
+
} else if (assembleFrom === "edges") {
|
|
3394
|
+
const edge = Math.floor(Math.random() * 4);
|
|
3395
|
+
if (edge === 0) {
|
|
3396
|
+
startX = 0;
|
|
3397
|
+
startY = Math.random() * image.height;
|
|
3398
|
+
} else if (edge === 1) {
|
|
3399
|
+
startX = image.width;
|
|
3400
|
+
startY = Math.random() * image.height;
|
|
3401
|
+
} else if (edge === 2) {
|
|
3402
|
+
startX = Math.random() * image.width;
|
|
3403
|
+
startY = 0;
|
|
3404
|
+
} else {
|
|
3405
|
+
startX = Math.random() * image.width;
|
|
3406
|
+
startY = image.height;
|
|
3407
|
+
}
|
|
3408
|
+
} else if (assembleFrom === "bottom") {
|
|
3409
|
+
startX = targetX;
|
|
3410
|
+
startY = image.height + Math.random() * 200;
|
|
3411
|
+
} else {
|
|
3412
|
+
startX = Math.random() * image.width;
|
|
3413
|
+
startY = Math.random() * image.height;
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
particleArray.push({
|
|
3417
|
+
x: startX,
|
|
3418
|
+
y: startY,
|
|
3419
|
+
targetX,
|
|
3420
|
+
targetY,
|
|
3421
|
+
color: `rgba(${r},${g},${b},${a / 255})`,
|
|
3422
|
+
startX,
|
|
3423
|
+
startY,
|
|
3424
|
+
angle: Math.random() * Math.PI * 2
|
|
3425
|
+
});
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
setParticles(particleArray);
|
|
3430
|
+
}, [image, particleCount, particleEffect, assembleFrom]);
|
|
3431
|
+
(0, import_react19.useEffect)(() => {
|
|
3432
|
+
if (!canvasRef.current || !image || !particles) return;
|
|
3433
|
+
const context = canvasRef.current.getContext("2d");
|
|
3434
|
+
if (!context) return;
|
|
3435
|
+
context.canvas.width = width;
|
|
3436
|
+
context.canvas.height = height;
|
|
3437
|
+
context.fillStyle = backgroundColor;
|
|
3438
|
+
context.fillRect(0, 0, width, height);
|
|
3439
|
+
const progress = Math.min(frame / revealDurationInFrames * speed, 1);
|
|
3440
|
+
if (progress >= 1 && particleEffect === "assemble") {
|
|
3441
|
+
const scaleX2 = width / image.width;
|
|
3442
|
+
const scaleY2 = height / image.height;
|
|
3443
|
+
let scale2 = scaleX2;
|
|
3444
|
+
let offsetX2 = 0, offsetY2 = 0;
|
|
3445
|
+
if (fit === "cover") {
|
|
3446
|
+
scale2 = Math.max(scaleX2, scaleY2);
|
|
3447
|
+
offsetX2 = (width - image.width * scale2) / 2;
|
|
3448
|
+
offsetY2 = (height - image.height * scale2) / 2;
|
|
3449
|
+
} else {
|
|
3450
|
+
scale2 = Math.min(scaleX2, scaleY2);
|
|
3451
|
+
offsetX2 = (width - image.width * scale2) / 2;
|
|
3452
|
+
offsetY2 = (height - image.height * scale2) / 2;
|
|
3453
|
+
}
|
|
3454
|
+
context.save();
|
|
3455
|
+
context.translate(offsetX2, offsetY2);
|
|
3456
|
+
context.scale(scale2, scale2);
|
|
3457
|
+
context.drawImage(image, 0, 0);
|
|
3458
|
+
context.restore();
|
|
3459
|
+
return;
|
|
3460
|
+
}
|
|
3461
|
+
const easeProgress = particleEffect === "explode" ? progress * progress * (3 - 2 * progress) : 1 - Math.pow(1 - progress, 3);
|
|
3462
|
+
const scaleX = width / image.width;
|
|
3463
|
+
const scaleY = height / image.height;
|
|
3464
|
+
let scale = scaleX;
|
|
3465
|
+
let offsetX = 0, offsetY = 0;
|
|
3466
|
+
if (fit === "cover") {
|
|
3467
|
+
scale = Math.max(scaleX, scaleY);
|
|
3468
|
+
offsetX = (width - image.width * scale) / 2;
|
|
3469
|
+
offsetY = (height - image.height * scale) / 2;
|
|
3470
|
+
} else {
|
|
3471
|
+
scale = Math.min(scaleX, scaleY);
|
|
3472
|
+
offsetX = (width - image.width * scale) / 2;
|
|
3473
|
+
offsetY = (height - image.height * scale) / 2;
|
|
3474
|
+
}
|
|
3475
|
+
particles.forEach((particle) => {
|
|
3476
|
+
let x, y;
|
|
3477
|
+
if (particleEffect === "assemble") {
|
|
3478
|
+
x = particle.startX + (particle.targetX - particle.startX) * easeProgress;
|
|
3479
|
+
y = particle.startY + (particle.targetY - particle.startY) * easeProgress;
|
|
3480
|
+
} else if (particleEffect === "disassemble") {
|
|
3481
|
+
const reverseProgress = 1 - easeProgress;
|
|
3482
|
+
x = particle.targetX + (particle.startX - particle.targetX) * (1 - reverseProgress);
|
|
3483
|
+
y = particle.targetY + (particle.startY - particle.targetY) * (1 - reverseProgress);
|
|
3484
|
+
} else if (particleEffect === "explode") {
|
|
3485
|
+
const dx = particle.targetX - image.width / 2;
|
|
3486
|
+
const dy = particle.targetY - image.height / 2;
|
|
3487
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
3488
|
+
const explosionDist = dist * easeProgress * 3;
|
|
3489
|
+
x = particle.targetX + dx / dist * explosionDist;
|
|
3490
|
+
y = particle.targetY + dy / dist * explosionDist;
|
|
3491
|
+
} else {
|
|
3492
|
+
x = particle.targetX;
|
|
3493
|
+
y = particle.targetY;
|
|
3494
|
+
}
|
|
3495
|
+
const finalX = x * scale + offsetX;
|
|
3496
|
+
const finalY = y * scale + offsetY;
|
|
3497
|
+
context.save();
|
|
3498
|
+
context.translate(finalX, finalY);
|
|
3499
|
+
if (rotation && particleEffect !== "pixelate") {
|
|
3500
|
+
context.rotate(particle.angle * easeProgress);
|
|
3501
|
+
}
|
|
3502
|
+
const size = particleEffect === "pixelate" ? particleSize * (1 + (1 - easeProgress) * 3) : particleSize;
|
|
3503
|
+
context.fillStyle = particle.color;
|
|
3504
|
+
context.fillRect(-size / 2, -size / 2, size, size);
|
|
3505
|
+
context.restore();
|
|
3506
|
+
});
|
|
3507
|
+
}, [
|
|
3508
|
+
frame,
|
|
3509
|
+
image,
|
|
3510
|
+
width,
|
|
3511
|
+
height,
|
|
3512
|
+
particles,
|
|
3513
|
+
revealDurationInFrames,
|
|
3514
|
+
fit,
|
|
3515
|
+
backgroundColor,
|
|
3516
|
+
particleSize,
|
|
3517
|
+
particleEffect,
|
|
3518
|
+
speed,
|
|
3519
|
+
rotation
|
|
3520
|
+
]);
|
|
3521
|
+
return /* @__PURE__ */ import_react19.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
|
|
3522
|
+
};
|
|
3523
|
+
|
|
3524
|
+
// src/components/effects/GenericPresets.ts
|
|
3525
|
+
var fadeInPreset = [
|
|
3526
|
+
{ key: "opacity", val: 0, prog: 0 },
|
|
3527
|
+
{ key: "opacity", val: 1, prog: 1 }
|
|
3528
|
+
];
|
|
3529
|
+
var fadeOutPreset = [
|
|
3530
|
+
{ key: "opacity", val: 1, prog: 0 },
|
|
3531
|
+
{ key: "opacity", val: 0, prog: 1 }
|
|
3532
|
+
];
|
|
3533
|
+
var scaleInPreset = [
|
|
3534
|
+
{ key: "scale", val: 0, prog: 0 },
|
|
3535
|
+
{ key: "scale", val: 1, prog: 1 }
|
|
3536
|
+
];
|
|
3537
|
+
var scaleOutPreset = [
|
|
3538
|
+
{ key: "scale", val: 1, prog: 0 },
|
|
3539
|
+
{ key: "scale", val: 0, prog: 1 }
|
|
3540
|
+
];
|
|
3541
|
+
var slideInLeftPreset = [
|
|
3542
|
+
{ key: "translateX", val: -100, prog: 0 },
|
|
3543
|
+
{ key: "translateX", val: 0, prog: 1 }
|
|
3544
|
+
];
|
|
3545
|
+
var slideInRightPreset = [
|
|
3546
|
+
{ key: "translateX", val: 100, prog: 0 },
|
|
3547
|
+
{ key: "translateX", val: 0, prog: 1 }
|
|
3548
|
+
];
|
|
3549
|
+
var slideInTopPreset = [
|
|
3550
|
+
{ key: "translateY", val: -100, prog: 0 },
|
|
3551
|
+
{ key: "translateY", val: 0, prog: 1 }
|
|
3552
|
+
];
|
|
3553
|
+
var slideInBottomPreset = [
|
|
3554
|
+
{ key: "translateY", val: 100, prog: 0 },
|
|
3555
|
+
{ key: "translateY", val: 0, prog: 1 }
|
|
3556
|
+
];
|
|
3557
|
+
var bouncePreset = [
|
|
3558
|
+
{ key: "scale", val: 0, prog: 0 },
|
|
3559
|
+
{ key: "scale", val: 1.2, prog: 0.6 },
|
|
3560
|
+
{ key: "scale", val: 1, prog: 1 }
|
|
3561
|
+
];
|
|
3562
|
+
var pulsePreset = [
|
|
3563
|
+
{ key: "scale", val: 1, prog: 0 },
|
|
3564
|
+
{ key: "scale", val: 1.1, prog: 0.5 },
|
|
3565
|
+
{ key: "scale", val: 1, prog: 1 }
|
|
3566
|
+
];
|
|
3567
|
+
var rotateInPreset = [
|
|
3568
|
+
{ key: "rotate", val: -180, prog: 0 },
|
|
3569
|
+
{ key: "rotate", val: 0, prog: 1 }
|
|
3570
|
+
];
|
|
3571
|
+
var blurInPreset = [
|
|
3572
|
+
{ key: "blur", val: 10, prog: 0 },
|
|
3573
|
+
{ key: "blur", val: 0, prog: 1 }
|
|
3574
|
+
];
|
|
3575
|
+
var fadeInScalePreset = [
|
|
3576
|
+
{ key: "opacity", val: 0, prog: 0 },
|
|
3577
|
+
{ key: "opacity", val: 1, prog: 1 },
|
|
3578
|
+
{ key: "scale", val: 0.8, prog: 0 },
|
|
3579
|
+
{ key: "scale", val: 1, prog: 1 }
|
|
3580
|
+
];
|
|
3581
|
+
var slideInFadePreset = [
|
|
3582
|
+
{ key: "translateX", val: -50, prog: 0 },
|
|
3583
|
+
{ key: "translateX", val: 0, prog: 1 },
|
|
3584
|
+
{ key: "opacity", val: 0, prog: 0 },
|
|
3585
|
+
{ key: "opacity", val: 1, prog: 1 }
|
|
3586
|
+
];
|
|
3587
|
+
var slideInLeftStringPreset = [
|
|
3588
|
+
{ key: "translateX", val: "-100px", prog: 0 },
|
|
3589
|
+
{ key: "translateX", val: "0px", prog: 1 }
|
|
3590
|
+
];
|
|
3591
|
+
var slideInRightStringPreset = [
|
|
3592
|
+
{ key: "translateX", val: "100px", prog: 0 },
|
|
3593
|
+
{ key: "translateX", val: "0px", prog: 1 }
|
|
3594
|
+
];
|
|
3595
|
+
var slideInTopStringPreset = [
|
|
3596
|
+
{ key: "translateY", val: "-100px", prog: 0 },
|
|
3597
|
+
{ key: "translateY", val: "0px", prog: 1 }
|
|
3598
|
+
];
|
|
3599
|
+
var slideInBottomStringPreset = [
|
|
3600
|
+
{ key: "translateY", val: "100px", prog: 0 },
|
|
3601
|
+
{ key: "translateY", val: "0px", prog: 1 }
|
|
3602
|
+
];
|
|
3603
|
+
var rotateInStringPreset = [
|
|
3604
|
+
{ key: "rotate", val: "-180deg", prog: 0 },
|
|
3605
|
+
{ key: "rotate", val: "0deg", prog: 1 }
|
|
3606
|
+
];
|
|
3607
|
+
var blurInStringPreset = [
|
|
3608
|
+
{ key: "blur", val: "10px", prog: 0 },
|
|
3609
|
+
{ key: "blur", val: "0px", prog: 1 }
|
|
3610
|
+
];
|
|
3611
|
+
var scaleInStringPreset = [
|
|
3612
|
+
{ key: "scale", val: 0, prog: 0 },
|
|
3613
|
+
{ key: "scale", val: 1, prog: 1 }
|
|
3614
|
+
];
|
|
3615
|
+
var slideInLeftResponsivePreset = [
|
|
3616
|
+
{ key: "translateX", val: "-50vw", prog: 0 },
|
|
3617
|
+
{ key: "translateX", val: "0vw", prog: 1 }
|
|
3618
|
+
];
|
|
3619
|
+
var slideInTopResponsivePreset = [
|
|
3620
|
+
{ key: "translateY", val: "-50vh", prog: 0 },
|
|
3621
|
+
{ key: "translateY", val: "0vh", prog: 1 }
|
|
3622
|
+
];
|
|
3623
|
+
var backgroundColorPreset = [
|
|
3624
|
+
{ key: "backgroundColor", val: "#ff0000", prog: 0 },
|
|
3625
|
+
{ key: "backgroundColor", val: "#0000ff", prog: 1 }
|
|
3626
|
+
];
|
|
3627
|
+
var borderRadiusPreset = [
|
|
3628
|
+
{ key: "borderRadius", val: "0px", prog: 0 },
|
|
3629
|
+
{ key: "borderRadius", val: "50px", prog: 1 }
|
|
3630
|
+
];
|
|
3631
|
+
var boxShadowPreset = [
|
|
3632
|
+
{ key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
3633
|
+
{ key: "boxShadow", val: "10px 10px 20px rgba(0,0,0,0.5)", prog: 1 }
|
|
3634
|
+
];
|
|
3635
|
+
var fontSizePreset = [
|
|
3636
|
+
{ key: "fontSize", val: "12px", prog: 0 },
|
|
3637
|
+
{ key: "fontSize", val: "24px", prog: 1 }
|
|
3638
|
+
];
|
|
3639
|
+
var letterSpacingPreset = [
|
|
3640
|
+
{ key: "letterSpacing", val: "0px", prog: 0 },
|
|
3641
|
+
{ key: "letterSpacing", val: "5px", prog: 1 }
|
|
3642
|
+
];
|
|
3643
|
+
var lineHeightPreset = [
|
|
3644
|
+
{ key: "lineHeight", val: "1", prog: 0 },
|
|
3645
|
+
{ key: "lineHeight", val: "2", prog: 1 }
|
|
3646
|
+
];
|
|
3647
|
+
var textShadowPreset = [
|
|
3648
|
+
{ key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
3649
|
+
{ key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
|
|
3650
|
+
];
|
|
3651
|
+
var widthPreset = [
|
|
3652
|
+
{ key: "width", val: "0px", prog: 0 },
|
|
3653
|
+
{ key: "width", val: "100%", prog: 1 }
|
|
3654
|
+
];
|
|
3655
|
+
var heightPreset = [
|
|
3656
|
+
{ key: "height", val: "0px", prog: 0 },
|
|
3657
|
+
{ key: "height", val: "100%", prog: 1 }
|
|
3658
|
+
];
|
|
3659
|
+
var marginPreset = [
|
|
3660
|
+
{ key: "margin", val: "0px", prog: 0 },
|
|
3661
|
+
{ key: "margin", val: "20px", prog: 1 }
|
|
3662
|
+
];
|
|
3663
|
+
var paddingPreset = [
|
|
3664
|
+
{ key: "padding", val: "0px", prog: 0 },
|
|
3665
|
+
{ key: "padding", val: "20px", prog: 1 }
|
|
3666
|
+
];
|
|
3667
|
+
var morphingCardPreset = [
|
|
3668
|
+
{ key: "borderRadius", val: "0px", prog: 0 },
|
|
3669
|
+
{ key: "borderRadius", val: "20px", prog: 0.5 },
|
|
3670
|
+
{ key: "borderRadius", val: "50px", prog: 1 },
|
|
3671
|
+
{ key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
3672
|
+
{ key: "boxShadow", val: "0px 10px 30px rgba(0,0,0,0.3)", prog: 1 },
|
|
3673
|
+
{ key: "backgroundColor", val: "#ffffff", prog: 0 },
|
|
3674
|
+
{ key: "backgroundColor", val: "#f0f0f0", prog: 1 }
|
|
3675
|
+
];
|
|
3676
|
+
var textRevealPreset = [
|
|
3677
|
+
{ key: "opacity", val: 0, prog: 0 },
|
|
3678
|
+
{ key: "opacity", val: 1, prog: 1 },
|
|
3679
|
+
{ key: "letterSpacing", val: "10px", prog: 0 },
|
|
3680
|
+
{ key: "letterSpacing", val: "0px", prog: 1 },
|
|
3681
|
+
{ key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
|
|
3682
|
+
{ key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
|
|
3683
|
+
];
|
|
3684
|
+
var GenericEffectPresets = {
|
|
3685
|
+
fadeInPreset,
|
|
3686
|
+
fadeOutPreset,
|
|
3687
|
+
scaleInPreset,
|
|
3688
|
+
scaleOutPreset,
|
|
3689
|
+
slideInLeftPreset,
|
|
3690
|
+
slideInRightPreset,
|
|
3691
|
+
slideInTopPreset,
|
|
3692
|
+
slideInBottomPreset,
|
|
3693
|
+
bouncePreset,
|
|
3694
|
+
pulsePreset,
|
|
3695
|
+
rotateInPreset,
|
|
3696
|
+
blurInPreset,
|
|
3697
|
+
fadeInScalePreset,
|
|
3698
|
+
slideInFadePreset,
|
|
3699
|
+
// String-based presets
|
|
3700
|
+
slideInLeftStringPreset,
|
|
3701
|
+
slideInRightStringPreset,
|
|
3702
|
+
slideInTopStringPreset,
|
|
3703
|
+
slideInBottomStringPreset,
|
|
3704
|
+
rotateInStringPreset,
|
|
3705
|
+
blurInStringPreset,
|
|
3706
|
+
scaleInStringPreset,
|
|
3707
|
+
slideInLeftResponsivePreset,
|
|
3708
|
+
slideInTopResponsivePreset,
|
|
3709
|
+
// Custom CSS property presets
|
|
3710
|
+
backgroundColorPreset,
|
|
3711
|
+
borderRadiusPreset,
|
|
3712
|
+
boxShadowPreset,
|
|
3713
|
+
fontSizePreset,
|
|
3714
|
+
letterSpacingPreset,
|
|
3715
|
+
lineHeightPreset,
|
|
3716
|
+
textShadowPreset,
|
|
3717
|
+
widthPreset,
|
|
3718
|
+
heightPreset,
|
|
3719
|
+
marginPreset,
|
|
3720
|
+
paddingPreset,
|
|
3721
|
+
morphingCardPreset,
|
|
3722
|
+
textRevealPreset
|
|
3723
|
+
};
|
|
3724
|
+
|
|
3725
|
+
// src/components/effects/index.ts
|
|
3726
|
+
registerEffect(config2.displayName, BlurEffect, config2);
|
|
3727
|
+
registerEffect(config3.displayName, LoopEffect, config3);
|
|
3728
|
+
registerEffect(config4.displayName, PanEffect, config4);
|
|
3729
|
+
registerEffect(config5.displayName, ZoomEffect, config5);
|
|
3730
|
+
registerEffect("generic", UniversalEffect, config);
|
|
3731
|
+
registerEffect(config6.displayName, ShakeEffect, config6);
|
|
3732
|
+
registerEffect(
|
|
3733
|
+
config7.displayName,
|
|
3734
|
+
StretchEffect,
|
|
3735
|
+
config7
|
|
3736
|
+
);
|
|
3737
|
+
registerEffect(
|
|
3738
|
+
config8.displayName,
|
|
3739
|
+
WaveformEffect,
|
|
3740
|
+
config8
|
|
3741
|
+
);
|
|
3742
|
+
registerEffect("CanvasWipeReveal", CanvasWipeReveal);
|
|
3743
|
+
registerEffect("CanvasContentAwareReveal", CanvasContentAwareReveal);
|
|
3744
|
+
registerEffect("CanvasParticleEffect", CanvasParticleEffect);
|
|
3745
|
+
registerEffect("CanvasGlitchEffect", CanvasGlitchEffect);
|
|
3746
|
+
|
|
3747
|
+
// src/components/layouts/BaseLayout.tsx
|
|
3748
|
+
var Layout = ({ id, children, data, context }) => {
|
|
3749
|
+
const { containerProps = {}, childrenProps = [], repeatChildrenProps = {} } = data;
|
|
3750
|
+
const overrideStyles = useAnimatedStyles(id);
|
|
3751
|
+
const childrenArray = import_react20.Children.toArray(children);
|
|
3752
|
+
const enhancedStyle = (0, import_react20.useMemo)(
|
|
2102
3753
|
() => ({
|
|
2103
3754
|
...!context?.boundaries?.reset ? context?.boundaries : {},
|
|
2104
3755
|
...containerProps.style,
|
|
@@ -2112,8 +3763,8 @@ var Layout = ({ id, children, data, context }) => {
|
|
|
2112
3763
|
);
|
|
2113
3764
|
if (Object.keys(repeatChildrenProps).length <= 0 && childrenProps.length <= 0) {
|
|
2114
3765
|
if (data.isAbsoluteFill) {
|
|
2115
|
-
return /* @__PURE__ */
|
|
2116
|
-
|
|
3766
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
3767
|
+
import_remotion14.AbsoluteFill,
|
|
2117
3768
|
{
|
|
2118
3769
|
...containerProps,
|
|
2119
3770
|
style: enhancedStyle
|
|
@@ -2121,25 +3772,25 @@ var Layout = ({ id, children, data, context }) => {
|
|
|
2121
3772
|
childrenArray
|
|
2122
3773
|
);
|
|
2123
3774
|
}
|
|
2124
|
-
return /* @__PURE__ */
|
|
3775
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
2125
3776
|
"div",
|
|
2126
3777
|
{
|
|
2127
3778
|
id,
|
|
2128
3779
|
...containerProps,
|
|
2129
3780
|
style: enhancedStyle
|
|
2130
3781
|
},
|
|
2131
|
-
childrenArray.map((child, index) => /* @__PURE__ */
|
|
3782
|
+
childrenArray.map((child, index) => /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, { key: index }, child))
|
|
2132
3783
|
);
|
|
2133
3784
|
}
|
|
2134
3785
|
if (data.isAbsoluteFill) {
|
|
2135
|
-
return /* @__PURE__ */
|
|
2136
|
-
|
|
3786
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
3787
|
+
import_remotion14.AbsoluteFill,
|
|
2137
3788
|
{
|
|
2138
3789
|
id,
|
|
2139
3790
|
...containerProps,
|
|
2140
3791
|
style: enhancedStyle
|
|
2141
3792
|
},
|
|
2142
|
-
childrenArray.map((child, index) => /* @__PURE__ */
|
|
3793
|
+
childrenArray.map((child, index) => /* @__PURE__ */ import_react20.default.createElement(
|
|
2143
3794
|
"div",
|
|
2144
3795
|
{
|
|
2145
3796
|
key: index,
|
|
@@ -2149,14 +3800,14 @@ var Layout = ({ id, children, data, context }) => {
|
|
|
2149
3800
|
))
|
|
2150
3801
|
);
|
|
2151
3802
|
}
|
|
2152
|
-
return /* @__PURE__ */
|
|
3803
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
2153
3804
|
"div",
|
|
2154
3805
|
{
|
|
2155
3806
|
id,
|
|
2156
3807
|
...containerProps,
|
|
2157
3808
|
style: enhancedStyle
|
|
2158
3809
|
},
|
|
2159
|
-
childrenArray.map((child, index) => /* @__PURE__ */
|
|
3810
|
+
childrenArray.map((child, index) => /* @__PURE__ */ import_react20.default.createElement(
|
|
2160
3811
|
"div",
|
|
2161
3812
|
{
|
|
2162
3813
|
key: index,
|
|
@@ -2166,7 +3817,7 @@ var Layout = ({ id, children, data, context }) => {
|
|
|
2166
3817
|
))
|
|
2167
3818
|
);
|
|
2168
3819
|
};
|
|
2169
|
-
var
|
|
3820
|
+
var config10 = {
|
|
2170
3821
|
displayName: "BaseLayout",
|
|
2171
3822
|
type: "layout",
|
|
2172
3823
|
isInnerSequence: false
|
|
@@ -2174,27 +3825,27 @@ var config8 = {
|
|
|
2174
3825
|
|
|
2175
3826
|
// src/components/layouts/index.ts
|
|
2176
3827
|
registerComponent(
|
|
2177
|
-
|
|
3828
|
+
config10.displayName,
|
|
2178
3829
|
Layout,
|
|
2179
3830
|
"layout",
|
|
2180
|
-
|
|
3831
|
+
config10
|
|
2181
3832
|
);
|
|
2182
3833
|
|
|
2183
3834
|
// src/components/atoms/ShapeAtom.tsx
|
|
2184
|
-
var
|
|
2185
|
-
var
|
|
2186
|
-
var
|
|
2187
|
-
const frame = (0,
|
|
3835
|
+
var import_react21 = __toESM(require("react"));
|
|
3836
|
+
var import_remotion15 = require("remotion");
|
|
3837
|
+
var Atom2 = ({ data }) => {
|
|
3838
|
+
const frame = (0, import_remotion15.useCurrentFrame)();
|
|
2188
3839
|
const { shape, color, rotation, style } = data;
|
|
2189
3840
|
const rotationStyle = rotation ? {
|
|
2190
|
-
transform: `rotate(${(0,
|
|
3841
|
+
transform: `rotate(${(0, import_remotion15.interpolate)(
|
|
2191
3842
|
frame % rotation.duration,
|
|
2192
3843
|
[0, rotation.duration],
|
|
2193
3844
|
[0, 360],
|
|
2194
3845
|
{
|
|
2195
3846
|
extrapolateLeft: "clamp",
|
|
2196
3847
|
extrapolateRight: "clamp",
|
|
2197
|
-
easing:
|
|
3848
|
+
easing: import_remotion15.Easing.linear
|
|
2198
3849
|
}
|
|
2199
3850
|
)}deg)`
|
|
2200
3851
|
} : {};
|
|
@@ -2206,22 +3857,22 @@ var Atom = ({ data }) => {
|
|
|
2206
3857
|
};
|
|
2207
3858
|
switch (shape) {
|
|
2208
3859
|
case "circle":
|
|
2209
|
-
return /* @__PURE__ */
|
|
3860
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { style: { ...baseStyle, backgroundColor: color, borderRadius: "50%" } });
|
|
2210
3861
|
case "rectangle":
|
|
2211
|
-
return /* @__PURE__ */
|
|
3862
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", { style: { ...baseStyle, backgroundColor: color } });
|
|
2212
3863
|
default:
|
|
2213
3864
|
return null;
|
|
2214
3865
|
}
|
|
2215
3866
|
};
|
|
2216
|
-
var
|
|
3867
|
+
var config11 = {
|
|
2217
3868
|
displayName: "ShapeAtom",
|
|
2218
3869
|
type: "atom",
|
|
2219
3870
|
isInnerSequence: false
|
|
2220
3871
|
};
|
|
2221
3872
|
|
|
2222
3873
|
// src/components/atoms/ImageAtom.tsx
|
|
2223
|
-
var
|
|
2224
|
-
var
|
|
3874
|
+
var import_react22 = __toESM(require("react"));
|
|
3875
|
+
var import_remotion16 = require("remotion");
|
|
2225
3876
|
var CORS_PROXIES = [
|
|
2226
3877
|
"https://thingproxy.freeboard.io/fetch/",
|
|
2227
3878
|
"https://api.allorigins.win/raw?url=",
|
|
@@ -2231,14 +3882,14 @@ var getCorsProxyUrl = (url) => {
|
|
|
2231
3882
|
return `${CORS_PROXIES[0]}${encodeURIComponent(url)}`;
|
|
2232
3883
|
};
|
|
2233
3884
|
var useImageSource = (src, proxySrc) => {
|
|
2234
|
-
const [imageSource, setImageSource] = (0,
|
|
2235
|
-
const [isLoading, setIsLoading] = (0,
|
|
2236
|
-
const [hasError, setHasError] = (0,
|
|
2237
|
-
const [handle] = (0,
|
|
2238
|
-
(0,
|
|
3885
|
+
const [imageSource, setImageSource] = (0, import_react22.useState)(src);
|
|
3886
|
+
const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
|
|
3887
|
+
const [hasError, setHasError] = (0, import_react22.useState)(false);
|
|
3888
|
+
const [handle] = (0, import_react22.useState)(() => (0, import_remotion16.delayRender)("Loading image"));
|
|
3889
|
+
(0, import_react22.useEffect)(() => {
|
|
2239
3890
|
if (!src.startsWith("http")) {
|
|
2240
3891
|
setImageSource(src);
|
|
2241
|
-
(0,
|
|
3892
|
+
(0, import_remotion16.continueRender)(handle);
|
|
2242
3893
|
return;
|
|
2243
3894
|
}
|
|
2244
3895
|
setIsLoading(true);
|
|
@@ -2248,7 +3899,7 @@ var useImageSource = (src, proxySrc) => {
|
|
|
2248
3899
|
const handleSuccess = () => {
|
|
2249
3900
|
setImageSource(src);
|
|
2250
3901
|
setIsLoading(false);
|
|
2251
|
-
(0,
|
|
3902
|
+
(0, import_remotion16.continueRender)(handle);
|
|
2252
3903
|
};
|
|
2253
3904
|
const handleError = () => {
|
|
2254
3905
|
let proxyUrl;
|
|
@@ -2259,7 +3910,7 @@ var useImageSource = (src, proxySrc) => {
|
|
|
2259
3910
|
}
|
|
2260
3911
|
setImageSource(proxyUrl);
|
|
2261
3912
|
setIsLoading(false);
|
|
2262
|
-
(0,
|
|
3913
|
+
(0, import_remotion16.continueRender)(handle);
|
|
2263
3914
|
};
|
|
2264
3915
|
testImage.onload = handleSuccess;
|
|
2265
3916
|
testImage.onerror = handleError;
|
|
@@ -2271,21 +3922,21 @@ var useImageSource = (src, proxySrc) => {
|
|
|
2271
3922
|
}, [src, proxySrc, handle]);
|
|
2272
3923
|
return { imageSource, isLoading, hasError };
|
|
2273
3924
|
};
|
|
2274
|
-
var
|
|
3925
|
+
var Atom3 = ({ data, id }) => {
|
|
2275
3926
|
const overrideStyles = useAnimatedStyles(id);
|
|
2276
3927
|
const { imageSource, isLoading, hasError } = useImageSource(data.src, data.proxySrc);
|
|
2277
|
-
const source = (0,
|
|
3928
|
+
const source = (0, import_react22.useMemo)(() => {
|
|
2278
3929
|
if (data.src.startsWith("http")) {
|
|
2279
3930
|
return imageSource;
|
|
2280
3931
|
}
|
|
2281
|
-
return (0,
|
|
3932
|
+
return (0, import_remotion16.staticFile)(data.src);
|
|
2282
3933
|
}, [data.src, imageSource]);
|
|
2283
|
-
const enhancedStyle = (0,
|
|
3934
|
+
const enhancedStyle = (0, import_react22.useMemo)(() => ({
|
|
2284
3935
|
...data.style,
|
|
2285
3936
|
...overrideStyles
|
|
2286
3937
|
}), [data.style, overrideStyles, isLoading, hasError]);
|
|
2287
|
-
return /* @__PURE__ */
|
|
2288
|
-
|
|
3938
|
+
return /* @__PURE__ */ import_react22.default.createElement(
|
|
3939
|
+
import_remotion16.Img,
|
|
2289
3940
|
{
|
|
2290
3941
|
className: data.className,
|
|
2291
3942
|
src: source,
|
|
@@ -2298,19 +3949,19 @@ var Atom2 = ({ data, id }) => {
|
|
|
2298
3949
|
}
|
|
2299
3950
|
);
|
|
2300
3951
|
};
|
|
2301
|
-
var
|
|
3952
|
+
var config12 = {
|
|
2302
3953
|
displayName: "ImageAtom",
|
|
2303
3954
|
type: "atom",
|
|
2304
3955
|
isInnerSequence: false
|
|
2305
3956
|
};
|
|
2306
3957
|
|
|
2307
3958
|
// src/components/atoms/TextAtom.tsx
|
|
2308
|
-
var
|
|
2309
|
-
var
|
|
3959
|
+
var import_react24 = __toESM(require("react"));
|
|
3960
|
+
var import_remotion18 = require("remotion");
|
|
2310
3961
|
|
|
2311
3962
|
// src/hooks/useFontLoader.ts
|
|
2312
|
-
var
|
|
2313
|
-
var
|
|
3963
|
+
var import_react23 = require("react");
|
|
3964
|
+
var import_remotion17 = require("remotion");
|
|
2314
3965
|
|
|
2315
3966
|
// src/utils/fontUtils.ts
|
|
2316
3967
|
var fontUtils = __toESM(require("@remotion/google-fonts"));
|
|
@@ -2451,12 +4102,12 @@ var getNormalizedFontName = (fontFamily) => {
|
|
|
2451
4102
|
|
|
2452
4103
|
// src/hooks/useFontLoader.ts
|
|
2453
4104
|
var useFontLoader = (options = {}) => {
|
|
2454
|
-
const [state, setState] = (0,
|
|
4105
|
+
const [state, setState] = (0, import_react23.useState)({
|
|
2455
4106
|
loadedFonts: /* @__PURE__ */ new Map(),
|
|
2456
4107
|
loadingFonts: /* @__PURE__ */ new Set(),
|
|
2457
4108
|
errorFonts: /* @__PURE__ */ new Map()
|
|
2458
4109
|
});
|
|
2459
|
-
const loadFont = (0,
|
|
4110
|
+
const loadFont = (0, import_react23.useCallback)(
|
|
2460
4111
|
async (fontFamily, fontOptions = {}) => {
|
|
2461
4112
|
const fontKey = `${fontFamily}-${JSON.stringify(fontOptions)}`;
|
|
2462
4113
|
if (state.loadedFonts.has(fontKey) || state.loadingFonts.has(fontFamily)) {
|
|
@@ -2499,7 +4150,7 @@ var useFontLoader = (options = {}) => {
|
|
|
2499
4150
|
},
|
|
2500
4151
|
[state.loadedFonts, state.loadingFonts, options]
|
|
2501
4152
|
);
|
|
2502
|
-
const loadMultipleFonts2 = (0,
|
|
4153
|
+
const loadMultipleFonts2 = (0, import_react23.useCallback)(
|
|
2503
4154
|
async (fonts) => {
|
|
2504
4155
|
const fontsToLoad = fonts.filter(({ family, options: options2 = {} }) => {
|
|
2505
4156
|
const fontKey = `${family}-${JSON.stringify(options2)}`;
|
|
@@ -2558,14 +4209,14 @@ var useFontLoader = (options = {}) => {
|
|
|
2558
4209
|
},
|
|
2559
4210
|
[state.loadedFonts, state.loadingFonts, options]
|
|
2560
4211
|
);
|
|
2561
|
-
const isFontReady = (0,
|
|
4212
|
+
const isFontReady = (0, import_react23.useCallback)(
|
|
2562
4213
|
(fontFamily, options2 = {}) => {
|
|
2563
4214
|
const fontKey = `${fontFamily}-${JSON.stringify(options2)}`;
|
|
2564
4215
|
return state.loadedFonts.has(fontKey);
|
|
2565
4216
|
},
|
|
2566
4217
|
[state.loadedFonts]
|
|
2567
4218
|
);
|
|
2568
|
-
const areFontsReady = (0,
|
|
4219
|
+
const areFontsReady = (0, import_react23.useCallback)(
|
|
2569
4220
|
(fontFamilies) => {
|
|
2570
4221
|
return fontFamilies.every(({ family, options: options2 = {} }) => {
|
|
2571
4222
|
const fontKey = `${family}-${JSON.stringify(options2)}`;
|
|
@@ -2574,20 +4225,20 @@ var useFontLoader = (options = {}) => {
|
|
|
2574
4225
|
},
|
|
2575
4226
|
[state.loadedFonts]
|
|
2576
4227
|
);
|
|
2577
|
-
const getFontFamily = (0,
|
|
4228
|
+
const getFontFamily = (0, import_react23.useCallback)(
|
|
2578
4229
|
(fontFamily, options2 = {}) => {
|
|
2579
4230
|
const fontKey = `${fontFamily}-${JSON.stringify(options2)}`;
|
|
2580
4231
|
return state.loadedFonts.get(fontKey);
|
|
2581
4232
|
},
|
|
2582
4233
|
[state.loadedFonts]
|
|
2583
4234
|
);
|
|
2584
|
-
const getFontError = (0,
|
|
4235
|
+
const getFontError = (0, import_react23.useCallback)(
|
|
2585
4236
|
(fontFamily) => {
|
|
2586
4237
|
return state.errorFonts.get(fontFamily);
|
|
2587
4238
|
},
|
|
2588
4239
|
[state.errorFonts]
|
|
2589
4240
|
);
|
|
2590
|
-
const clearErrors = (0,
|
|
4241
|
+
const clearErrors = (0, import_react23.useCallback)(() => {
|
|
2591
4242
|
setState((prev) => ({
|
|
2592
4243
|
...prev,
|
|
2593
4244
|
errorFonts: /* @__PURE__ */ new Map()
|
|
@@ -2610,25 +4261,25 @@ var useFontLoader = (options = {}) => {
|
|
|
2610
4261
|
};
|
|
2611
4262
|
var useFont = (fontFamily, options = {}) => {
|
|
2612
4263
|
const { loadFont, isFontReady, getFontFamily, getFontError, ...rest } = useFontLoader(options);
|
|
2613
|
-
const [isLoaded, setIsLoaded] = (0,
|
|
2614
|
-
const [error, setError] = (0,
|
|
2615
|
-
const [renderHandle] = (0,
|
|
2616
|
-
() => (0,
|
|
4264
|
+
const [isLoaded, setIsLoaded] = (0, import_react23.useState)(false);
|
|
4265
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
4266
|
+
const [renderHandle] = (0, import_react23.useState)(
|
|
4267
|
+
() => (0, import_remotion17.delayRender)(`Loading font: ${fontFamily}`)
|
|
2617
4268
|
);
|
|
2618
4269
|
const initialFontFamily = getFontFamily(fontFamily, options) || `"${fontFamily}", sans-serif`;
|
|
2619
|
-
const [fontFamilyValue, setFontFamilyValue] = (0,
|
|
2620
|
-
(0,
|
|
4270
|
+
const [fontFamilyValue, setFontFamilyValue] = (0, import_react23.useState)(initialFontFamily);
|
|
4271
|
+
(0, import_react23.useEffect)(() => {
|
|
2621
4272
|
const loadFontAsync = async () => {
|
|
2622
4273
|
try {
|
|
2623
4274
|
const cssValue = await loadFont(fontFamily, options);
|
|
2624
4275
|
setFontFamilyValue(cssValue);
|
|
2625
4276
|
setIsLoaded(true);
|
|
2626
4277
|
setError(null);
|
|
2627
|
-
(0,
|
|
4278
|
+
(0, import_remotion17.continueRender)(renderHandle);
|
|
2628
4279
|
} catch (err) {
|
|
2629
4280
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
2630
4281
|
setIsLoaded(false);
|
|
2631
|
-
(0,
|
|
4282
|
+
(0, import_remotion17.continueRender)(renderHandle);
|
|
2632
4283
|
}
|
|
2633
4284
|
};
|
|
2634
4285
|
if (!isFontReady(fontFamily, options)) {
|
|
@@ -2639,7 +4290,7 @@ var useFont = (fontFamily, options = {}) => {
|
|
|
2639
4290
|
setFontFamilyValue(cachedValue);
|
|
2640
4291
|
}
|
|
2641
4292
|
setIsLoaded(true);
|
|
2642
|
-
(0,
|
|
4293
|
+
(0, import_remotion17.continueRender)(renderHandle);
|
|
2643
4294
|
}
|
|
2644
4295
|
}, [fontFamily, loadFont, isFontReady, getFontFamily, options, renderHandle]);
|
|
2645
4296
|
return {
|
|
@@ -2652,11 +4303,11 @@ var useFont = (fontFamily, options = {}) => {
|
|
|
2652
4303
|
};
|
|
2653
4304
|
|
|
2654
4305
|
// src/components/atoms/TextAtom.tsx
|
|
2655
|
-
var
|
|
4306
|
+
var Atom4 = ({ id, data }) => {
|
|
2656
4307
|
const overrideStyles = useAnimatedStyles(id);
|
|
2657
|
-
const [isFontLoading, setIsFontLoading] = (0,
|
|
2658
|
-
const [renderHandle] = (0,
|
|
2659
|
-
() => (0,
|
|
4308
|
+
const [isFontLoading, setIsFontLoading] = (0, import_react24.useState)(false);
|
|
4309
|
+
const [renderHandle] = (0, import_react24.useState)(
|
|
4310
|
+
() => (0, import_remotion18.delayRender)(`Loading font: ${data.font?.family}`)
|
|
2660
4311
|
);
|
|
2661
4312
|
const { isLoaded, error, isReady, fontFamily } = useFont(
|
|
2662
4313
|
data.font?.family || "Inter",
|
|
@@ -2667,15 +4318,15 @@ var Atom3 = ({ id, data }) => {
|
|
|
2667
4318
|
preload: data.font?.preload !== false,
|
|
2668
4319
|
onLoad: (family, cssValue) => {
|
|
2669
4320
|
setIsFontLoading(false);
|
|
2670
|
-
(0,
|
|
4321
|
+
(0, import_remotion18.continueRender)(renderHandle);
|
|
2671
4322
|
},
|
|
2672
4323
|
onError: (family, error2) => {
|
|
2673
4324
|
setIsFontLoading(false);
|
|
2674
|
-
(0,
|
|
4325
|
+
(0, import_remotion18.continueRender)(renderHandle);
|
|
2675
4326
|
}
|
|
2676
4327
|
}
|
|
2677
4328
|
);
|
|
2678
|
-
(0,
|
|
4329
|
+
(0, import_react24.useEffect)(() => {
|
|
2679
4330
|
if (data.font?.family) {
|
|
2680
4331
|
if (isReady || isLoaded) {
|
|
2681
4332
|
setIsFontLoading(false);
|
|
@@ -2684,7 +4335,7 @@ var Atom3 = ({ id, data }) => {
|
|
|
2684
4335
|
}
|
|
2685
4336
|
}
|
|
2686
4337
|
}, [data.font, isReady, isLoaded, error]);
|
|
2687
|
-
const enhancedStyle = (0,
|
|
4338
|
+
const enhancedStyle = (0, import_react24.useMemo)(() => {
|
|
2688
4339
|
const baseStyle = {
|
|
2689
4340
|
fontFamily,
|
|
2690
4341
|
...data.style
|
|
@@ -2705,12 +4356,12 @@ var Atom3 = ({ id, data }) => {
|
|
|
2705
4356
|
};
|
|
2706
4357
|
}, [fontFamily, data.style, data.gradient, overrideStyles]);
|
|
2707
4358
|
if (isFontLoading && data.loadingState?.showLoadingIndicator) {
|
|
2708
|
-
return /* @__PURE__ */
|
|
4359
|
+
return /* @__PURE__ */ import_react24.default.createElement("div", { style: enhancedStyle, className: data.className }, /* @__PURE__ */ import_react24.default.createElement("span", { style: data.loadingState.loadingStyle }, data.loadingState.loadingText || "Loading..."));
|
|
2709
4360
|
}
|
|
2710
4361
|
if (error && data.errorState?.showErrorIndicator) {
|
|
2711
|
-
return /* @__PURE__ */
|
|
4362
|
+
return /* @__PURE__ */ import_react24.default.createElement("div", { style: enhancedStyle, className: data.className }, /* @__PURE__ */ import_react24.default.createElement("span", { style: data.errorState.errorStyle }, data.errorState.errorText || data.text));
|
|
2712
4363
|
}
|
|
2713
|
-
return /* @__PURE__ */
|
|
4364
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
2714
4365
|
"div",
|
|
2715
4366
|
{
|
|
2716
4367
|
style: enhancedStyle,
|
|
@@ -2723,60 +4374,60 @@ var Atom3 = ({ id, data }) => {
|
|
|
2723
4374
|
data.text
|
|
2724
4375
|
);
|
|
2725
4376
|
};
|
|
2726
|
-
var
|
|
4377
|
+
var config13 = {
|
|
2727
4378
|
displayName: "TextAtom",
|
|
2728
4379
|
type: "atom",
|
|
2729
4380
|
isInnerSequence: false
|
|
2730
4381
|
};
|
|
2731
4382
|
|
|
2732
4383
|
// src/components/atoms/VideoAtom.tsx
|
|
2733
|
-
var
|
|
2734
|
-
var
|
|
2735
|
-
var
|
|
2736
|
-
var VideoAtomDataProps =
|
|
2737
|
-
src:
|
|
4384
|
+
var import_react25 = __toESM(require("react"));
|
|
4385
|
+
var import_remotion19 = require("remotion");
|
|
4386
|
+
var import_zod7 = require("zod");
|
|
4387
|
+
var VideoAtomDataProps = import_zod7.z.object({
|
|
4388
|
+
src: import_zod7.z.string(),
|
|
2738
4389
|
// Video source URL
|
|
2739
|
-
srcDuration:
|
|
4390
|
+
srcDuration: import_zod7.z.number().optional(),
|
|
2740
4391
|
// Video duration in seconds (or to say it more accurately, each iteration duration in a loop))
|
|
2741
|
-
style:
|
|
4392
|
+
style: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.any()).optional(),
|
|
2742
4393
|
// CSS styles object
|
|
2743
|
-
containerClassName:
|
|
4394
|
+
containerClassName: import_zod7.z.string().optional(),
|
|
2744
4395
|
// CSS class names
|
|
2745
|
-
className:
|
|
4396
|
+
className: import_zod7.z.string().optional(),
|
|
2746
4397
|
// CSS class names
|
|
2747
|
-
startFrom:
|
|
4398
|
+
startFrom: import_zod7.z.number().optional(),
|
|
2748
4399
|
// Start playback from this time (seconds)
|
|
2749
|
-
endAt:
|
|
4400
|
+
endAt: import_zod7.z.number().optional(),
|
|
2750
4401
|
// End playback at this time (seconds)
|
|
2751
|
-
playbackRate:
|
|
4402
|
+
playbackRate: import_zod7.z.number().optional(),
|
|
2752
4403
|
// Playback speed multiplier
|
|
2753
|
-
volume:
|
|
4404
|
+
volume: import_zod7.z.number().optional(),
|
|
2754
4405
|
// Volume level (0-1)
|
|
2755
|
-
muted:
|
|
4406
|
+
muted: import_zod7.z.boolean().optional(),
|
|
2756
4407
|
// Mute video audio
|
|
2757
|
-
loop:
|
|
4408
|
+
loop: import_zod7.z.boolean().optional(),
|
|
2758
4409
|
// Whether to loop the video
|
|
2759
|
-
fit:
|
|
4410
|
+
fit: import_zod7.z.enum(["contain", "cover", "fill", "none", "scale-down"]).optional()
|
|
2760
4411
|
// Object fit style
|
|
2761
4412
|
});
|
|
2762
|
-
var
|
|
2763
|
-
const { fps } = (0,
|
|
4413
|
+
var Atom5 = ({ data, id, context }) => {
|
|
4414
|
+
const { fps } = (0, import_remotion19.useVideoConfig)();
|
|
2764
4415
|
const overrideStyles = useAnimatedStyles(id);
|
|
2765
|
-
const frame = (0,
|
|
2766
|
-
const source = (0,
|
|
4416
|
+
const frame = (0, import_remotion19.useCurrentFrame)();
|
|
4417
|
+
const source = (0, import_react25.useMemo)(() => {
|
|
2767
4418
|
if (data.src.startsWith("http")) {
|
|
2768
4419
|
return data.src;
|
|
2769
4420
|
}
|
|
2770
|
-
return (0,
|
|
4421
|
+
return (0, import_remotion19.staticFile)(data.src);
|
|
2771
4422
|
}, [data.src]);
|
|
2772
|
-
const trimBefore = (0,
|
|
4423
|
+
const trimBefore = (0, import_react25.useMemo)(() => {
|
|
2773
4424
|
return data.startFrom ? data.startFrom * fps : void 0;
|
|
2774
4425
|
}, [data.startFrom, fps]);
|
|
2775
|
-
const trimAfter = (0,
|
|
4426
|
+
const trimAfter = (0, import_react25.useMemo)(() => {
|
|
2776
4427
|
return data.endAt ? data.endAt * fps : void 0;
|
|
2777
4428
|
}, [data.endAt, fps]);
|
|
2778
|
-
const videoComponent = /* @__PURE__ */
|
|
2779
|
-
|
|
4429
|
+
const videoComponent = /* @__PURE__ */ import_react25.default.createElement(
|
|
4430
|
+
import_remotion19.OffthreadVideo,
|
|
2780
4431
|
{
|
|
2781
4432
|
className: data.className,
|
|
2782
4433
|
src: source,
|
|
@@ -2788,8 +4439,8 @@ var Atom4 = ({ data, id, context }) => {
|
|
|
2788
4439
|
muted: data.muted
|
|
2789
4440
|
}
|
|
2790
4441
|
);
|
|
2791
|
-
const videoWithStyles = data.containerClassName ? videoComponent : /* @__PURE__ */
|
|
2792
|
-
|
|
4442
|
+
const videoWithStyles = data.containerClassName ? videoComponent : /* @__PURE__ */ import_react25.default.createElement(
|
|
4443
|
+
import_remotion19.OffthreadVideo,
|
|
2793
4444
|
{
|
|
2794
4445
|
className: data.className,
|
|
2795
4446
|
src: source,
|
|
@@ -2802,53 +4453,53 @@ var Atom4 = ({ data, id, context }) => {
|
|
|
2802
4453
|
}
|
|
2803
4454
|
);
|
|
2804
4455
|
if (data.loop) {
|
|
2805
|
-
return /* @__PURE__ */
|
|
4456
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_remotion19.Loop, { times: Infinity, durationInFrames: data.srcDuration ? data.srcDuration * fps : context.timing?.durationInFrames, layout: "none" }, data.containerClassName ? /* @__PURE__ */ import_react25.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles);
|
|
2806
4457
|
}
|
|
2807
|
-
return data.containerClassName ? /* @__PURE__ */
|
|
4458
|
+
return data.containerClassName ? /* @__PURE__ */ import_react25.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles;
|
|
2808
4459
|
};
|
|
2809
|
-
var
|
|
4460
|
+
var config14 = {
|
|
2810
4461
|
displayName: "VideoAtom",
|
|
2811
4462
|
type: "atom",
|
|
2812
4463
|
isInnerSequence: false
|
|
2813
4464
|
};
|
|
2814
4465
|
|
|
2815
4466
|
// src/components/atoms/AudioAtom.tsx
|
|
2816
|
-
var
|
|
2817
|
-
var
|
|
2818
|
-
var
|
|
2819
|
-
var AudioAtomMutedRangeProps =
|
|
2820
|
-
type:
|
|
2821
|
-
values:
|
|
2822
|
-
start:
|
|
4467
|
+
var import_react26 = __toESM(require("react"));
|
|
4468
|
+
var import_remotion20 = require("remotion");
|
|
4469
|
+
var import_zod8 = require("zod");
|
|
4470
|
+
var AudioAtomMutedRangeProps = import_zod8.z.object({
|
|
4471
|
+
type: import_zod8.z.literal("range"),
|
|
4472
|
+
values: import_zod8.z.array(import_zod8.z.object({
|
|
4473
|
+
start: import_zod8.z.number(),
|
|
2823
4474
|
// Start time in seconds
|
|
2824
|
-
end:
|
|
4475
|
+
end: import_zod8.z.number()
|
|
2825
4476
|
// End time in seconds
|
|
2826
4477
|
}))
|
|
2827
4478
|
});
|
|
2828
|
-
var AudioAtomMutedFullProps =
|
|
2829
|
-
type:
|
|
2830
|
-
value:
|
|
4479
|
+
var AudioAtomMutedFullProps = import_zod8.z.object({
|
|
4480
|
+
type: import_zod8.z.literal("full"),
|
|
4481
|
+
value: import_zod8.z.boolean()
|
|
2831
4482
|
// true = muted, false = unmuted
|
|
2832
4483
|
});
|
|
2833
|
-
var AudioAtomDataProps =
|
|
2834
|
-
src:
|
|
4484
|
+
var AudioAtomDataProps = import_zod8.z.object({
|
|
4485
|
+
src: import_zod8.z.string(),
|
|
2835
4486
|
// Audio source URL
|
|
2836
|
-
startFrom:
|
|
4487
|
+
startFrom: import_zod8.z.number().optional(),
|
|
2837
4488
|
// Start playback from this time (seconds)
|
|
2838
|
-
endAt:
|
|
4489
|
+
endAt: import_zod8.z.number().optional(),
|
|
2839
4490
|
// End playback at this time (seconds)
|
|
2840
|
-
volume:
|
|
4491
|
+
volume: import_zod8.z.number().optional(),
|
|
2841
4492
|
// Volume level (0-1)
|
|
2842
|
-
playbackRate:
|
|
4493
|
+
playbackRate: import_zod8.z.number().optional(),
|
|
2843
4494
|
// Playback speed multiplier
|
|
2844
|
-
muted:
|
|
4495
|
+
muted: import_zod8.z.union([AudioAtomMutedFullProps, AudioAtomMutedRangeProps]).optional()
|
|
2845
4496
|
// Mute configuration
|
|
2846
4497
|
});
|
|
2847
|
-
var
|
|
2848
|
-
const { fps } = (0,
|
|
4498
|
+
var Atom6 = ({ data }) => {
|
|
4499
|
+
const { fps } = (0, import_remotion20.useVideoConfig)();
|
|
2849
4500
|
const { muted } = data;
|
|
2850
|
-
const frame = (0,
|
|
2851
|
-
const isMuted = (0,
|
|
4501
|
+
const frame = (0, import_remotion20.useCurrentFrame)();
|
|
4502
|
+
const isMuted = (0, import_react26.useMemo)(() => {
|
|
2852
4503
|
if (muted?.type === "full") {
|
|
2853
4504
|
return muted.value;
|
|
2854
4505
|
}
|
|
@@ -2859,16 +4510,16 @@ var Atom5 = ({ data }) => {
|
|
|
2859
4510
|
}
|
|
2860
4511
|
return false;
|
|
2861
4512
|
}, [muted, frame, fps]);
|
|
2862
|
-
const source = (0,
|
|
4513
|
+
const source = (0, import_react26.useMemo)(() => {
|
|
2863
4514
|
if (data.src.startsWith("http")) {
|
|
2864
4515
|
return data.src;
|
|
2865
4516
|
}
|
|
2866
|
-
return (0,
|
|
4517
|
+
return (0, import_remotion20.staticFile)(data.src);
|
|
2867
4518
|
}, [data.src]);
|
|
2868
4519
|
return (
|
|
2869
4520
|
// @ts-ignore
|
|
2870
|
-
/* @__PURE__ */
|
|
2871
|
-
|
|
4521
|
+
/* @__PURE__ */ import_react26.default.createElement(
|
|
4522
|
+
import_remotion20.Audio,
|
|
2872
4523
|
{
|
|
2873
4524
|
src: source,
|
|
2874
4525
|
trimBefore: data.startFrom ? data.startFrom * fps : void 0,
|
|
@@ -2880,47 +4531,47 @@ var Atom5 = ({ data }) => {
|
|
|
2880
4531
|
)
|
|
2881
4532
|
);
|
|
2882
4533
|
};
|
|
2883
|
-
var
|
|
4534
|
+
var config15 = {
|
|
2884
4535
|
displayName: "AudioAtom",
|
|
2885
4536
|
type: "atom",
|
|
2886
4537
|
isInnerSequence: false
|
|
2887
4538
|
};
|
|
2888
4539
|
|
|
2889
4540
|
// src/components/atoms/LottieAtom.tsx
|
|
2890
|
-
var
|
|
2891
|
-
var
|
|
4541
|
+
var import_react27 = __toESM(require("react"));
|
|
4542
|
+
var import_remotion21 = require("remotion");
|
|
2892
4543
|
var import_lottie = require("@remotion/lottie");
|
|
2893
|
-
var
|
|
2894
|
-
var LottieAtomDataProps =
|
|
2895
|
-
src:
|
|
4544
|
+
var import_zod9 = require("zod");
|
|
4545
|
+
var LottieAtomDataProps = import_zod9.z.object({
|
|
4546
|
+
src: import_zod9.z.string(),
|
|
2896
4547
|
// Lottie JSON source URL or local path
|
|
2897
|
-
style:
|
|
4548
|
+
style: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.any()).optional(),
|
|
2898
4549
|
// CSS styles object
|
|
2899
|
-
className:
|
|
4550
|
+
className: import_zod9.z.string().optional(),
|
|
2900
4551
|
// CSS class names
|
|
2901
|
-
loop:
|
|
4552
|
+
loop: import_zod9.z.boolean().optional(),
|
|
2902
4553
|
// Whether to loop the animation (handled by Remotion timeline)
|
|
2903
|
-
playbackRate:
|
|
4554
|
+
playbackRate: import_zod9.z.number().optional(),
|
|
2904
4555
|
// Playback speed multiplier (default: 1)
|
|
2905
|
-
direction:
|
|
4556
|
+
direction: import_zod9.z.enum(["forward", "reverse"]).optional()
|
|
2906
4557
|
// Animation direction
|
|
2907
4558
|
});
|
|
2908
4559
|
var useLottieData = (src) => {
|
|
2909
|
-
const [animationData, setAnimationData] = (0,
|
|
2910
|
-
const [isLoading, setIsLoading] = (0,
|
|
2911
|
-
const [hasError, setHasError] = (0,
|
|
2912
|
-
const [handle] = (0,
|
|
2913
|
-
(0,
|
|
4560
|
+
const [animationData, setAnimationData] = (0, import_react27.useState)(null);
|
|
4561
|
+
const [isLoading, setIsLoading] = (0, import_react27.useState)(true);
|
|
4562
|
+
const [hasError, setHasError] = (0, import_react27.useState)(false);
|
|
4563
|
+
const [handle] = (0, import_react27.useState)(() => (0, import_remotion21.delayRender)("Loading Lottie animation"));
|
|
4564
|
+
(0, import_react27.useEffect)(() => {
|
|
2914
4565
|
if (!src) {
|
|
2915
4566
|
console.error("LottieAtom: No source provided");
|
|
2916
4567
|
setHasError(true);
|
|
2917
4568
|
setIsLoading(false);
|
|
2918
|
-
(0,
|
|
4569
|
+
(0, import_remotion21.continueRender)(handle);
|
|
2919
4570
|
return;
|
|
2920
4571
|
}
|
|
2921
4572
|
setIsLoading(true);
|
|
2922
4573
|
setHasError(false);
|
|
2923
|
-
const sourceUrl = src.startsWith("http") ? src : (0,
|
|
4574
|
+
const sourceUrl = src.startsWith("http") ? src : (0, import_remotion21.staticFile)(src);
|
|
2924
4575
|
fetch(sourceUrl, {
|
|
2925
4576
|
mode: "cors",
|
|
2926
4577
|
credentials: "omit"
|
|
@@ -2935,24 +4586,24 @@ var useLottieData = (src) => {
|
|
|
2935
4586
|
}
|
|
2936
4587
|
setAnimationData(json);
|
|
2937
4588
|
setIsLoading(false);
|
|
2938
|
-
(0,
|
|
4589
|
+
(0, import_remotion21.continueRender)(handle);
|
|
2939
4590
|
}).catch((error) => {
|
|
2940
4591
|
console.error(`Failed to load Lottie animation from ${sourceUrl}:`, error.message || error);
|
|
2941
4592
|
setHasError(true);
|
|
2942
4593
|
setIsLoading(false);
|
|
2943
|
-
(0,
|
|
4594
|
+
(0, import_remotion21.continueRender)(handle);
|
|
2944
4595
|
});
|
|
2945
4596
|
return () => {
|
|
2946
4597
|
};
|
|
2947
4598
|
}, [src, handle]);
|
|
2948
4599
|
return { animationData, isLoading, hasError };
|
|
2949
4600
|
};
|
|
2950
|
-
var
|
|
2951
|
-
const { fps } = (0,
|
|
2952
|
-
const frame = (0,
|
|
4601
|
+
var Atom7 = ({ data, id }) => {
|
|
4602
|
+
const { fps } = (0, import_remotion21.useVideoConfig)();
|
|
4603
|
+
const frame = (0, import_remotion21.useCurrentFrame)();
|
|
2953
4604
|
const overrideStyles = useAnimatedStyles(id);
|
|
2954
4605
|
const { animationData, isLoading, hasError } = useLottieData(data.src);
|
|
2955
|
-
const effectiveFrame = (0,
|
|
4606
|
+
const effectiveFrame = (0, import_react27.useMemo)(() => {
|
|
2956
4607
|
const playbackRate = data.playbackRate || 1;
|
|
2957
4608
|
const direction = data.direction || "forward";
|
|
2958
4609
|
if (direction === "reverse") {
|
|
@@ -2960,12 +4611,12 @@ var Atom6 = ({ data, id }) => {
|
|
|
2960
4611
|
}
|
|
2961
4612
|
return frame * playbackRate;
|
|
2962
4613
|
}, [frame, data.playbackRate, data.direction]);
|
|
2963
|
-
const enhancedStyle = (0,
|
|
4614
|
+
const enhancedStyle = (0, import_react27.useMemo)(() => ({
|
|
2964
4615
|
...data.style,
|
|
2965
4616
|
...overrideStyles
|
|
2966
4617
|
}), [data.style, overrideStyles]);
|
|
2967
4618
|
if (isLoading) {
|
|
2968
|
-
return /* @__PURE__ */
|
|
4619
|
+
return /* @__PURE__ */ import_react27.default.createElement(
|
|
2969
4620
|
"div",
|
|
2970
4621
|
{
|
|
2971
4622
|
className: data.className,
|
|
@@ -2981,7 +4632,7 @@ var Atom6 = ({ data, id }) => {
|
|
|
2981
4632
|
}
|
|
2982
4633
|
if (hasError || !animationData) {
|
|
2983
4634
|
console.warn(`LottieAtom: Failed to render animation from ${data.src}`);
|
|
2984
|
-
return /* @__PURE__ */
|
|
4635
|
+
return /* @__PURE__ */ import_react27.default.createElement(
|
|
2985
4636
|
"div",
|
|
2986
4637
|
{
|
|
2987
4638
|
className: data.className,
|
|
@@ -3001,58 +4652,93 @@ var Atom6 = ({ data, id }) => {
|
|
|
3001
4652
|
"\u26A0\uFE0F Lottie Error"
|
|
3002
4653
|
);
|
|
3003
4654
|
}
|
|
3004
|
-
return /* @__PURE__ */
|
|
4655
|
+
return /* @__PURE__ */ import_react27.default.createElement(
|
|
3005
4656
|
import_lottie.Lottie,
|
|
3006
4657
|
{
|
|
3007
|
-
animationData,
|
|
3008
|
-
style: enhancedStyle,
|
|
3009
|
-
className: data.className
|
|
4658
|
+
animationData,
|
|
4659
|
+
style: enhancedStyle,
|
|
4660
|
+
className: data.className
|
|
4661
|
+
}
|
|
4662
|
+
);
|
|
4663
|
+
};
|
|
4664
|
+
var config16 = {
|
|
4665
|
+
displayName: "LottieAtom",
|
|
4666
|
+
type: "atom",
|
|
4667
|
+
isInnerSequence: false
|
|
4668
|
+
};
|
|
4669
|
+
|
|
4670
|
+
// src/components/atoms/HTMLBlockAtom.tsx
|
|
4671
|
+
var import_react28 = __toESM(require("react"));
|
|
4672
|
+
var Atom8 = ({ id, data }) => {
|
|
4673
|
+
const overrideStyles = useAnimatedStyles(id);
|
|
4674
|
+
const combinedStyle = {
|
|
4675
|
+
...data.style,
|
|
4676
|
+
...overrideStyles
|
|
4677
|
+
};
|
|
4678
|
+
return /* @__PURE__ */ import_react28.default.createElement(
|
|
4679
|
+
"div",
|
|
4680
|
+
{
|
|
4681
|
+
className: data.className,
|
|
4682
|
+
style: combinedStyle,
|
|
4683
|
+
dangerouslySetInnerHTML: { __html: data.html }
|
|
3010
4684
|
}
|
|
3011
4685
|
);
|
|
3012
4686
|
};
|
|
3013
|
-
var
|
|
3014
|
-
displayName: "
|
|
4687
|
+
var config17 = {
|
|
4688
|
+
displayName: "HTMLBlockAtom",
|
|
3015
4689
|
type: "atom",
|
|
3016
4690
|
isInnerSequence: false
|
|
3017
4691
|
};
|
|
3018
4692
|
|
|
3019
4693
|
// src/components/atoms/index.ts
|
|
3020
4694
|
registerComponent(
|
|
3021
|
-
|
|
3022
|
-
Atom,
|
|
3023
|
-
"atom",
|
|
3024
|
-
config9
|
|
3025
|
-
);
|
|
3026
|
-
registerComponent(
|
|
3027
|
-
config10.displayName,
|
|
4695
|
+
config11.displayName,
|
|
3028
4696
|
Atom2,
|
|
3029
4697
|
"atom",
|
|
3030
|
-
|
|
4698
|
+
config11
|
|
3031
4699
|
);
|
|
3032
|
-
registerComponent(config11.displayName, Atom3, "atom", config11);
|
|
3033
4700
|
registerComponent(
|
|
3034
4701
|
config12.displayName,
|
|
3035
|
-
|
|
4702
|
+
Atom3,
|
|
3036
4703
|
"atom",
|
|
3037
4704
|
config12
|
|
3038
4705
|
);
|
|
4706
|
+
registerComponent(config13.displayName, Atom4, "atom", config13);
|
|
3039
4707
|
registerComponent(
|
|
3040
|
-
|
|
4708
|
+
config14.displayName,
|
|
3041
4709
|
Atom5,
|
|
3042
4710
|
"atom",
|
|
3043
|
-
|
|
4711
|
+
config14
|
|
3044
4712
|
);
|
|
3045
4713
|
registerComponent(
|
|
3046
|
-
|
|
4714
|
+
config15.displayName,
|
|
3047
4715
|
Atom6,
|
|
3048
4716
|
"atom",
|
|
3049
|
-
|
|
4717
|
+
config15
|
|
4718
|
+
);
|
|
4719
|
+
registerComponent(
|
|
4720
|
+
config16.displayName,
|
|
4721
|
+
Atom7,
|
|
4722
|
+
"atom",
|
|
4723
|
+
config16
|
|
4724
|
+
);
|
|
4725
|
+
registerComponent(
|
|
4726
|
+
config9.displayName,
|
|
4727
|
+
Atom,
|
|
4728
|
+
"atom",
|
|
4729
|
+
config9
|
|
4730
|
+
);
|
|
4731
|
+
registerComponent(
|
|
4732
|
+
config17.displayName,
|
|
4733
|
+
Atom8,
|
|
4734
|
+
"atom",
|
|
4735
|
+
config17
|
|
3050
4736
|
);
|
|
3051
4737
|
|
|
3052
4738
|
// src/hooks/useComponentRegistry.ts
|
|
3053
|
-
var
|
|
4739
|
+
var import_react29 = require("react");
|
|
3054
4740
|
var useComponentRegistry = () => {
|
|
3055
|
-
return (0,
|
|
4741
|
+
return (0, import_react29.useMemo)(() => {
|
|
3056
4742
|
return {
|
|
3057
4743
|
registerComponent: componentRegistry.registerComponent.bind(componentRegistry),
|
|
3058
4744
|
registerPackage: componentRegistry.registerPackage.bind(componentRegistry),
|
|
@@ -3063,13 +4749,13 @@ var useComponentRegistry = () => {
|
|
|
3063
4749
|
};
|
|
3064
4750
|
|
|
3065
4751
|
// src/hooks/useBoundaryCalculation.ts
|
|
3066
|
-
var
|
|
4752
|
+
var import_react30 = require("react");
|
|
3067
4753
|
var useBoundaryCalculation = ({
|
|
3068
4754
|
parentBoundaries,
|
|
3069
4755
|
constraints,
|
|
3070
4756
|
layout
|
|
3071
4757
|
}) => {
|
|
3072
|
-
return (0,
|
|
4758
|
+
return (0, import_react30.useMemo)(() => {
|
|
3073
4759
|
const { x, y, width, height } = parentBoundaries;
|
|
3074
4760
|
const calculatedX = typeof constraints.x === "number" ? constraints.x : x;
|
|
3075
4761
|
const calculatedY = typeof constraints.y === "number" ? constraints.y : y;
|
|
@@ -3086,16 +4772,16 @@ var useBoundaryCalculation = ({
|
|
|
3086
4772
|
};
|
|
3087
4773
|
|
|
3088
4774
|
// src/hooks/buildTransitionHook.ts
|
|
3089
|
-
var
|
|
4775
|
+
var import_react32 = require("react");
|
|
3090
4776
|
|
|
3091
4777
|
// src/core/types/transition.types.ts
|
|
3092
|
-
var
|
|
3093
|
-
var LayoutContext = (0,
|
|
4778
|
+
var import_react31 = require("react");
|
|
4779
|
+
var LayoutContext = (0, import_react31.createContext)(null);
|
|
3094
4780
|
|
|
3095
4781
|
// src/hooks/buildTransitionHook.ts
|
|
3096
4782
|
function buildLayoutHook(schema, defaultValue) {
|
|
3097
4783
|
return () => {
|
|
3098
|
-
const context = (0,
|
|
4784
|
+
const context = (0, import_react32.useContext)(LayoutContext);
|
|
3099
4785
|
if (!context) {
|
|
3100
4786
|
return defaultValue;
|
|
3101
4787
|
}
|
|
@@ -3180,16 +4866,16 @@ var needsProxying = (url) => {
|
|
|
3180
4866
|
|
|
3181
4867
|
// src/templates/rings/NextjsLogo.tsx
|
|
3182
4868
|
var import_paths = require("@remotion/paths");
|
|
3183
|
-
var
|
|
3184
|
-
var
|
|
4869
|
+
var import_react34 = __toESM(require("react"));
|
|
4870
|
+
var import_remotion23 = require("remotion");
|
|
3185
4871
|
|
|
3186
4872
|
// src/templates/rings/RippleOutLayout.tsx
|
|
3187
|
-
var
|
|
3188
|
-
var
|
|
3189
|
-
var
|
|
3190
|
-
var RippleOutTransitionSchema =
|
|
3191
|
-
progress:
|
|
3192
|
-
logoOut:
|
|
4873
|
+
var import_react33 = __toESM(require("react"));
|
|
4874
|
+
var import_remotion22 = require("remotion");
|
|
4875
|
+
var import_zod10 = require("zod");
|
|
4876
|
+
var RippleOutTransitionSchema = import_zod10.z.object({
|
|
4877
|
+
progress: import_zod10.z.number().min(0).max(1),
|
|
4878
|
+
logoOut: import_zod10.z.number().min(0).max(1)
|
|
3193
4879
|
});
|
|
3194
4880
|
var defaultRippleOutData = {
|
|
3195
4881
|
progress: 0,
|
|
@@ -3207,10 +4893,10 @@ var RippleOutLayout = ({ data, context, children }) => {
|
|
|
3207
4893
|
transitionStart,
|
|
3208
4894
|
transitionDuration
|
|
3209
4895
|
} = data || { transitionStart: 2, transitionDuration: 1 };
|
|
3210
|
-
const frame = (0,
|
|
3211
|
-
const { fps } = (0,
|
|
4896
|
+
const frame = (0, import_remotion22.useCurrentFrame)();
|
|
4897
|
+
const { fps } = (0, import_remotion22.useVideoConfig)();
|
|
3212
4898
|
const { hierarchy } = useRenderContext();
|
|
3213
|
-
|
|
4899
|
+
import_react33.default.useEffect(() => {
|
|
3214
4900
|
loadGoogleFont("Inter", {
|
|
3215
4901
|
subsets: ["latin"],
|
|
3216
4902
|
weights: ["400", "700"]
|
|
@@ -3218,7 +4904,7 @@ var RippleOutLayout = ({ data, context, children }) => {
|
|
|
3218
4904
|
}, []);
|
|
3219
4905
|
const transitionStartFrame = transitionStart * fps;
|
|
3220
4906
|
const transitionDurationFrames = transitionDuration * fps;
|
|
3221
|
-
const logoOut = (0,
|
|
4907
|
+
const logoOut = (0, import_remotion22.spring)({
|
|
3222
4908
|
fps,
|
|
3223
4909
|
frame,
|
|
3224
4910
|
config: {
|
|
@@ -3231,14 +4917,14 @@ var RippleOutLayout = ({ data, context, children }) => {
|
|
|
3231
4917
|
progress: logoOut,
|
|
3232
4918
|
logoOut
|
|
3233
4919
|
};
|
|
3234
|
-
const childrenArray =
|
|
3235
|
-
(child) =>
|
|
4920
|
+
const childrenArray = import_react33.default.Children.toArray(children).filter(
|
|
4921
|
+
(child) => import_react33.default.isValidElement(child)
|
|
3236
4922
|
);
|
|
3237
4923
|
const [from, to] = childrenArray;
|
|
3238
|
-
return /* @__PURE__ */
|
|
4924
|
+
return /* @__PURE__ */ import_react33.default.createElement(LayoutContext.Provider, { value: transitionData }, /* @__PURE__ */ import_react33.default.createElement(import_remotion22.AbsoluteFill, { style: {
|
|
3239
4925
|
...container,
|
|
3240
4926
|
...context?.boundaries
|
|
3241
|
-
} }, /* @__PURE__ */
|
|
4927
|
+
} }, /* @__PURE__ */ import_react33.default.createElement(import_remotion22.Sequence, { name: from.props.componentId + " - " + from.props.id, from: 0, durationInFrames: transitionStartFrame + transitionDurationFrames }, from), /* @__PURE__ */ import_react33.default.createElement(import_remotion22.Sequence, { name: to.props.componentId + " - " + to.props.id, from: transitionStartFrame + transitionDurationFrames / 2 }, to)));
|
|
3242
4928
|
};
|
|
3243
4929
|
var rippleOutLayoutConfig = {
|
|
3244
4930
|
displayName: "RippleOutLayout",
|
|
@@ -3254,23 +4940,23 @@ var nStroke = "M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.8
|
|
|
3254
4940
|
var NextjsLogo = () => {
|
|
3255
4941
|
const { logoOut } = useRippleOutLayout();
|
|
3256
4942
|
const outProgress = logoOut;
|
|
3257
|
-
const { fps } = (0,
|
|
3258
|
-
const frame = (0,
|
|
3259
|
-
const evolve1 = (0,
|
|
4943
|
+
const { fps } = (0, import_remotion23.useVideoConfig)();
|
|
4944
|
+
const frame = (0, import_remotion23.useCurrentFrame)();
|
|
4945
|
+
const evolve1 = (0, import_remotion23.spring)({
|
|
3260
4946
|
fps,
|
|
3261
4947
|
frame,
|
|
3262
4948
|
config: {
|
|
3263
4949
|
damping: 200
|
|
3264
4950
|
}
|
|
3265
4951
|
});
|
|
3266
|
-
const evolve2 = (0,
|
|
4952
|
+
const evolve2 = (0, import_remotion23.spring)({
|
|
3267
4953
|
fps,
|
|
3268
4954
|
frame: frame - 15,
|
|
3269
4955
|
config: {
|
|
3270
4956
|
damping: 200
|
|
3271
4957
|
}
|
|
3272
4958
|
});
|
|
3273
|
-
const evolve3 = (0,
|
|
4959
|
+
const evolve3 = (0, import_remotion23.spring)({
|
|
3274
4960
|
fps,
|
|
3275
4961
|
frame: frame - 30,
|
|
3276
4962
|
config: {
|
|
@@ -3279,7 +4965,7 @@ var NextjsLogo = () => {
|
|
|
3279
4965
|
},
|
|
3280
4966
|
durationInFrames: 30
|
|
3281
4967
|
});
|
|
3282
|
-
const style = (0,
|
|
4968
|
+
const style = (0, import_react34.useMemo)(() => {
|
|
3283
4969
|
return {
|
|
3284
4970
|
height: 140,
|
|
3285
4971
|
borderRadius: 70,
|
|
@@ -3292,10 +4978,10 @@ var NextjsLogo = () => {
|
|
|
3292
4978
|
const evolution1 = (0, import_paths.evolvePath)(evolve1, firstPath);
|
|
3293
4979
|
const evolution2 = (0, import_paths.evolvePath)(evolve2, secondPath);
|
|
3294
4980
|
const evolution3 = (0, import_paths.evolvePath)(
|
|
3295
|
-
(0,
|
|
4981
|
+
(0, import_remotion23.interpolate)(evolve3, [0, 1], [0, 0.7]),
|
|
3296
4982
|
thirdPath
|
|
3297
4983
|
);
|
|
3298
|
-
return /* @__PURE__ */
|
|
4984
|
+
return /* @__PURE__ */ import_react34.default.createElement("svg", { style, fill: "none", viewBox: "0 0 180 180" }, /* @__PURE__ */ import_react34.default.createElement("mask", { height: "180", id: "mask", style: mask, width: "180", x: "0", y: "0" }, /* @__PURE__ */ import_react34.default.createElement("circle", { cx: "90", cy: "90", fill: "black", r: "90" })), /* @__PURE__ */ import_react34.default.createElement("mask", { id: "n-mask", style: mask }, /* @__PURE__ */ import_react34.default.createElement("path", { d: nStroke, fill: "black" })), /* @__PURE__ */ import_react34.default.createElement("g", { mask: "url(#mask)" }, /* @__PURE__ */ import_react34.default.createElement("circle", { cx: "90", cy: "90", fill: "black", r: "90" }), /* @__PURE__ */ import_react34.default.createElement("g", { stroke: "url(#gradient0)", mask: "url(#n-mask)" }, /* @__PURE__ */ import_react34.default.createElement(
|
|
3299
4985
|
"path",
|
|
3300
4986
|
{
|
|
3301
4987
|
strokeWidth: "12.1136",
|
|
@@ -3303,7 +4989,7 @@ var NextjsLogo = () => {
|
|
|
3303
4989
|
strokeDasharray: evolution1.strokeDasharray,
|
|
3304
4990
|
strokeDashoffset: evolution1.strokeDashoffset
|
|
3305
4991
|
}
|
|
3306
|
-
), /* @__PURE__ */
|
|
4992
|
+
), /* @__PURE__ */ import_react34.default.createElement(
|
|
3307
4993
|
"path",
|
|
3308
4994
|
{
|
|
3309
4995
|
strokeWidth: 12.1136,
|
|
@@ -3311,7 +4997,7 @@ var NextjsLogo = () => {
|
|
|
3311
4997
|
strokeDasharray: evolution2.strokeDasharray,
|
|
3312
4998
|
strokeDashoffset: evolution2.strokeDashoffset
|
|
3313
4999
|
}
|
|
3314
|
-
)), /* @__PURE__ */
|
|
5000
|
+
)), /* @__PURE__ */ import_react34.default.createElement(
|
|
3315
5001
|
"path",
|
|
3316
5002
|
{
|
|
3317
5003
|
stroke: "url(#gradient1)",
|
|
@@ -3320,7 +5006,7 @@ var NextjsLogo = () => {
|
|
|
3320
5006
|
strokeDashoffset: evolution3.strokeDashoffset,
|
|
3321
5007
|
strokeWidth: "12"
|
|
3322
5008
|
}
|
|
3323
|
-
)), /* @__PURE__ */
|
|
5009
|
+
)), /* @__PURE__ */ import_react34.default.createElement("defs", null, /* @__PURE__ */ import_react34.default.createElement(
|
|
3324
5010
|
"linearGradient",
|
|
3325
5011
|
{
|
|
3326
5012
|
gradientUnits: "userSpaceOnUse",
|
|
@@ -3330,9 +5016,9 @@ var NextjsLogo = () => {
|
|
|
3330
5016
|
y1: "116.5",
|
|
3331
5017
|
y2: "160.5"
|
|
3332
5018
|
},
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
), /* @__PURE__ */
|
|
5019
|
+
/* @__PURE__ */ import_react34.default.createElement("stop", { stopColor: "white" }),
|
|
5020
|
+
/* @__PURE__ */ import_react34.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5021
|
+
), /* @__PURE__ */ import_react34.default.createElement(
|
|
3336
5022
|
"linearGradient",
|
|
3337
5023
|
{
|
|
3338
5024
|
gradientUnits: "userSpaceOnUse",
|
|
@@ -3342,8 +5028,8 @@ var NextjsLogo = () => {
|
|
|
3342
5028
|
y1: "54",
|
|
3343
5029
|
y2: "106.875"
|
|
3344
5030
|
},
|
|
3345
|
-
/* @__PURE__ */
|
|
3346
|
-
/* @__PURE__ */
|
|
5031
|
+
/* @__PURE__ */ import_react34.default.createElement("stop", { stopColor: "white" }),
|
|
5032
|
+
/* @__PURE__ */ import_react34.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
3347
5033
|
)));
|
|
3348
5034
|
};
|
|
3349
5035
|
var nextjsLogoConfig = {
|
|
@@ -3353,22 +5039,22 @@ var nextjsLogoConfig = {
|
|
|
3353
5039
|
};
|
|
3354
5040
|
|
|
3355
5041
|
// src/templates/rings/Rings.tsx
|
|
3356
|
-
var
|
|
3357
|
-
var
|
|
5042
|
+
var import_react35 = __toESM(require("react"));
|
|
5043
|
+
var import_remotion24 = require("remotion");
|
|
3358
5044
|
var RadialGradient = ({ radius, color }) => {
|
|
3359
5045
|
const height = radius * 2;
|
|
3360
5046
|
const width = radius * 2;
|
|
3361
5047
|
return (
|
|
3362
5048
|
// @ts-ignore
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
|
|
5049
|
+
/* @__PURE__ */ import_react35.default.createElement(
|
|
5050
|
+
import_remotion24.AbsoluteFill,
|
|
3365
5051
|
{
|
|
3366
5052
|
style: {
|
|
3367
5053
|
justifyContent: "center",
|
|
3368
5054
|
alignItems: "center"
|
|
3369
5055
|
}
|
|
3370
5056
|
},
|
|
3371
|
-
/* @__PURE__ */
|
|
5057
|
+
/* @__PURE__ */ import_react35.default.createElement(
|
|
3372
5058
|
"div",
|
|
3373
5059
|
{
|
|
3374
5060
|
style: {
|
|
@@ -3388,11 +5074,11 @@ var Rings = ({ context, data }) => {
|
|
|
3388
5074
|
const { logoOut } = useRippleOutLayout();
|
|
3389
5075
|
const outProgress = logoOut;
|
|
3390
5076
|
const scale = 1 / (1 - outProgress);
|
|
3391
|
-
const { height } = (0,
|
|
5077
|
+
const { height } = (0, import_remotion24.useVideoConfig)();
|
|
3392
5078
|
return (
|
|
3393
5079
|
// @ts-ignore
|
|
3394
|
-
/* @__PURE__ */
|
|
3395
|
-
|
|
5080
|
+
/* @__PURE__ */ import_react35.default.createElement(
|
|
5081
|
+
import_remotion24.AbsoluteFill,
|
|
3396
5082
|
{
|
|
3397
5083
|
style: {
|
|
3398
5084
|
transform: `scale(${scale})`,
|
|
@@ -3400,12 +5086,12 @@ var Rings = ({ context, data }) => {
|
|
|
3400
5086
|
}
|
|
3401
5087
|
},
|
|
3402
5088
|
new Array(5).fill(true).map((_, i) => {
|
|
3403
|
-
return /* @__PURE__ */
|
|
5089
|
+
return /* @__PURE__ */ import_react35.default.createElement(
|
|
3404
5090
|
RadialGradient,
|
|
3405
5091
|
{
|
|
3406
5092
|
key: i,
|
|
3407
5093
|
radius: height * 0.3 * i,
|
|
3408
|
-
color: (0,
|
|
5094
|
+
color: (0, import_remotion24.interpolateColors)(i, [0, 4], ["#fff", "#fff"])
|
|
3409
5095
|
}
|
|
3410
5096
|
);
|
|
3411
5097
|
}).reverse()
|
|
@@ -3419,8 +5105,8 @@ var ringsConfig = {
|
|
|
3419
5105
|
};
|
|
3420
5106
|
|
|
3421
5107
|
// src/templates/rings/TextFade.tsx
|
|
3422
|
-
var
|
|
3423
|
-
var
|
|
5108
|
+
var import_react36 = __toESM(require("react"));
|
|
5109
|
+
var import_remotion25 = require("remotion");
|
|
3424
5110
|
var TextFade = (props) => {
|
|
3425
5111
|
const { children, context, data } = props;
|
|
3426
5112
|
const { animation } = data || {
|
|
@@ -3428,9 +5114,9 @@ var TextFade = (props) => {
|
|
|
3428
5114
|
duration: 1
|
|
3429
5115
|
}
|
|
3430
5116
|
};
|
|
3431
|
-
const { fps } = (0,
|
|
3432
|
-
const frame = (0,
|
|
3433
|
-
const progress = (0,
|
|
5117
|
+
const { fps } = (0, import_remotion25.useVideoConfig)();
|
|
5118
|
+
const frame = (0, import_remotion25.useCurrentFrame)();
|
|
5119
|
+
const progress = (0, import_remotion25.spring)({
|
|
3434
5120
|
fps,
|
|
3435
5121
|
frame,
|
|
3436
5122
|
config: {
|
|
@@ -3438,10 +5124,10 @@ var TextFade = (props) => {
|
|
|
3438
5124
|
},
|
|
3439
5125
|
durationInFrames: animation.duration * fps
|
|
3440
5126
|
});
|
|
3441
|
-
const rightStop = (0,
|
|
5127
|
+
const rightStop = (0, import_remotion25.interpolate)(progress, [0, 1], [200, 0]);
|
|
3442
5128
|
const leftStop = Math.max(0, rightStop - 60);
|
|
3443
5129
|
const maskImage = `linear-gradient(-45deg, transparent ${leftStop}%, black ${rightStop}%)`;
|
|
3444
|
-
const container2 = (0,
|
|
5130
|
+
const container2 = (0, import_react36.useMemo)(() => {
|
|
3445
5131
|
return {
|
|
3446
5132
|
width: "100%",
|
|
3447
5133
|
height: "100%",
|
|
@@ -3449,7 +5135,7 @@ var TextFade = (props) => {
|
|
|
3449
5135
|
alignItems: "center"
|
|
3450
5136
|
};
|
|
3451
5137
|
}, []);
|
|
3452
|
-
const content = (0,
|
|
5138
|
+
const content = (0, import_react36.useMemo)(() => {
|
|
3453
5139
|
return {
|
|
3454
5140
|
...context?.boundaries,
|
|
3455
5141
|
maskImage,
|
|
@@ -3461,7 +5147,7 @@ var TextFade = (props) => {
|
|
|
3461
5147
|
}, [maskImage]);
|
|
3462
5148
|
return (
|
|
3463
5149
|
// @ts-ignore
|
|
3464
|
-
/* @__PURE__ */
|
|
5150
|
+
/* @__PURE__ */ import_react36.default.createElement(import_remotion25.AbsoluteFill, { style: container2 }, /* @__PURE__ */ import_react36.default.createElement("div", { style: content }, children))
|
|
3465
5151
|
);
|
|
3466
5152
|
};
|
|
3467
5153
|
var textFadeConfig = {
|
|
@@ -3492,259 +5178,41 @@ registerComponent(
|
|
|
3492
5178
|
);
|
|
3493
5179
|
|
|
3494
5180
|
// src/templates/waveform/components/WaveformCircle.tsx
|
|
3495
|
-
var
|
|
3496
|
-
|
|
3497
|
-
// src/templates/waveform/Waveform.tsx
|
|
3498
|
-
var import_react30 = __toESM(require("react"));
|
|
3499
|
-
var import_remotion22 = require("remotion");
|
|
3500
|
-
|
|
3501
|
-
// src/templates/waveform/hooks/useWaveformData.ts
|
|
3502
|
-
var import_react29 = require("react");
|
|
3503
|
-
var import_media_utils = require("@remotion/media-utils");
|
|
3504
|
-
var import_remotion21 = require("remotion");
|
|
3505
|
-
var isValidPowerOfTwo = (num) => {
|
|
3506
|
-
return num > 0 && (num & num - 1) === 0;
|
|
3507
|
-
};
|
|
3508
|
-
var getClosestPowerOfTwo = (num) => {
|
|
3509
|
-
if (num <= 0) return 32;
|
|
3510
|
-
let power = 1;
|
|
3511
|
-
while (power < num) {
|
|
3512
|
-
power *= 2;
|
|
3513
|
-
}
|
|
3514
|
-
const lower = power / 2;
|
|
3515
|
-
const upper = power;
|
|
3516
|
-
return Math.abs(num - lower) < Math.abs(num - upper) ? lower : upper;
|
|
3517
|
-
};
|
|
3518
|
-
var useWaveformData = (config15) => {
|
|
3519
|
-
const {
|
|
3520
|
-
audioSrc,
|
|
3521
|
-
numberOfSamples,
|
|
3522
|
-
windowInSeconds,
|
|
3523
|
-
dataOffsetInSeconds = 0,
|
|
3524
|
-
normalize = false,
|
|
3525
|
-
frame,
|
|
3526
|
-
fps,
|
|
3527
|
-
posterize,
|
|
3528
|
-
includeFrequencyData = false,
|
|
3529
|
-
minDb = -100,
|
|
3530
|
-
maxDb = -30
|
|
3531
|
-
} = config15;
|
|
3532
|
-
const { root } = useComposition();
|
|
3533
|
-
const validatedNumberOfSamples = (0, import_react29.useMemo)(() => {
|
|
3534
|
-
if (!isValidPowerOfTwo(numberOfSamples)) {
|
|
3535
|
-
console.warn(
|
|
3536
|
-
`numberOfSamples must be a power of 2. Adjusting ${numberOfSamples} to ${getClosestPowerOfTwo(numberOfSamples)}`
|
|
3537
|
-
);
|
|
3538
|
-
return getClosestPowerOfTwo(numberOfSamples);
|
|
3539
|
-
}
|
|
3540
|
-
return numberOfSamples;
|
|
3541
|
-
}, [numberOfSamples]);
|
|
3542
|
-
const { source, audioStartsFrom } = (0, import_react29.useMemo)(() => {
|
|
3543
|
-
if (audioSrc.startsWith("http")) {
|
|
3544
|
-
return { source: audioSrc, audioStartsFrom: void 0 };
|
|
3545
|
-
}
|
|
3546
|
-
if (audioSrc.startsWith("ref:")) {
|
|
3547
|
-
const matchingComponent = findMatchingComponents(root, [
|
|
3548
|
-
audioSrc.replace("ref:", "")
|
|
3549
|
-
]);
|
|
3550
|
-
if (matchingComponent.length > 0) {
|
|
3551
|
-
const firstMatchingComponent = matchingComponent[0];
|
|
3552
|
-
if (firstMatchingComponent.componentId === "AudioAtom") {
|
|
3553
|
-
return {
|
|
3554
|
-
source: firstMatchingComponent.data.src,
|
|
3555
|
-
audioStartsFrom: firstMatchingComponent.data?.startFrom ?? void 0
|
|
3556
|
-
};
|
|
3557
|
-
}
|
|
3558
|
-
if (firstMatchingComponent.type === "layout" || firstMatchingComponent.type === "scene") {
|
|
3559
|
-
const audioComponents = findMatchingComponentsByQuery(
|
|
3560
|
-
firstMatchingComponent.childrenData,
|
|
3561
|
-
{ componentId: "AudioAtom" }
|
|
3562
|
-
);
|
|
3563
|
-
if (audioComponents.length > 0) {
|
|
3564
|
-
return {
|
|
3565
|
-
source: audioComponents[0].data.src,
|
|
3566
|
-
audioStartsFrom: audioComponents[0].data?.startFrom ?? void 0
|
|
3567
|
-
};
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
return { source: (0, import_remotion21.staticFile)(audioSrc), audioStartsFrom: void 0 };
|
|
3573
|
-
}, [audioSrc]);
|
|
3574
|
-
const audioData = (0, import_media_utils.useAudioData)(source);
|
|
3575
|
-
const adjustedFrame = (0, import_react29.useMemo)(() => {
|
|
3576
|
-
if (posterize && posterize > 1) {
|
|
3577
|
-
return Math.round(frame / posterize) * posterize;
|
|
3578
|
-
}
|
|
3579
|
-
let offset = 0;
|
|
3580
|
-
if (audioStartsFrom && audioStartsFrom != 0) {
|
|
3581
|
-
offset += Math.round(audioStartsFrom * fps);
|
|
3582
|
-
}
|
|
3583
|
-
if (dataOffsetInSeconds != 0) {
|
|
3584
|
-
offset += Math.round(dataOffsetInSeconds * fps);
|
|
3585
|
-
}
|
|
3586
|
-
return frame + offset;
|
|
3587
|
-
}, [frame, posterize, dataOffsetInSeconds, audioStartsFrom]);
|
|
3588
|
-
const waveformData = (0, import_react29.useMemo)(() => {
|
|
3589
|
-
if (!audioData) return null;
|
|
3590
|
-
try {
|
|
3591
|
-
const waveform = (0, import_media_utils.visualizeAudioWaveform)({
|
|
3592
|
-
fps,
|
|
3593
|
-
frame: adjustedFrame,
|
|
3594
|
-
audioData,
|
|
3595
|
-
numberOfSamples: validatedNumberOfSamples,
|
|
3596
|
-
windowInSeconds,
|
|
3597
|
-
dataOffsetInSeconds: 0,
|
|
3598
|
-
normalize
|
|
3599
|
-
});
|
|
3600
|
-
return waveform;
|
|
3601
|
-
} catch (error2) {
|
|
3602
|
-
console.error("Error generating waveform:", error2);
|
|
3603
|
-
return null;
|
|
3604
|
-
}
|
|
3605
|
-
}, [
|
|
3606
|
-
audioData,
|
|
3607
|
-
adjustedFrame,
|
|
3608
|
-
fps,
|
|
3609
|
-
validatedNumberOfSamples,
|
|
3610
|
-
windowInSeconds,
|
|
3611
|
-
dataOffsetInSeconds,
|
|
3612
|
-
normalize
|
|
3613
|
-
]);
|
|
3614
|
-
const {
|
|
3615
|
-
frequencyData,
|
|
3616
|
-
amplitudes,
|
|
3617
|
-
bass,
|
|
3618
|
-
mid,
|
|
3619
|
-
treble,
|
|
3620
|
-
bassValues,
|
|
3621
|
-
midValues,
|
|
3622
|
-
trebleValues
|
|
3623
|
-
} = (0, import_react29.useMemo)(() => {
|
|
3624
|
-
if (!audioData || !includeFrequencyData) {
|
|
3625
|
-
return {
|
|
3626
|
-
frequencyData: null,
|
|
3627
|
-
amplitudes: null,
|
|
3628
|
-
bass: null,
|
|
3629
|
-
mid: null,
|
|
3630
|
-
treble: null,
|
|
3631
|
-
bassValues: null,
|
|
3632
|
-
midValues: null,
|
|
3633
|
-
trebleValues: null
|
|
3634
|
-
};
|
|
3635
|
-
}
|
|
3636
|
-
try {
|
|
3637
|
-
const frequencyData2 = (0, import_media_utils.visualizeAudio)({
|
|
3638
|
-
fps,
|
|
3639
|
-
frame: adjustedFrame,
|
|
3640
|
-
audioData,
|
|
3641
|
-
numberOfSamples: validatedNumberOfSamples
|
|
3642
|
-
});
|
|
3643
|
-
const { sampleRate } = audioData;
|
|
3644
|
-
const bassValues2 = [];
|
|
3645
|
-
const midValues2 = [];
|
|
3646
|
-
const trebleValues2 = [];
|
|
3647
|
-
for (let i = 0; i < frequencyData2.length; i++) {
|
|
3648
|
-
const freq = i * sampleRate / (2 * frequencyData2.length);
|
|
3649
|
-
const value = frequencyData2[i];
|
|
3650
|
-
if (freq >= 0 && freq < 250) {
|
|
3651
|
-
bassValues2.push(value * 2.5);
|
|
3652
|
-
} else if (freq >= 250 && freq < 4e3) {
|
|
3653
|
-
midValues2.push(value * 3);
|
|
3654
|
-
midValues2.push(value * 4.5);
|
|
3655
|
-
midValues2.push(value * 5);
|
|
3656
|
-
} else if (freq >= 4e3 && freq < sampleRate / 2) {
|
|
3657
|
-
trebleValues2.push(value * 30);
|
|
3658
|
-
}
|
|
3659
|
-
}
|
|
3660
|
-
const getAverage = (arr) => arr.length > 0 ? arr.reduce((a, b) => a + b, 0) / arr.length : 0;
|
|
3661
|
-
const bass2 = getAverage(bassValues2);
|
|
3662
|
-
const mid2 = getAverage(midValues2);
|
|
3663
|
-
const treble2 = getAverage(trebleValues2);
|
|
3664
|
-
const amplitudes2 = frequencyData2.map((value) => {
|
|
3665
|
-
const db = 20 * Math.log10(value);
|
|
3666
|
-
const scaled = (db - minDb) / (maxDb - minDb);
|
|
3667
|
-
return Math.max(0, Math.min(1, scaled));
|
|
3668
|
-
});
|
|
3669
|
-
return {
|
|
3670
|
-
frequencyData: frequencyData2,
|
|
3671
|
-
amplitudes: amplitudes2,
|
|
3672
|
-
bass: bass2,
|
|
3673
|
-
mid: mid2,
|
|
3674
|
-
treble: treble2,
|
|
3675
|
-
bassValues: bassValues2,
|
|
3676
|
-
midValues: midValues2,
|
|
3677
|
-
trebleValues: trebleValues2.reverse()
|
|
3678
|
-
};
|
|
3679
|
-
} catch (error2) {
|
|
3680
|
-
console.error("Error generating frequency data:", error2);
|
|
3681
|
-
return {
|
|
3682
|
-
frequencyData: null,
|
|
3683
|
-
amplitudes: null,
|
|
3684
|
-
bass: null,
|
|
3685
|
-
mid: null,
|
|
3686
|
-
treble: null
|
|
3687
|
-
};
|
|
3688
|
-
}
|
|
3689
|
-
}, [
|
|
3690
|
-
audioData,
|
|
3691
|
-
includeFrequencyData,
|
|
3692
|
-
adjustedFrame,
|
|
3693
|
-
fps,
|
|
3694
|
-
validatedNumberOfSamples,
|
|
3695
|
-
windowInSeconds,
|
|
3696
|
-
dataOffsetInSeconds,
|
|
3697
|
-
minDb,
|
|
3698
|
-
maxDb
|
|
3699
|
-
]);
|
|
3700
|
-
const isLoading = !audioData;
|
|
3701
|
-
const error = audioData === null && !isLoading ? "Failed to load audio data" : null;
|
|
3702
|
-
return {
|
|
3703
|
-
waveformData,
|
|
3704
|
-
frequencyData,
|
|
3705
|
-
amplitudes,
|
|
3706
|
-
audioData,
|
|
3707
|
-
isLoading,
|
|
3708
|
-
error,
|
|
3709
|
-
bass,
|
|
3710
|
-
bassValues,
|
|
3711
|
-
mid,
|
|
3712
|
-
midValues,
|
|
3713
|
-
treble,
|
|
3714
|
-
trebleValues
|
|
3715
|
-
};
|
|
3716
|
-
};
|
|
5181
|
+
var import_react38 = __toESM(require("react"));
|
|
3717
5182
|
|
|
3718
5183
|
// src/templates/waveform/Waveform.tsx
|
|
3719
|
-
var
|
|
5184
|
+
var import_react37 = __toESM(require("react"));
|
|
5185
|
+
var import_remotion26 = require("remotion");
|
|
5186
|
+
var WaveformContext = (0, import_react37.createContext)(null);
|
|
3720
5187
|
var useWaveformContext = () => {
|
|
3721
|
-
const context = (0,
|
|
5188
|
+
const context = (0, import_react37.useContext)(WaveformContext);
|
|
3722
5189
|
if (!context) {
|
|
3723
5190
|
throw new Error("useWaveformContext must be used within a Waveform component");
|
|
3724
5191
|
}
|
|
3725
5192
|
return context;
|
|
3726
5193
|
};
|
|
3727
5194
|
var Waveform = ({
|
|
3728
|
-
config:
|
|
5195
|
+
config: config18,
|
|
3729
5196
|
children,
|
|
3730
5197
|
className = "",
|
|
3731
5198
|
style = {}
|
|
3732
5199
|
}) => {
|
|
3733
|
-
const frame = (0,
|
|
3734
|
-
const { width: videoWidth, height: videoHeight, fps } = (0,
|
|
5200
|
+
const frame = (0, import_remotion26.useCurrentFrame)();
|
|
5201
|
+
const { width: videoWidth, height: videoHeight, fps } = (0, import_remotion26.useVideoConfig)();
|
|
3735
5202
|
const { waveformData, frequencyData, amplitudes, audioData, bass, mid, treble, bassValues, midValues, trebleValues } = useWaveformData({
|
|
3736
|
-
audioSrc:
|
|
3737
|
-
numberOfSamples:
|
|
3738
|
-
windowInSeconds:
|
|
3739
|
-
dataOffsetInSeconds:
|
|
3740
|
-
normalize:
|
|
5203
|
+
audioSrc: config18.audioSrc,
|
|
5204
|
+
numberOfSamples: config18.numberOfSamples || 128,
|
|
5205
|
+
windowInSeconds: config18.windowInSeconds || 1 / fps,
|
|
5206
|
+
dataOffsetInSeconds: config18.dataOffsetInSeconds || 0,
|
|
5207
|
+
normalize: config18.normalize || false,
|
|
3741
5208
|
frame,
|
|
3742
5209
|
fps,
|
|
3743
|
-
posterize:
|
|
3744
|
-
includeFrequencyData:
|
|
5210
|
+
posterize: config18.posterize,
|
|
5211
|
+
includeFrequencyData: config18.useFrequencyData || false,
|
|
5212
|
+
smoothNormalisation: config18.smoothNormalisation
|
|
3745
5213
|
});
|
|
3746
|
-
const width =
|
|
3747
|
-
const height =
|
|
5214
|
+
const width = config18.width || videoWidth;
|
|
5215
|
+
const height = config18.height || videoHeight;
|
|
3748
5216
|
const contextValue = {
|
|
3749
5217
|
waveformData,
|
|
3750
5218
|
frequencyData,
|
|
@@ -3752,7 +5220,7 @@ var Waveform = ({
|
|
|
3752
5220
|
audioData,
|
|
3753
5221
|
frame,
|
|
3754
5222
|
fps,
|
|
3755
|
-
config:
|
|
5223
|
+
config: config18,
|
|
3756
5224
|
width,
|
|
3757
5225
|
height,
|
|
3758
5226
|
bass,
|
|
@@ -3762,7 +5230,7 @@ var Waveform = ({
|
|
|
3762
5230
|
midValues,
|
|
3763
5231
|
trebleValues
|
|
3764
5232
|
};
|
|
3765
|
-
return /* @__PURE__ */
|
|
5233
|
+
return /* @__PURE__ */ import_react37.default.createElement(WaveformContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react37.default.createElement(
|
|
3766
5234
|
"div",
|
|
3767
5235
|
{
|
|
3768
5236
|
className: `relative ${className}`,
|
|
@@ -3770,7 +5238,7 @@ var Waveform = ({
|
|
|
3770
5238
|
width,
|
|
3771
5239
|
height,
|
|
3772
5240
|
position: "relative",
|
|
3773
|
-
backgroundColor:
|
|
5241
|
+
backgroundColor: config18.backgroundColor || "transparent",
|
|
3774
5242
|
...style
|
|
3775
5243
|
}
|
|
3776
5244
|
},
|
|
@@ -3781,7 +5249,7 @@ var Waveform = ({
|
|
|
3781
5249
|
// src/templates/waveform/components/WaveformCircle.tsx
|
|
3782
5250
|
var WaveformCircle = ({ data }) => {
|
|
3783
5251
|
const {
|
|
3784
|
-
config:
|
|
5252
|
+
config: config18,
|
|
3785
5253
|
className = "",
|
|
3786
5254
|
style = {},
|
|
3787
5255
|
strokeColor = "#FF6B6B",
|
|
@@ -3798,7 +5266,7 @@ var WaveformCircle = ({ data }) => {
|
|
|
3798
5266
|
gradientStartColor,
|
|
3799
5267
|
gradientEndColor
|
|
3800
5268
|
} = data;
|
|
3801
|
-
return /* @__PURE__ */
|
|
5269
|
+
return /* @__PURE__ */ import_react38.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react38.default.createElement(
|
|
3802
5270
|
WaveformCircleContent,
|
|
3803
5271
|
{
|
|
3804
5272
|
strokeColor,
|
|
@@ -3837,7 +5305,7 @@ var WaveformCircleContent = ({
|
|
|
3837
5305
|
const circleCenterX = width * (centerX || 50) / 100;
|
|
3838
5306
|
const circleCenterY = height * (centerY || 50) / 100;
|
|
3839
5307
|
const rotation = frame * (rotationSpeed || 0) % 360;
|
|
3840
|
-
const circularPath = (0,
|
|
5308
|
+
const circularPath = (0, import_react38.useMemo)(() => {
|
|
3841
5309
|
if (!waveformData) return "";
|
|
3842
5310
|
const totalAngle = (endAngle || 360) - (startAngle || 0);
|
|
3843
5311
|
const angleStep = totalAngle / waveformData.length;
|
|
@@ -3859,11 +5327,11 @@ var WaveformCircleContent = ({
|
|
|
3859
5327
|
return path;
|
|
3860
5328
|
}, [waveformData, circleRadius, circleCenterX, circleCenterY, startAngle, endAngle, rotation, amplitude]);
|
|
3861
5329
|
if (!waveformData) {
|
|
3862
|
-
return /* @__PURE__ */
|
|
5330
|
+
return /* @__PURE__ */ import_react38.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading circular waveform...");
|
|
3863
5331
|
}
|
|
3864
5332
|
const gradientId = "circle-waveform-gradient";
|
|
3865
5333
|
const hasGradient = gradientStartColor && gradientEndColor;
|
|
3866
|
-
return /* @__PURE__ */
|
|
5334
|
+
return /* @__PURE__ */ import_react38.default.createElement(
|
|
3867
5335
|
"svg",
|
|
3868
5336
|
{
|
|
3869
5337
|
width,
|
|
@@ -3871,8 +5339,8 @@ var WaveformCircleContent = ({
|
|
|
3871
5339
|
className: "absolute inset-0",
|
|
3872
5340
|
style: { pointerEvents: "none" }
|
|
3873
5341
|
},
|
|
3874
|
-
hasGradient && /* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
5342
|
+
hasGradient && /* @__PURE__ */ import_react38.default.createElement("defs", null, /* @__PURE__ */ import_react38.default.createElement("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, /* @__PURE__ */ import_react38.default.createElement("stop", { offset: "0%", stopColor: gradientStartColor }), /* @__PURE__ */ import_react38.default.createElement("stop", { offset: "100%", stopColor: gradientEndColor }))),
|
|
5343
|
+
/* @__PURE__ */ import_react38.default.createElement(
|
|
3876
5344
|
"path",
|
|
3877
5345
|
{
|
|
3878
5346
|
d: circularPath,
|
|
@@ -3888,10 +5356,10 @@ var WaveformCircleContent = ({
|
|
|
3888
5356
|
};
|
|
3889
5357
|
|
|
3890
5358
|
// src/templates/waveform/components/WaveformHistogram.tsx
|
|
3891
|
-
var
|
|
5359
|
+
var import_react39 = __toESM(require("react"));
|
|
3892
5360
|
var WaveformHistogram = ({ data }) => {
|
|
3893
5361
|
const {
|
|
3894
|
-
config:
|
|
5362
|
+
config: config18,
|
|
3895
5363
|
className = "",
|
|
3896
5364
|
style = {},
|
|
3897
5365
|
barColor = "#FF6B6B",
|
|
@@ -3910,7 +5378,7 @@ var WaveformHistogram = ({ data }) => {
|
|
|
3910
5378
|
gradientStyle = "normal",
|
|
3911
5379
|
waveDirection = "right-to-left"
|
|
3912
5380
|
} = data;
|
|
3913
|
-
return /* @__PURE__ */
|
|
5381
|
+
return /* @__PURE__ */ import_react39.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react39.default.createElement(
|
|
3914
5382
|
WaveformHistogramContent,
|
|
3915
5383
|
{
|
|
3916
5384
|
barColor,
|
|
@@ -3951,7 +5419,7 @@ var WaveformHistogramContent = ({
|
|
|
3951
5419
|
const { waveformData, frequencyData, amplitudes, width, height } = useWaveformContext();
|
|
3952
5420
|
const dataToUse = amplitudes || waveformData;
|
|
3953
5421
|
if (!dataToUse) {
|
|
3954
|
-
return /* @__PURE__ */
|
|
5422
|
+
return /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading histogram...");
|
|
3955
5423
|
}
|
|
3956
5424
|
let directedData = waveDirection === "left-to-right" ? dataToUse.slice(1).reverse() : dataToUse;
|
|
3957
5425
|
const frequencies = horizontalSymmetry ? [...directedData, ...directedData.slice(1).reverse()] : Array(multiplier).fill(directedData).flat();
|
|
@@ -3975,7 +5443,7 @@ var WaveformHistogramContent = ({
|
|
|
3975
5443
|
},
|
|
3976
5444
|
opacity: gradientStyle === "mirrored" && !growUpwards ? 0.25 : 1
|
|
3977
5445
|
};
|
|
3978
|
-
return /* @__PURE__ */
|
|
5446
|
+
return /* @__PURE__ */ import_react39.default.createElement("div", { style: containerStyle2 }, frequencies.map((value, index) => /* @__PURE__ */ import_react39.default.createElement(
|
|
3979
5447
|
"div",
|
|
3980
5448
|
{
|
|
3981
5449
|
key: index,
|
|
@@ -4007,7 +5475,7 @@ var WaveformHistogramContent = ({
|
|
|
4007
5475
|
width: "100%",
|
|
4008
5476
|
left: 0
|
|
4009
5477
|
};
|
|
4010
|
-
return /* @__PURE__ */
|
|
5478
|
+
return /* @__PURE__ */ import_react39.default.createElement(import_react39.default.Fragment, null, /* @__PURE__ */ import_react39.default.createElement("div", { style: topHalfStyle }, /* @__PURE__ */ import_react39.default.createElement(Bars, { growUpwards: true })), /* @__PURE__ */ import_react39.default.createElement("div", { style: bottomHalfStyle }, /* @__PURE__ */ import_react39.default.createElement(Bars, { growUpwards: false })));
|
|
4011
5479
|
}
|
|
4012
5480
|
const containerStyle = {
|
|
4013
5481
|
width: "100%",
|
|
@@ -4016,14 +5484,14 @@ var WaveformHistogramContent = ({
|
|
|
4016
5484
|
height: `${height / 2}px`,
|
|
4017
5485
|
left: 0
|
|
4018
5486
|
};
|
|
4019
|
-
return /* @__PURE__ */
|
|
5487
|
+
return /* @__PURE__ */ import_react39.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react39.default.createElement(Bars, { growUpwards: true }));
|
|
4020
5488
|
};
|
|
4021
5489
|
|
|
4022
5490
|
// src/templates/waveform/components/WaveformHistogramRanged.tsx
|
|
4023
|
-
var
|
|
5491
|
+
var import_react40 = __toESM(require("react"));
|
|
4024
5492
|
var WaveformHistogramRanged = ({ data }) => {
|
|
4025
5493
|
const {
|
|
4026
|
-
config:
|
|
5494
|
+
config: config18,
|
|
4027
5495
|
className = "",
|
|
4028
5496
|
style = {},
|
|
4029
5497
|
barColor = "#FF6B6B",
|
|
@@ -4047,7 +5515,7 @@ var WaveformHistogramRanged = ({ data }) => {
|
|
|
4047
5515
|
horizontalSymmetry = false,
|
|
4048
5516
|
waveDirection = "right-to-left"
|
|
4049
5517
|
} = data;
|
|
4050
|
-
return /* @__PURE__ */
|
|
5518
|
+
return /* @__PURE__ */ import_react40.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react40.default.createElement(
|
|
4051
5519
|
WaveformHistogramRangedContent,
|
|
4052
5520
|
{
|
|
4053
5521
|
barColor,
|
|
@@ -4097,7 +5565,7 @@ var WaveformHistogramRangedContent = ({
|
|
|
4097
5565
|
}) => {
|
|
4098
5566
|
const { amplitudes, bassValues, midValues, trebleValues, height } = useWaveformContext();
|
|
4099
5567
|
if (!amplitudes || !bassValues || !midValues || !trebleValues) {
|
|
4100
|
-
return /* @__PURE__ */
|
|
5568
|
+
return /* @__PURE__ */ import_react40.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading frequency data...");
|
|
4101
5569
|
}
|
|
4102
5570
|
const bassFrequencies = bassValues;
|
|
4103
5571
|
const midFrequencies = midValues;
|
|
@@ -4121,12 +5589,12 @@ var WaveformHistogramRangedContent = ({
|
|
|
4121
5589
|
},
|
|
4122
5590
|
opacity: gradientStyle === "mirrored" && !growUpwards ? 0.25 : 1
|
|
4123
5591
|
};
|
|
4124
|
-
return /* @__PURE__ */
|
|
5592
|
+
return /* @__PURE__ */ import_react40.default.createElement("div", { style: containerStyle2 }, unifiedWaveform.map((value, index) => {
|
|
4125
5593
|
const rangeName = index === 0 ? "Bass" : index === 1 ? "Mid" : "Treble";
|
|
4126
5594
|
const styleGradientProp = gradientStartColor && gradientEndColor ? {
|
|
4127
5595
|
background: `linear-gradient(${gradientDirection === "horizontal" ? gradientStyle === "mirrored" ? "to right" : growUpwards ? "to right" : "to left" : gradientStyle === "normal" ? growUpwards ? "to top" : "to bottom" : "to bottom"}, ${gradientStartColor}, ${gradientEndColor})`
|
|
4128
5596
|
} : { backgroundColor: barColor };
|
|
4129
|
-
return /* @__PURE__ */
|
|
5597
|
+
return /* @__PURE__ */ import_react40.default.createElement(
|
|
4130
5598
|
"div",
|
|
4131
5599
|
{
|
|
4132
5600
|
key: index,
|
|
@@ -4144,7 +5612,7 @@ var WaveformHistogramRangedContent = ({
|
|
|
4144
5612
|
},
|
|
4145
5613
|
title: `${rangeName}: ${(value * 100).toFixed(1)}%`
|
|
4146
5614
|
},
|
|
4147
|
-
rangeLabels && /* @__PURE__ */
|
|
5615
|
+
rangeLabels && /* @__PURE__ */ import_react40.default.createElement("div", { style: {
|
|
4148
5616
|
position: "absolute",
|
|
4149
5617
|
bottom: growUpwards ? "-20px" : "auto",
|
|
4150
5618
|
top: growUpwards ? "auto" : "-20px",
|
|
@@ -4172,7 +5640,7 @@ var WaveformHistogramRangedContent = ({
|
|
|
4172
5640
|
width: "100%",
|
|
4173
5641
|
left: 0
|
|
4174
5642
|
};
|
|
4175
|
-
return /* @__PURE__ */
|
|
5643
|
+
return /* @__PURE__ */ import_react40.default.createElement(import_react40.default.Fragment, null, /* @__PURE__ */ import_react40.default.createElement("div", { style: topHalfStyle }, /* @__PURE__ */ import_react40.default.createElement(Bars, { growUpwards: true })), /* @__PURE__ */ import_react40.default.createElement("div", { style: bottomHalfStyle }, /* @__PURE__ */ import_react40.default.createElement(Bars, { growUpwards: false })));
|
|
4176
5644
|
}
|
|
4177
5645
|
const containerStyle = {
|
|
4178
5646
|
width: "100%",
|
|
@@ -4181,13 +5649,13 @@ var WaveformHistogramRangedContent = ({
|
|
|
4181
5649
|
height: `${height / 2}px`,
|
|
4182
5650
|
left: 0
|
|
4183
5651
|
};
|
|
4184
|
-
return /* @__PURE__ */
|
|
5652
|
+
return /* @__PURE__ */ import_react40.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react40.default.createElement(Bars, { growUpwards: true }));
|
|
4185
5653
|
};
|
|
4186
5654
|
|
|
4187
5655
|
// src/templates/waveform/components/WaveformLine.tsx
|
|
4188
|
-
var
|
|
5656
|
+
var import_react41 = __toESM(require("react"));
|
|
4189
5657
|
var import_media_utils2 = require("@remotion/media-utils");
|
|
4190
|
-
var
|
|
5658
|
+
var import_remotion27 = require("remotion");
|
|
4191
5659
|
var detectBeat = (frequencyData, amplitudes, threshold = 0.7, bpm, frame = 0, fps = 30) => {
|
|
4192
5660
|
if (!frequencyData || !amplitudes || frequencyData.length === 0) return false;
|
|
4193
5661
|
if (bpm) {
|
|
@@ -4219,7 +5687,7 @@ var easingFunctions = {
|
|
|
4219
5687
|
};
|
|
4220
5688
|
var WaveformLine = ({ data }) => {
|
|
4221
5689
|
const {
|
|
4222
|
-
config:
|
|
5690
|
+
config: config18,
|
|
4223
5691
|
className = "",
|
|
4224
5692
|
style = {},
|
|
4225
5693
|
strokeColor = "#FF6B6B",
|
|
@@ -4247,7 +5715,7 @@ var WaveformLine = ({ data }) => {
|
|
|
4247
5715
|
pulseColor = "#FFD700",
|
|
4248
5716
|
pulseScale = 1.2
|
|
4249
5717
|
} = data;
|
|
4250
|
-
return /* @__PURE__ */
|
|
5718
|
+
return /* @__PURE__ */ import_react41.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react41.default.createElement(
|
|
4251
5719
|
WaveformLineContent,
|
|
4252
5720
|
{
|
|
4253
5721
|
strokeColor,
|
|
@@ -4303,14 +5771,14 @@ var WaveformLineContent = ({
|
|
|
4303
5771
|
pulseColor,
|
|
4304
5772
|
pulseScale
|
|
4305
5773
|
}) => {
|
|
4306
|
-
const { waveformData, frequencyData, amplitudes, width, height, config:
|
|
4307
|
-
const currentFrame = (0,
|
|
4308
|
-
const videoConfig = (0,
|
|
4309
|
-
const isBeat = (0,
|
|
5774
|
+
const { waveformData, frequencyData, amplitudes, width, height, config: config18, frame, fps } = useWaveformContext();
|
|
5775
|
+
const currentFrame = (0, import_remotion27.useCurrentFrame)();
|
|
5776
|
+
const videoConfig = (0, import_remotion27.useVideoConfig)();
|
|
5777
|
+
const isBeat = (0, import_react41.useMemo)(() => {
|
|
4310
5778
|
if (!beatSync || !frequencyData || !amplitudes) return false;
|
|
4311
5779
|
return detectBeat(frequencyData, amplitudes, beatThreshold, bpm, currentFrame, fps);
|
|
4312
5780
|
}, [beatSync, frequencyData, amplitudes, beatThreshold, bpm, currentFrame, fps]);
|
|
4313
|
-
const beatProgress = (0,
|
|
5781
|
+
const beatProgress = (0, import_react41.useMemo)(() => {
|
|
4314
5782
|
if (!isBeat || !beatAnimationDuration) return 0;
|
|
4315
5783
|
const beatStartFrame = Math.floor(currentFrame / beatAnimationDuration) * beatAnimationDuration;
|
|
4316
5784
|
const progress = (currentFrame - beatStartFrame) / beatAnimationDuration;
|
|
@@ -4320,19 +5788,19 @@ var WaveformLineContent = ({
|
|
|
4320
5788
|
}
|
|
4321
5789
|
return clampedProgress;
|
|
4322
5790
|
}, [isBeat, currentFrame, beatAnimationDuration, smoothAnimation]);
|
|
4323
|
-
const currentBeatMultiplier = (0,
|
|
5791
|
+
const currentBeatMultiplier = (0, import_react41.useMemo)(() => {
|
|
4324
5792
|
if (!beatSync || !isBeat || !beatAmplitudeMultiplier || !amplitudeCurve) return 1;
|
|
4325
5793
|
const easing = easingFunctions[amplitudeCurve];
|
|
4326
5794
|
const easedProgress = easing(beatProgress);
|
|
4327
5795
|
return 1 + (beatAmplitudeMultiplier - 1) * (1 - easedProgress);
|
|
4328
5796
|
}, [beatSync, isBeat, beatProgress, beatAmplitudeMultiplier, amplitudeCurve]);
|
|
4329
|
-
const smoothFactor = (0,
|
|
5797
|
+
const smoothFactor = (0, import_react41.useMemo)(() => {
|
|
4330
5798
|
if (!beatSync) {
|
|
4331
5799
|
return 0.3;
|
|
4332
5800
|
}
|
|
4333
5801
|
return smoothAnimation ? 0.7 : 1;
|
|
4334
5802
|
}, [beatSync, smoothAnimation]);
|
|
4335
|
-
const waveformPaths = (0,
|
|
5803
|
+
const waveformPaths = (0, import_react41.useMemo)(() => {
|
|
4336
5804
|
if (!waveformData) return [];
|
|
4337
5805
|
const paths = [];
|
|
4338
5806
|
const segments = waveSegments || 1;
|
|
@@ -4348,8 +5816,8 @@ var WaveformLineContent = ({
|
|
|
4348
5816
|
const points = waveformData.map((y, index) => {
|
|
4349
5817
|
const progress = index / (waveformData.length - 1);
|
|
4350
5818
|
const x = segmentStart + progress * segmentDataWidth + offset;
|
|
4351
|
-
let animatedAmplitude = y * (
|
|
4352
|
-
const baseAmplitude = y * (
|
|
5819
|
+
let animatedAmplitude = y * (config18.amplitude || 1) * currentBeatMultiplier * speed;
|
|
5820
|
+
const baseAmplitude = y * (config18.amplitude || 1) * speed;
|
|
4353
5821
|
const beatAmplitude = animatedAmplitude - baseAmplitude;
|
|
4354
5822
|
animatedAmplitude = baseAmplitude + beatAmplitude * smoothFactor;
|
|
4355
5823
|
const yPos = waveDirection === "horizontal" ? animatedAmplitude * height / 2 + height / 2 : animatedAmplitude * width / 2 + width / 2;
|
|
@@ -4359,11 +5827,11 @@ var WaveformLineContent = ({
|
|
|
4359
5827
|
paths.push({ path, segmentIndex: i });
|
|
4360
5828
|
}
|
|
4361
5829
|
return paths;
|
|
4362
|
-
}, [waveformData, width, height,
|
|
5830
|
+
}, [waveformData, width, height, config18.amplitude, currentBeatMultiplier, animationSpeed, waveSegments, waveSpacing, waveOffset, waveDirection, smoothFactor]);
|
|
4363
5831
|
if (!waveformData) {
|
|
4364
|
-
return /* @__PURE__ */
|
|
5832
|
+
return /* @__PURE__ */ import_react41.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading waveform...");
|
|
4365
5833
|
}
|
|
4366
|
-
return /* @__PURE__ */
|
|
5834
|
+
return /* @__PURE__ */ import_react41.default.createElement(
|
|
4367
5835
|
"svg",
|
|
4368
5836
|
{
|
|
4369
5837
|
width,
|
|
@@ -4371,7 +5839,7 @@ var WaveformLineContent = ({
|
|
|
4371
5839
|
className: "absolute inset-0",
|
|
4372
5840
|
style: { pointerEvents: "none" }
|
|
4373
5841
|
},
|
|
4374
|
-
centerLine && /* @__PURE__ */
|
|
5842
|
+
centerLine && /* @__PURE__ */ import_react41.default.createElement(
|
|
4375
5843
|
"line",
|
|
4376
5844
|
{
|
|
4377
5845
|
x1: waveDirection === "horizontal" ? 0 : width / 2,
|
|
@@ -4383,7 +5851,7 @@ var WaveformLineContent = ({
|
|
|
4383
5851
|
opacity: 0.3
|
|
4384
5852
|
}
|
|
4385
5853
|
),
|
|
4386
|
-
waveformPaths.map(({ path, segmentIndex }) => /* @__PURE__ */
|
|
5854
|
+
waveformPaths.map(({ path, segmentIndex }) => /* @__PURE__ */ import_react41.default.createElement("g", { key: segmentIndex }, pulseOnBeat && isBeat && /* @__PURE__ */ import_react41.default.createElement(
|
|
4387
5855
|
"path",
|
|
4388
5856
|
{
|
|
4389
5857
|
d: path,
|
|
@@ -4394,7 +5862,7 @@ var WaveformLineContent = ({
|
|
|
4394
5862
|
fill: "none",
|
|
4395
5863
|
opacity: (opacity || 1) * (1 - beatProgress)
|
|
4396
5864
|
}
|
|
4397
|
-
), /* @__PURE__ */
|
|
5865
|
+
), /* @__PURE__ */ import_react41.default.createElement(
|
|
4398
5866
|
"path",
|
|
4399
5867
|
{
|
|
4400
5868
|
d: path,
|
|
@@ -4455,19 +5923,19 @@ registerComponent("WaveformCircle", WaveformCircle, "atom", {
|
|
|
4455
5923
|
|
|
4456
5924
|
// src/components/Composition.tsx
|
|
4457
5925
|
var import_player = require("@remotion/player");
|
|
4458
|
-
var
|
|
4459
|
-
var
|
|
4460
|
-
var
|
|
4461
|
-
var CompositionLayout = ({ childrenData, style, config:
|
|
4462
|
-
return /* @__PURE__ */
|
|
5926
|
+
var import_react42 = __toESM(require("react"));
|
|
5927
|
+
var import_remotion28 = require("remotion");
|
|
5928
|
+
var import_zod11 = __toESM(require("zod"));
|
|
5929
|
+
var CompositionLayout = ({ childrenData, style, config: config18 }) => {
|
|
5930
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
4463
5931
|
CompositionProvider,
|
|
4464
5932
|
{
|
|
4465
5933
|
value: {
|
|
4466
5934
|
root: childrenData,
|
|
4467
|
-
duration:
|
|
5935
|
+
duration: config18.duration
|
|
4468
5936
|
}
|
|
4469
5937
|
},
|
|
4470
|
-
/* @__PURE__ */
|
|
5938
|
+
/* @__PURE__ */ import_react42.default.createElement(import_remotion28.AbsoluteFill, { style }, childrenData?.map((component) => /* @__PURE__ */ import_react42.default.createElement(
|
|
4471
5939
|
ComponentRenderer,
|
|
4472
5940
|
{
|
|
4473
5941
|
key: component.id,
|
|
@@ -4507,26 +5975,26 @@ var calculateCompositionLayoutMetadata = async ({ props, defaultProps, abortSign
|
|
|
4507
5975
|
var Composition = ({
|
|
4508
5976
|
id,
|
|
4509
5977
|
childrenData,
|
|
4510
|
-
config:
|
|
5978
|
+
config: config18,
|
|
4511
5979
|
style
|
|
4512
5980
|
}) => {
|
|
4513
|
-
return /* @__PURE__ */
|
|
4514
|
-
|
|
5981
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
5982
|
+
import_remotion28.Composition,
|
|
4515
5983
|
{
|
|
4516
5984
|
id,
|
|
4517
5985
|
component: CompositionLayout,
|
|
4518
|
-
durationInFrames: Math.round(
|
|
4519
|
-
fps:
|
|
4520
|
-
width:
|
|
4521
|
-
height:
|
|
4522
|
-
defaultProps: { childrenData, style, config:
|
|
5986
|
+
durationInFrames: Math.round(config18.duration * config18.fps),
|
|
5987
|
+
fps: config18.fps,
|
|
5988
|
+
width: config18.width ?? 1080,
|
|
5989
|
+
height: config18.height ?? 1920,
|
|
5990
|
+
defaultProps: { childrenData, style, config: config18 },
|
|
4523
5991
|
calculateMetadata: calculateCompositionLayoutMetadata,
|
|
4524
|
-
schema:
|
|
5992
|
+
schema: import_zod11.default.object({})
|
|
4525
5993
|
}
|
|
4526
5994
|
);
|
|
4527
5995
|
};
|
|
4528
5996
|
var Player = (props) => {
|
|
4529
|
-
return /* @__PURE__ */
|
|
5997
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
4530
5998
|
import_player.Player,
|
|
4531
5999
|
{
|
|
4532
6000
|
component: CompositionLayout,
|
|
@@ -4546,12 +6014,20 @@ var Player = (props) => {
|
|
|
4546
6014
|
BaseLayoutConfig,
|
|
4547
6015
|
BlurEffect,
|
|
4548
6016
|
BlurEffectConfig,
|
|
6017
|
+
CanvasAtom,
|
|
6018
|
+
CanvasAtomConfig,
|
|
6019
|
+
CanvasContentAwareReveal,
|
|
6020
|
+
CanvasGlitchEffect,
|
|
6021
|
+
CanvasParticleEffect,
|
|
6022
|
+
CanvasWipeReveal,
|
|
4549
6023
|
ComponentRenderer,
|
|
4550
6024
|
Composition,
|
|
4551
6025
|
CompositionLayout,
|
|
4552
6026
|
CompositionProvider,
|
|
4553
6027
|
Frame,
|
|
4554
6028
|
GenericEffectPresets,
|
|
6029
|
+
HTMLBlockAtom,
|
|
6030
|
+
HTMLBlockAtomConfig,
|
|
4555
6031
|
ImageAtom,
|
|
4556
6032
|
ImageAtomConfig,
|
|
4557
6033
|
LoopEffect,
|
|
@@ -4580,6 +6056,8 @@ var Player = (props) => {
|
|
|
4580
6056
|
VideoAtomConfig,
|
|
4581
6057
|
Waveform,
|
|
4582
6058
|
WaveformCircle,
|
|
6059
|
+
WaveformEffect,
|
|
6060
|
+
WaveformEffectConfig,
|
|
4583
6061
|
WaveformHistogram,
|
|
4584
6062
|
WaveformHistogramRanged,
|
|
4585
6063
|
WaveformLine,
|