Spaces:
Runtime error
Runtime error
Commit ·
1ccdfb1
1
Parent(s): eb0c5f5
Transitins working
Browse files- anims/CircularWipe.tsx +3 -4
- anims/Pan.tsx +2 -2
- anims/Slide.tsx +2 -2
- package-lock.json +0 -51
- package.json +0 -1
- src/OriginalManuscriptModel.ts +1 -0
- src/RenderUtils.ts +5 -0
- src/ig-reel/IGMediaRender.tsx +30 -0
- src/ig-reel/IGReelComposition.tsx +10 -4
- src/ig-reel/IGSimpleScene.tsx +63 -62
- src/textWithBgImage/SemibitComposition.tsx +3 -4
anims/CircularWipe.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import React from 'react';
|
| 2 |
-
import { useVideoConfig } from 'remotion';
|
| 3 |
import { TransitionImplementationProps } from 'remotion-transition-series/lib/components/Transition';
|
| 4 |
|
| 5 |
export const CircularWipe: React.FC<
|
| 6 |
-
TransitionImplementationProps & { direction: 'in' | 'out' }
|
| 7 |
> = ({
|
| 8 |
direction = 'out',
|
| 9 |
progress: inProgress,
|
|
@@ -15,7 +15,6 @@ export const CircularWipe: React.FC<
|
|
| 15 |
const isOut = direction === 'out';
|
| 16 |
const progress = isOut ? inProgress : 1 - inProgress;
|
| 17 |
const polygon = `circle(${radius * progress}px)`;
|
| 18 |
-
|
| 19 |
return (
|
| 20 |
<>
|
| 21 |
<div
|
|
@@ -43,4 +42,4 @@ export const CircularWipe: React.FC<
|
|
| 43 |
</div>
|
| 44 |
</>
|
| 45 |
);
|
| 46 |
-
};
|
|
|
|
| 1 |
import React from 'react';
|
| 2 |
+
import { useCurrentFrame, useVideoConfig } from 'remotion';
|
| 3 |
import { TransitionImplementationProps } from 'remotion-transition-series/lib/components/Transition';
|
| 4 |
|
| 5 |
export const CircularWipe: React.FC<
|
| 6 |
+
TransitionImplementationProps & { direction?: 'in' | 'out' }
|
| 7 |
> = ({
|
| 8 |
direction = 'out',
|
| 9 |
progress: inProgress,
|
|
|
|
| 15 |
const isOut = direction === 'out';
|
| 16 |
const progress = isOut ? inProgress : 1 - inProgress;
|
| 17 |
const polygon = `circle(${radius * progress}px)`;
|
|
|
|
| 18 |
return (
|
| 19 |
<>
|
| 20 |
<div
|
|
|
|
| 42 |
</div>
|
| 43 |
</>
|
| 44 |
);
|
| 45 |
+
};
|
anims/Pan.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { TransitionImplementationProps } from 'remotion-transition-series/lib/co
|
|
| 3 |
|
| 4 |
export const Pan: React.FC<
|
| 5 |
TransitionImplementationProps & {
|
| 6 |
-
direction: 'up' | 'down' | 'left' | 'right';
|
| 7 |
}
|
| 8 |
> = ({
|
| 9 |
direction = 'left',
|
|
@@ -43,4 +43,4 @@ export const Pan: React.FC<
|
|
| 43 |
</div>
|
| 44 |
</>
|
| 45 |
);
|
| 46 |
-
};
|
|
|
|
| 3 |
|
| 4 |
export const Pan: React.FC<
|
| 5 |
TransitionImplementationProps & {
|
| 6 |
+
direction?: 'up' | 'down' | 'left' | 'right';
|
| 7 |
}
|
| 8 |
> = ({
|
| 9 |
direction = 'left',
|
|
|
|
| 43 |
</div>
|
| 44 |
</>
|
| 45 |
);
|
| 46 |
+
};
|
anims/Slide.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { TransitionImplementationProps } from 'remotion-transition-series/lib/co
|
|
| 3 |
|
| 4 |
export const Slide: React.FC<
|
| 5 |
TransitionImplementationProps & {
|
| 6 |
-
direction: 'up' | 'down' | 'left' | 'right';
|
| 7 |
}
|
| 8 |
> = ({
|
| 9 |
direction = 'left',
|
|
@@ -42,4 +42,4 @@ export const Slide: React.FC<
|
|
| 42 |
</div>
|
| 43 |
</>
|
| 44 |
);
|
| 45 |
-
};
|
|
|
|
| 3 |
|
| 4 |
export const Slide: React.FC<
|
| 5 |
TransitionImplementationProps & {
|
| 6 |
+
direction?: 'up' | 'down' | 'left' | 'right';
|
| 7 |
}
|
| 8 |
> = ({
|
| 9 |
direction = 'left',
|
|
|
|
| 42 |
</div>
|
| 43 |
</>
|
| 44 |
);
|
| 45 |
+
};
|
package-lock.json
CHANGED
|
@@ -15,7 +15,6 @@
|
|
| 15 |
"@remotion/cli": "4.0.19",
|
| 16 |
"@remotion/eslint-config": "4.0.19",
|
| 17 |
"@remotion/google-fonts": "4.0.19",
|
| 18 |
-
"@remotion/lottie": "^4.0.43",
|
| 19 |
"@remotion/noise": "4.0.19",
|
| 20 |
"@remotion/preload": "4.0.19",
|
| 21 |
"@remotion/tailwind": "4.0.19",
|
|
@@ -4400,28 +4399,6 @@
|
|
| 4400 |
"remotion": "4.0.19"
|
| 4401 |
}
|
| 4402 |
},
|
| 4403 |
-
"node_modules/@remotion/lottie": {
|
| 4404 |
-
"version": "4.0.43",
|
| 4405 |
-
"resolved": "https://registry.npmjs.org/@remotion/lottie/-/lottie-4.0.43.tgz",
|
| 4406 |
-
"integrity": "sha512-+BuZuOF4rAG3oDrGfiw9jZ1yxgtsAixNV4yKZ4Pile2LFV/FDp8pFt3Ss6DPh0SrC27aGr9ubjSIb7j0nWcZnA==",
|
| 4407 |
-
"dependencies": {
|
| 4408 |
-
"remotion": "4.0.43"
|
| 4409 |
-
},
|
| 4410 |
-
"peerDependencies": {
|
| 4411 |
-
"lottie-web": "^5",
|
| 4412 |
-
"react": ">=16.8.0",
|
| 4413 |
-
"react-dom": ">=16.8.0"
|
| 4414 |
-
}
|
| 4415 |
-
},
|
| 4416 |
-
"node_modules/@remotion/lottie/node_modules/remotion": {
|
| 4417 |
-
"version": "4.0.43",
|
| 4418 |
-
"resolved": "https://registry.npmjs.org/remotion/-/remotion-4.0.43.tgz",
|
| 4419 |
-
"integrity": "sha512-WKBzZWL37AgeAMlnpg4uce7lcEUqiaQNsPVBPUV3NZgnYCoEzpusYBr8ubcwndZovjLKJQchPzT4hoBEW71/Lg==",
|
| 4420 |
-
"peerDependencies": {
|
| 4421 |
-
"react": ">=16.8.0",
|
| 4422 |
-
"react-dom": ">=16.8.0"
|
| 4423 |
-
}
|
| 4424 |
-
},
|
| 4425 |
"node_modules/@remotion/media-utils": {
|
| 4426 |
"version": "4.0.19",
|
| 4427 |
"resolved": "https://registry.npmjs.org/@remotion/media-utils/-/media-utils-4.0.19.tgz",
|
|
@@ -10411,12 +10388,6 @@
|
|
| 10411 |
"loose-envify": "cli.js"
|
| 10412 |
}
|
| 10413 |
},
|
| 10414 |
-
"node_modules/lottie-web": {
|
| 10415 |
-
"version": "5.12.2",
|
| 10416 |
-
"resolved": "https://registry.npmjs.org/lottie-web/-/lottie-web-5.12.2.tgz",
|
| 10417 |
-
"integrity": "sha512-uvhvYPC8kGPjXT3MyKMrL3JitEAmDMp30lVkuq/590Mw9ok6pWcFCwXJveo0t5uqYw1UREQHofD+jVpdjBv8wg==",
|
| 10418 |
-
"peer": true
|
| 10419 |
-
},
|
| 10420 |
"node_modules/lru-cache": {
|
| 10421 |
"version": "6.0.0",
|
| 10422 |
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
@@ -22113,22 +22084,6 @@
|
|
| 22113 |
"remotion": "4.0.19"
|
| 22114 |
}
|
| 22115 |
},
|
| 22116 |
-
"@remotion/lottie": {
|
| 22117 |
-
"version": "4.0.43",
|
| 22118 |
-
"resolved": "https://registry.npmjs.org/@remotion/lottie/-/lottie-4.0.43.tgz",
|
| 22119 |
-
"integrity": "sha512-+BuZuOF4rAG3oDrGfiw9jZ1yxgtsAixNV4yKZ4Pile2LFV/FDp8pFt3Ss6DPh0SrC27aGr9ubjSIb7j0nWcZnA==",
|
| 22120 |
-
"requires": {
|
| 22121 |
-
"remotion": "4.0.43"
|
| 22122 |
-
},
|
| 22123 |
-
"dependencies": {
|
| 22124 |
-
"remotion": {
|
| 22125 |
-
"version": "4.0.43",
|
| 22126 |
-
"resolved": "https://registry.npmjs.org/remotion/-/remotion-4.0.43.tgz",
|
| 22127 |
-
"integrity": "sha512-WKBzZWL37AgeAMlnpg4uce7lcEUqiaQNsPVBPUV3NZgnYCoEzpusYBr8ubcwndZovjLKJQchPzT4hoBEW71/Lg==",
|
| 22128 |
-
"requires": {}
|
| 22129 |
-
}
|
| 22130 |
-
}
|
| 22131 |
-
},
|
| 22132 |
"@remotion/media-utils": {
|
| 22133 |
"version": "4.0.19",
|
| 22134 |
"resolved": "https://registry.npmjs.org/@remotion/media-utils/-/media-utils-4.0.19.tgz",
|
|
@@ -26659,12 +26614,6 @@
|
|
| 26659 |
"js-tokens": "^3.0.0 || ^4.0.0"
|
| 26660 |
}
|
| 26661 |
},
|
| 26662 |
-
"lottie-web": {
|
| 26663 |
-
"version": "5.12.2",
|
| 26664 |
-
"resolved": "https://registry.npmjs.org/lottie-web/-/lottie-web-5.12.2.tgz",
|
| 26665 |
-
"integrity": "sha512-uvhvYPC8kGPjXT3MyKMrL3JitEAmDMp30lVkuq/590Mw9ok6pWcFCwXJveo0t5uqYw1UREQHofD+jVpdjBv8wg==",
|
| 26666 |
-
"peer": true
|
| 26667 |
-
},
|
| 26668 |
"lru-cache": {
|
| 26669 |
"version": "6.0.0",
|
| 26670 |
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
|
|
| 15 |
"@remotion/cli": "4.0.19",
|
| 16 |
"@remotion/eslint-config": "4.0.19",
|
| 17 |
"@remotion/google-fonts": "4.0.19",
|
|
|
|
| 18 |
"@remotion/noise": "4.0.19",
|
| 19 |
"@remotion/preload": "4.0.19",
|
| 20 |
"@remotion/tailwind": "4.0.19",
|
|
|
|
| 4399 |
"remotion": "4.0.19"
|
| 4400 |
}
|
| 4401 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4402 |
"node_modules/@remotion/media-utils": {
|
| 4403 |
"version": "4.0.19",
|
| 4404 |
"resolved": "https://registry.npmjs.org/@remotion/media-utils/-/media-utils-4.0.19.tgz",
|
|
|
|
| 10388 |
"loose-envify": "cli.js"
|
| 10389 |
}
|
| 10390 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10391 |
"node_modules/lru-cache": {
|
| 10392 |
"version": "6.0.0",
|
| 10393 |
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
|
|
| 22084 |
"remotion": "4.0.19"
|
| 22085 |
}
|
| 22086 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22087 |
"@remotion/media-utils": {
|
| 22088 |
"version": "4.0.19",
|
| 22089 |
"resolved": "https://registry.npmjs.org/@remotion/media-utils/-/media-utils-4.0.19.tgz",
|
|
|
|
| 26614 |
"js-tokens": "^3.0.0 || ^4.0.0"
|
| 26615 |
}
|
| 26616 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26617 |
"lru-cache": {
|
| 26618 |
"version": "6.0.0",
|
| 26619 |
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
package.json
CHANGED
|
@@ -40,7 +40,6 @@
|
|
| 40 |
"@remotion/cli": "4.0.19",
|
| 41 |
"@remotion/eslint-config": "4.0.19",
|
| 42 |
"@remotion/google-fonts": "4.0.19",
|
| 43 |
-
"@remotion/lottie": "^4.0.43",
|
| 44 |
"@remotion/noise": "4.0.19",
|
| 45 |
"@remotion/preload": "4.0.19",
|
| 46 |
"@remotion/tailwind": "4.0.19",
|
|
|
|
| 40 |
"@remotion/cli": "4.0.19",
|
| 41 |
"@remotion/eslint-config": "4.0.19",
|
| 42 |
"@remotion/google-fonts": "4.0.19",
|
|
|
|
| 43 |
"@remotion/noise": "4.0.19",
|
| 44 |
"@remotion/preload": "4.0.19",
|
| 45 |
"@remotion/tailwind": "4.0.19",
|
src/OriginalManuscriptModel.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
export interface OriginalManuscript {
|
| 2 |
id: string;
|
| 3 |
bgMusic: string
|
|
|
|
| 4 |
status: boolean
|
| 5 |
transcriptText: string
|
| 6 |
transcript: Transcript[]
|
|
|
|
| 1 |
export interface OriginalManuscript {
|
| 2 |
id: string;
|
| 3 |
bgMusic: string
|
| 4 |
+
bgMusicDuration: number
|
| 5 |
status: boolean
|
| 6 |
transcriptText: string
|
| 7 |
transcript: Transcript[]
|
src/RenderUtils.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
|
| 2 |
|
| 3 |
function levenshteinDistance(str1: string, str2: string) {
|
|
@@ -18,6 +19,10 @@ function levenshteinDistance(str1: string, str2: string) {
|
|
| 18 |
}
|
| 19 |
export class RenderUtils {
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
public static hashCode(s) {
|
| 22 |
return s.split("").reduce(function (a, b) {
|
| 23 |
a = ((a << 5) - a) + b.charCodeAt(0);
|
|
|
|
| 1 |
+
import { random, useCurrentFrame } from "remotion";
|
| 2 |
|
| 3 |
|
| 4 |
function levenshteinDistance(str1: string, str2: string) {
|
|
|
|
| 19 |
}
|
| 20 |
export class RenderUtils {
|
| 21 |
|
| 22 |
+
public static randomElement<T>(arr: T[], seed: number): T {
|
| 23 |
+
return arr[Math.floor(random(seed || 1) * arr.length)];
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
public static hashCode(s) {
|
| 27 |
return s.split("").reduce(function (a, b) {
|
| 28 |
a = ((a << 5) - a) + b.charCodeAt(0);
|
src/ig-reel/IGMediaRender.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AbsoluteFill, Easing, Img, Video, interpolate, staticFile, useCurrentFrame } from "remotion";
|
| 2 |
+
import { DisplayMedia } from "./IGSimpleScene";
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
export function IGMediaRender(props) {
|
| 6 |
+
let displayMedia: DisplayMedia = props.displayMedia
|
| 7 |
+
let frame = useCurrentFrame()
|
| 8 |
+
let bgMediaPath = staticFile(displayMedia?.path || '')
|
| 9 |
+
let curZoom = props.curZoom
|
| 10 |
+
|
| 11 |
+
return (
|
| 12 |
+
displayMedia.type == 'video' ? (
|
| 13 |
+
<div style={{
|
| 14 |
+
position: 'relative',
|
| 15 |
+
height: '100%', width: '100%'
|
| 16 |
+
}}>
|
| 17 |
+
<Video playbackRate={0.5} volume={0} style={{
|
| 18 |
+
background: '#fff',
|
| 19 |
+
position: 'absolute',
|
| 20 |
+
height: '100%', width: '100%'
|
| 21 |
+
}} src={bgMediaPath} />
|
| 22 |
+
</div>
|
| 23 |
+
) : (
|
| 24 |
+
<Img className='absolute inset-0 w-full h-full object-cover' style={{
|
| 25 |
+
transform: `scale(${(curZoom)}) translateX(${10 * curZoom}px)`,
|
| 26 |
+
height: '100%', width: '100%'
|
| 27 |
+
}} src={bgMediaPath} />
|
| 28 |
+
)
|
| 29 |
+
)
|
| 30 |
+
}
|
src/ig-reel/IGReelComposition.tsx
CHANGED
|
@@ -1,14 +1,16 @@
|
|
| 1 |
//@ts-nocheck
|
| 2 |
-
import { AbsoluteFill, Audio, Img, staticFile } from 'remotion';
|
| 3 |
import React from 'react'
|
| 4 |
import { loadFont } from "@remotion/google-fonts/MontserratAlternates";
|
| 5 |
import { Series } from "remotion";
|
| 6 |
import { IGScene } from './IGSimpleScene';
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
-
export const IGReelComposition: React.FC = (props) => {
|
| 10 |
const { fontFamily } = loadFont();
|
| 11 |
-
let { contents, meta, bgMusic } = props
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
let bgMusicPath = staticFile(bgMusic || '')
|
|
@@ -18,7 +20,11 @@ export const IGReelComposition: React.FC = (props) => {
|
|
| 18 |
}}>
|
| 19 |
{
|
| 20 |
bgMusic && (
|
| 21 |
-
<Audio loop
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
)
|
| 23 |
}
|
| 24 |
<Series>
|
|
|
|
| 1 |
//@ts-nocheck
|
| 2 |
+
import { AbsoluteFill, Audio, Img, interpolate, staticFile } from 'remotion';
|
| 3 |
import React from 'react'
|
| 4 |
import { loadFont } from "@remotion/google-fonts/MontserratAlternates";
|
| 5 |
import { Series } from "remotion";
|
| 6 |
import { IGScene } from './IGSimpleScene';
|
| 7 |
+
import { OriginalManuscript } from '../OriginalManuscriptModel';
|
| 8 |
|
| 9 |
|
| 10 |
+
export const IGReelComposition: React.FC = (props: OriginalManuscript) => {
|
| 11 |
const { fontFamily } = loadFont();
|
| 12 |
+
let { contents, meta, bgMusic, bgMusicDuration } = props
|
| 13 |
+
let fps = meta.fps
|
| 14 |
|
| 15 |
|
| 16 |
let bgMusicPath = staticFile(bgMusic || '')
|
|
|
|
| 20 |
}}>
|
| 21 |
{
|
| 22 |
bgMusic && (
|
| 23 |
+
<Audio loop
|
| 24 |
+
volume={(f) =>
|
| 25 |
+
interpolate(f, [0, bgMusicDuration * fps], [0.05, 0.01], { extrapolateLeft: "clamp" })
|
| 26 |
+
}
|
| 27 |
+
src={bgMusicPath} />
|
| 28 |
)
|
| 29 |
}
|
| 30 |
<Series>
|
src/ig-reel/IGSimpleScene.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
//@ts-nocheck
|
| 2 |
-
import { AbsoluteFill, Img, staticFile, Audio, useCurrentFrame, Video } from 'remotion';
|
| 3 |
import React, { useEffect, useState } from 'react'
|
| 4 |
import { loadFont } from "@remotion/google-fonts/MontserratAlternates";
|
| 5 |
import { Series, Sequence } from "remotion";
|
|
@@ -10,8 +10,20 @@ import GeneralSubtitles from '../subtitles/general_Subtitles';
|
|
| 10 |
import ExcitedSubtitles from '../subtitles/excited_Subtitles';
|
| 11 |
import _ from 'lodash';
|
| 12 |
import './styles.module.css'
|
| 13 |
-
import
|
| 14 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
export const IGScene: React.FC<any> = (props: {
|
| 17 |
script: any,
|
|
@@ -101,10 +113,9 @@ export const IGScene: React.FC<any> = (props: {
|
|
| 101 |
|
| 102 |
let curSecond: Number = frame / fps
|
| 103 |
let word = findCurrentWord(curSecond, subtitles)
|
| 104 |
-
let group = findCurrentGroupByTime(curSecond, groups)
|
| 105 |
|
| 106 |
-
let
|
| 107 |
-
{ idx: number, durationFrames: number, startFrame: number, endFrame: number, } = (item?.imageAbsPaths || [])[0]
|
| 108 |
let transitioning = false
|
| 109 |
|
| 110 |
if (!_.isEmpty(item?.imageAbsPaths)) {
|
|
@@ -120,13 +131,12 @@ export const IGScene: React.FC<any> = (props: {
|
|
| 120 |
media.endFrame = frameOffest + media.durationFrames
|
| 121 |
frameOffest = frameOffest + media.durationFrames
|
| 122 |
if (frame > media.startFrame && frame < media.endFrame) {
|
| 123 |
-
|
| 124 |
}
|
| 125 |
}
|
| 126 |
|
| 127 |
}
|
| 128 |
|
| 129 |
-
let bgMediaPath = staticFile(displayMedia?.path || '')
|
| 130 |
let audioPath = RenderUtils.getFileName(item?.audioFullPath)
|
| 131 |
|
| 132 |
let transition = {
|
|
@@ -135,67 +145,57 @@ export const IGScene: React.FC<any> = (props: {
|
|
| 135 |
durationFrames: 2 * fps,
|
| 136 |
}
|
| 137 |
|
| 138 |
-
return (
|
| 139 |
-
<AbsoluteFill className='relative'>
|
| 140 |
-
<Audio volume={1} src={staticFile(audioPath)} />
|
| 141 |
-
|
| 142 |
-
{
|
| 143 |
-
displayMedia && (
|
| 144 |
-
|
| 145 |
-
<>
|
| 146 |
-
|
| 147 |
-
{
|
| 148 |
-
displayMedia.type == 'video' ? (
|
| 149 |
-
<div style={{
|
| 150 |
-
position: 'relative',
|
| 151 |
-
height: '100%', width: '100%'
|
| 152 |
-
|
| 153 |
-
}}>
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
<Sequence
|
| 157 |
-
from={displayMedia.startFrame}
|
| 158 |
-
durationInFrames={displayMedia.durationFrames}>
|
| 159 |
-
<Video playbackRate={0.5} volume={0} style={{
|
| 160 |
-
background: '#fff',
|
| 161 |
-
position: 'absolute',
|
| 162 |
-
height: '100%', width: '100%'
|
| 163 |
-
}} src={bgMediaPath} />
|
| 164 |
-
</Sequence>
|
| 165 |
-
|
| 166 |
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
}
|
| 173 |
|
| 174 |
|
| 175 |
-
<Sequence from={displayMedia.startFrame} durationInFrames={60} >
|
| 176 |
-
<Video playbackRate={1}
|
| 177 |
-
startFrom={20}
|
| 178 |
-
className="transparent" volume={0} style={{
|
| 179 |
-
position: 'absolute',
|
| 180 |
-
background: `linear-gradient(45deg, rgba(0, 0, 0, .1) 25%, transparent 0), linear-gradient(135deg, rgba(0, 0, 0, .1) 25%, transparent 0), linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, .1) 0), linear-gradient(135deg, transparent 75%, rgba(0, 0, 0, .1) 0), #fff;`,
|
| 181 |
-
height: '100%', width: '100%',
|
| 182 |
-
}} src={staticFile(transition.file)} />
|
| 183 |
-
</Sequence>
|
| 184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
-
|
| 187 |
-
<Video playbackRate={1}
|
| 188 |
-
className="transparent" volume={0} style={{
|
| 189 |
-
position: 'absolute',
|
| 190 |
-
background: `linear-gradient(45deg, rgba(0, 0, 0, .1) 25%, transparent 0), linear-gradient(135deg, rgba(0, 0, 0, .1) 25%, transparent 0), linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, .1) 0), linear-gradient(135deg, transparent 75%, rgba(0, 0, 0, .1) 0), #fff;`,
|
| 191 |
-
height: '100%', width: '100%',
|
| 192 |
-
}} src={staticFile(transition.file)} />
|
| 193 |
-
</Sequence>
|
| 194 |
|
| 195 |
|
| 196 |
-
</>
|
| 197 |
-
)
|
| 198 |
-
}
|
| 199 |
<div className='absolute inset-0'>
|
| 200 |
<ExcitedSubtitles position='center' group={group} word={word} />
|
| 201 |
</div>
|
|
@@ -203,6 +203,7 @@ export const IGScene: React.FC<any> = (props: {
|
|
| 203 |
);
|
| 204 |
};
|
| 205 |
|
|
|
|
| 206 |
function splitWordsIntoGroups(words) {
|
| 207 |
const groups = [];
|
| 208 |
let currentGroup = [];
|
|
|
|
| 1 |
//@ts-nocheck
|
| 2 |
+
import { AbsoluteFill, interpolate, Img, staticFile, Audio, useCurrentFrame, Video, Easing, random } from 'remotion';
|
| 3 |
import React, { useEffect, useState } from 'react'
|
| 4 |
import { loadFont } from "@remotion/google-fonts/MontserratAlternates";
|
| 5 |
import { Series, Sequence } from "remotion";
|
|
|
|
| 10 |
import ExcitedSubtitles from '../subtitles/excited_Subtitles';
|
| 11 |
import _ from 'lodash';
|
| 12 |
import './styles.module.css'
|
| 13 |
+
import TransitionSeries from 'remotion-transition-series';
|
| 14 |
+
import { CircularWipe } from '../../anims/CircularWipe';
|
| 15 |
+
import { LinearWipe } from '../../anims/LinearWipe';
|
| 16 |
+
import { Slide } from '../../anims/Slide';
|
| 17 |
+
import { Pan } from '../../anims/Pan';
|
| 18 |
+
import { Dissolve } from '../../anims/Dissolve';
|
| 19 |
+
import { SlidingDoors } from '../../anims/SlidingDoors';
|
| 20 |
+
import { Plate } from '../../anims/Plate';
|
| 21 |
+
import { GlowingStroke } from '../../anims/GlowingStrike';
|
| 22 |
+
import { IGMediaRender } from './IGMediaRender';
|
| 23 |
+
import { Group } from './Types';
|
| 24 |
+
|
| 25 |
+
export type DisplayMedia = SectionMedia &
|
| 26 |
+
{ idx: number, durationFrames: number, startFrame: number, endFrame: number, }
|
| 27 |
|
| 28 |
export const IGScene: React.FC<any> = (props: {
|
| 29 |
script: any,
|
|
|
|
| 113 |
|
| 114 |
let curSecond: Number = frame / fps
|
| 115 |
let word = findCurrentWord(curSecond, subtitles)
|
| 116 |
+
let group: Group = findCurrentGroupByTime(curSecond, groups)
|
| 117 |
|
| 118 |
+
let currentDisplayMedia: DisplayMedia = (item?.imageAbsPaths || [])[0]
|
|
|
|
| 119 |
let transitioning = false
|
| 120 |
|
| 121 |
if (!_.isEmpty(item?.imageAbsPaths)) {
|
|
|
|
| 131 |
media.endFrame = frameOffest + media.durationFrames
|
| 132 |
frameOffest = frameOffest + media.durationFrames
|
| 133 |
if (frame > media.startFrame && frame < media.endFrame) {
|
| 134 |
+
currentDisplayMedia = media
|
| 135 |
}
|
| 136 |
}
|
| 137 |
|
| 138 |
}
|
| 139 |
|
|
|
|
| 140 |
let audioPath = RenderUtils.getFileName(item?.audioFullPath)
|
| 141 |
|
| 142 |
let transition = {
|
|
|
|
| 145 |
durationFrames: 2 * fps,
|
| 146 |
}
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
+
function randomElement<T>(arr: T[], seed: number): T {
|
| 150 |
+
let i = Math.floor(random(seed) * arr.length)
|
| 151 |
+
let rand = arr[i];
|
| 152 |
+
return rand
|
| 153 |
+
}
|
|
|
|
| 154 |
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
+
let chunks = (item?.imageAbsPaths?.map((displayMedia: DisplayMedia, i) => {
|
| 158 |
+
let chunk = []
|
| 159 |
+
let easeInOutExp = Easing.inOut(Easing.bezier(0.8, 0.22, 0.96, 0.65));
|
| 160 |
+
easeInOutExp = Easing.ease
|
| 161 |
+
let curZoom = 1 + 0.3 * (frame - displayMedia?.startFrame) / (displayMedia?.durationFrames || 1)
|
| 162 |
+
console.log(`[${frame}]`, 'image zoon', curZoom, [displayMedia?.startFrame, displayMedia?.endFrame])
|
| 163 |
+
chunk.push((
|
| 164 |
+
<TransitionSeries.Sequence durationInFrames={displayMedia.durationFrames}>
|
| 165 |
+
<IGMediaRender curZoom={curZoom} displayMedia={displayMedia} />
|
| 166 |
+
</TransitionSeries.Sequence>
|
| 167 |
+
))
|
| 168 |
+
if (i < item?.imageAbsPaths.length - 1) {
|
| 169 |
+
let anims = [CircularWipe, Slide, SlidingDoors, Pan, LinearWipe, Dissolve, CircularWipe, Slide, SlidingDoors, Pan, LinearWipe, Dissolve]
|
| 170 |
+
// .fill(CircularWipe)
|
| 171 |
+
let Anim = anims[frame % 9]
|
| 172 |
+
let seed = i * displayMedia.idx
|
| 173 |
+
Anim = randomElement(anims, `x-${seed}`)
|
| 174 |
+
const easeInOutExp = Easing.inOut(Easing.bezier(0.8, 0.22, 0.96, 0.65));
|
| 175 |
+
chunk.push((
|
| 176 |
+
<TransitionSeries.Transition
|
| 177 |
+
durationInFrames={30}
|
| 178 |
+
transitionComponent={({ progress, ...props }) => {
|
| 179 |
+
return (
|
| 180 |
+
<Anim {...props} progress={easeInOutExp(progress)} />
|
| 181 |
+
)
|
| 182 |
+
}}
|
| 183 |
+
/>
|
| 184 |
+
))
|
| 185 |
+
}
|
| 186 |
+
return chunk
|
| 187 |
+
}))
|
| 188 |
+
return (
|
| 189 |
+
<AbsoluteFill className='relative'>
|
| 190 |
+
<Audio volume={1} src={staticFile(audioPath)} />
|
| 191 |
+
<TransitionSeries>
|
| 192 |
+
{
|
| 193 |
+
...chunks
|
| 194 |
+
}
|
| 195 |
|
| 196 |
+
</TransitionSeries>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
|
|
|
|
|
|
|
|
|
|
| 199 |
<div className='absolute inset-0'>
|
| 200 |
<ExcitedSubtitles position='center' group={group} word={word} />
|
| 201 |
</div>
|
|
|
|
| 203 |
);
|
| 204 |
};
|
| 205 |
|
| 206 |
+
|
| 207 |
function splitWordsIntoGroups(words) {
|
| 208 |
const groups = [];
|
| 209 |
let currentGroup = [];
|
src/textWithBgImage/SemibitComposition.tsx
CHANGED
|
@@ -157,13 +157,12 @@ export const SemibitComposition: React.FC = () => {
|
|
| 157 |
fps={fps}
|
| 158 |
width={Script.meta?.resolution?.width || 1920}
|
| 159 |
height={Script.meta?.resolution?.height || 1080}
|
| 160 |
-
defaultProps={{
|
| 161 |
bgMusic: RenderUtils.getFileName(Script.bgMusic, "mp3"),
|
| 162 |
contents: contents,
|
| 163 |
intro: intro,
|
| 164 |
-
outro: outro
|
| 165 |
-
|
| 166 |
-
}}
|
| 167 |
/>
|
| 168 |
|
| 169 |
<Still
|
|
|
|
| 157 |
fps={fps}
|
| 158 |
width={Script.meta?.resolution?.width || 1920}
|
| 159 |
height={Script.meta?.resolution?.height || 1080}
|
| 160 |
+
defaultProps={Object.assign(Script, {
|
| 161 |
bgMusic: RenderUtils.getFileName(Script.bgMusic, "mp3"),
|
| 162 |
contents: contents,
|
| 163 |
intro: intro,
|
| 164 |
+
outro: outro
|
| 165 |
+
})}
|
|
|
|
| 166 |
/>
|
| 167 |
|
| 168 |
<Still
|