@revideo/create 0.5.11-beta.1104 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/avatar-with-background/package.json +7 -14
- package/examples/avatar-with-background/src/{scenes/example.tsx → project.tsx} +19 -3
- package/examples/avatar-with-background/src/render.ts +4 -3
- package/examples/avatar-with-background/tsconfig.json +2 -1
- package/examples/default/package.json +6 -6
- package/examples/default/src/project.tsx +2 -2
- package/examples/github-stars-celebration/package.json +7 -11
- package/examples/github-stars-celebration/src/{scenes/example.tsx → project.tsx} +24 -4
- package/examples/github-stars-celebration/src/render.ts +1 -1
- package/examples/github-stars-celebration/tsconfig.json +2 -1
- package/examples/marketing-templates/marketing-template/README.md +19 -0
- package/examples/marketing-templates/marketing-template/package.json +7 -11
- package/examples/marketing-templates/marketing-template/src/{scenes/example.tsx → project.tsx} +23 -3
- package/examples/marketing-templates/marketing-template/src/render.ts +1 -1
- package/examples/marketing-templates/marketing-template/tsconfig.json +2 -1
- package/examples/marketing-templates/multiple-videos-in-one/README.md +19 -0
- package/examples/marketing-templates/multiple-videos-in-one/package.json +7 -11
- package/examples/marketing-templates/multiple-videos-in-one/src/{scenes/example.tsx → project.tsx} +21 -3
- package/examples/marketing-templates/multiple-videos-in-one/src/render.ts +1 -1
- package/examples/marketing-templates/multiple-videos-in-one/tsconfig.json +2 -1
- package/examples/minimal-drag-drop/README.md +14 -18
- package/examples/minimal-drag-drop/{next/app → app}/page.tsx +51 -39
- package/examples/minimal-drag-drop/{next/next-env.d.ts → next-env.d.ts} +1 -1
- package/examples/minimal-drag-drop/{next/package.json → package.json} +9 -4
- package/examples/minimal-drag-drop/revideo/project.tsx +54 -0
- package/examples/parallelized-aws-lambda/Dockerfile +0 -2
- package/examples/parallelized-aws-lambda/README.md +331 -100
- package/examples/parallelized-aws-lambda/revideo-project/package.json +9 -11
- package/examples/parallelized-aws-lambda/revideo-project/src/lambda.ts +2 -3
- package/examples/parallelized-aws-lambda/revideo-project/src/{scenes/example.tsx → project.tsx} +9 -5
- package/examples/parallelized-aws-lambda/revideo-project/src/render.ts +1 -1
- package/examples/parallelized-aws-lambda/revideo-project/tsconfig.json +1 -0
- package/examples/rive-explanation-video/README.md +0 -3
- package/examples/rive-explanation-video/package.json +8 -12
- package/examples/rive-explanation-video/src/project.tsx +234 -0
- package/examples/rive-explanation-video/src/render.ts +1 -1
- package/examples/rive-explanation-video/tsconfig.json +2 -1
- package/examples/saas-template/package.json +39 -39
- package/examples/stitching-videos/README.md +15 -3
- package/examples/stitching-videos/package.json +7 -10
- package/examples/stitching-videos/src/{scenes/example.tsx → project.tsx} +36 -3
- package/examples/stitching-videos/src/render.ts +4 -16
- package/examples/stitching-videos/tsconfig.json +2 -1
- package/examples/three-js-example/package.json +10 -13
- package/examples/three-js-example/src/project.tsx +105 -0
- package/examples/three-js-example/src/render.ts +1 -1
- package/examples/three-js-example/tsconfig.json +2 -1
- package/examples/youtube-shorts/README.md +14 -60
- package/examples/youtube-shorts/package.json +8 -12
- package/examples/youtube-shorts/src/{scenes/example.tsx → project.tsx} +20 -3
- package/examples/youtube-shorts/src/render.ts +11 -8
- package/examples/youtube-shorts/src/utils.ts +1 -1
- package/examples/youtube-shorts/tsconfig.json +2 -1
- package/index.js +2 -26
- package/package.json +9 -9
- package/examples/avatar-with-background/src/project.meta +0 -31
- package/examples/avatar-with-background/src/project.ts +0 -6
- package/examples/avatar-with-background/src/revideo.d.ts +0 -1
- package/examples/avatar-with-background/src/scenes/example.meta +0 -5
- package/examples/avatar-with-background/vite.config.ts +0 -8
- package/examples/github-stars-celebration/src/project.meta +0 -28
- package/examples/github-stars-celebration/src/project.ts +0 -8
- package/examples/github-stars-celebration/src/revideo.d.ts +0 -1
- package/examples/github-stars-celebration/src/scenes/example.meta +0 -5
- package/examples/github-stars-celebration/vite.config.ts +0 -8
- package/examples/google-cloud-run-parallelized/README.md +0 -127
- package/examples/google-cloud-run-parallelized/render-orchestrator/Dockerfile +0 -56
- package/examples/google-cloud-run-parallelized/render-orchestrator/package.json +0 -22
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/index.ts +0 -72
- package/examples/google-cloud-run-parallelized/render-orchestrator/src/revideo.d.ts +0 -1
- package/examples/google-cloud-run-parallelized/render-orchestrator/tsconfig.json +0 -10
- package/examples/google-cloud-run-parallelized/render-worker/.gcloudignore +0 -17
- package/examples/google-cloud-run-parallelized/render-worker/.puppeteerrc.cjs +0 -9
- package/examples/google-cloud-run-parallelized/render-worker/package.json +0 -30
- package/examples/google-cloud-run-parallelized/render-worker/src/index.ts +0 -45
- package/examples/google-cloud-run-parallelized/render-worker/src/project.meta +0 -31
- package/examples/google-cloud-run-parallelized/render-worker/src/project.ts +0 -6
- package/examples/google-cloud-run-parallelized/render-worker/src/render.ts +0 -14
- package/examples/google-cloud-run-parallelized/render-worker/src/revideo.d.ts +0 -1
- package/examples/google-cloud-run-parallelized/render-worker/src/scenes/example.tsx +0 -30
- package/examples/google-cloud-run-parallelized/render-worker/tsconfig.json +0 -13
- package/examples/google-cloud-run-parallelized/render-worker/vite.config.ts +0 -9
- package/examples/marketing-templates/marketing-template/src/globals.css +0 -0
- package/examples/marketing-templates/marketing-template/src/project.meta +0 -28
- package/examples/marketing-templates/marketing-template/src/project.ts +0 -9
- package/examples/marketing-templates/marketing-template/src/revideo.d.ts +0 -1
- package/examples/marketing-templates/marketing-template/src/scenes/example.meta +0 -5
- package/examples/marketing-templates/marketing-template/vite.config.ts +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/src/project.meta +0 -28
- package/examples/marketing-templates/multiple-videos-in-one/src/project.ts +0 -9
- package/examples/marketing-templates/multiple-videos-in-one/src/revideo.d.ts +0 -1
- package/examples/marketing-templates/multiple-videos-in-one/src/scenes/example.meta +0 -5
- package/examples/marketing-templates/multiple-videos-in-one/vite.config.ts +0 -9
- package/examples/minimal-drag-drop/next/package-lock.json +0 -5577
- package/examples/minimal-drag-drop/next/public/favicon.ico +0 -0
- package/examples/minimal-drag-drop/next/public/next.svg +0 -1
- package/examples/minimal-drag-drop/next/public/vercel.svg +0 -1
- package/examples/minimal-drag-drop/revideo/package-lock.json +0 -3771
- package/examples/minimal-drag-drop/revideo/package.json +0 -24
- package/examples/minimal-drag-drop/revideo/src/project.meta +0 -28
- package/examples/minimal-drag-drop/revideo/src/project.ts +0 -9
- package/examples/minimal-drag-drop/revideo/src/render.ts +0 -15
- package/examples/minimal-drag-drop/revideo/src/revideo.d.ts +0 -1
- package/examples/minimal-drag-drop/revideo/src/scenes/example.meta +0 -5
- package/examples/minimal-drag-drop/revideo/src/scenes/example.tsx +0 -44
- package/examples/minimal-drag-drop/revideo/tsconfig.json +0 -9
- package/examples/minimal-drag-drop/revideo/vite.config.ts +0 -6
- package/examples/parallelized-aws-lambda/revideo-project/.puppeteerrc.cjs +0 -9
- package/examples/parallelized-aws-lambda/revideo-project/src/project.meta +0 -28
- package/examples/parallelized-aws-lambda/revideo-project/src/project.ts +0 -7
- package/examples/parallelized-aws-lambda/revideo-project/src/revideo.d.ts +0 -1
- package/examples/parallelized-aws-lambda/revideo-project/src/scenes/example.meta +0 -5
- package/examples/parallelized-aws-lambda/revideo-project/vite.config.ts +0 -9
- package/examples/reddit-post-video/README.md +0 -84
- package/examples/reddit-post-video/package-lock.json +0 -2941
- package/examples/reddit-post-video/package.json +0 -27
- package/examples/reddit-post-video/src/global.css +0 -1
- package/examples/reddit-post-video/src/metadata.json +0 -576
- package/examples/reddit-post-video/src/project.meta +0 -31
- package/examples/reddit-post-video/src/project.ts +0 -9
- package/examples/reddit-post-video/src/render.ts +0 -157
- package/examples/reddit-post-video/src/revideo.d.ts +0 -1
- package/examples/reddit-post-video/src/scenes/example.meta +0 -5
- package/examples/reddit-post-video/src/scenes/example.tsx +0 -74
- package/examples/reddit-post-video/tsconfig.json +0 -9
- package/examples/reddit-post-video/vite.config.ts +0 -6
- package/examples/rive-explanation-video/src/project.meta +0 -31
- package/examples/rive-explanation-video/src/project.ts +0 -8
- package/examples/rive-explanation-video/src/revideo.d.ts +0 -1
- package/examples/rive-explanation-video/src/scenes/example.meta +0 -5
- package/examples/rive-explanation-video/src/scenes/example.tsx +0 -218
- package/examples/rive-explanation-video/vite.config.ts +0 -8
- package/examples/stitching-videos/src/project.meta +0 -28
- package/examples/stitching-videos/src/project.ts +0 -20
- package/examples/stitching-videos/src/revideo.d.ts +0 -1
- package/examples/stitching-videos/vite.config.ts +0 -8
- package/examples/three-js-example/README.md +0 -8
- package/examples/three-js-example/src/project.meta +0 -31
- package/examples/three-js-example/src/project.ts +0 -8
- package/examples/three-js-example/src/revideo.d.ts +0 -1
- package/examples/three-js-example/src/scenes/basic3D.meta +0 -5
- package/examples/three-js-example/src/scenes/basic3D.tsx +0 -89
- package/examples/three-js-example/vite.config.ts +0 -6
- package/examples/youtube-shorts/src/project.meta +0 -28
- package/examples/youtube-shorts/src/project.ts +0 -9
- package/examples/youtube-shorts/src/revideo.d.ts +0 -1
- package/examples/youtube-shorts/vite.config.ts +0 -8
- /package/examples/minimal-drag-drop/{next/app → app}/api/render/route.ts +0 -0
- /package/examples/minimal-drag-drop/{next/app → app}/globals.css +0 -0
- /package/examples/minimal-drag-drop/{next/app → app}/layout.tsx +0 -0
- /package/examples/minimal-drag-drop/{next/next.config.mjs → next.config.mjs} +0 -0
- /package/examples/minimal-drag-drop/{next/postcss.config.js → postcss.config.js} +0 -0
- /package/examples/minimal-drag-drop/revideo/{src/global.css → global.css} +0 -0
- /package/examples/minimal-drag-drop/{next/tailwind.config.ts → tailwind.config.ts} +0 -0
- /package/examples/minimal-drag-drop/{next/tsconfig.json → tsconfig.json} +0 -0
- /package/examples/minimal-drag-drop/{next/utils → utils}/parse.ts +0 -0
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { createClient } from "@deepgram/sdk";
|
|
2
|
-
import { renderVideo } from "@revideo/renderer";
|
|
3
|
-
import axios from "axios";
|
|
4
|
-
import * as fs from "fs";
|
|
5
|
-
import yargs from "yargs";
|
|
6
|
-
import { hideBin } from "yargs/helpers";
|
|
7
|
-
|
|
8
|
-
export interface Word {
|
|
9
|
-
punctuated_word: string;
|
|
10
|
-
start: number;
|
|
11
|
-
end: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface MetaData {
|
|
15
|
-
audioFile: string;
|
|
16
|
-
text: Word[];
|
|
17
|
-
textColor: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const deepgramClient = createClient(
|
|
21
|
-
process.env.DEEPGRAM_API_KEY,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
async function getPostText(postUrl: string) {
|
|
25
|
-
const response = await axios.get(postUrl + ".json");
|
|
26
|
-
const responseData = response.data;
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
responseData[0].data.children[0].data.title +
|
|
30
|
-
".\n" +
|
|
31
|
-
responseData[0].data.children[0].data.selftext
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function voiceNameToId(voiceName: string): Promise<string | null> {
|
|
36
|
-
const url = "https://api.elevenlabs.io/v1/voices";
|
|
37
|
-
const headers = {
|
|
38
|
-
"Content-Type": "application/json",
|
|
39
|
-
"xi-api-key": process.env.ELEVEN_API_KEY,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
const response = await axios.get(url, { headers });
|
|
44
|
-
const voices = response.data.voices;
|
|
45
|
-
const voice = voices.find((v: any) => v.name === voiceName);
|
|
46
|
-
return voice ? voice.voice_id : null;
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error("Error fetching voices:", error);
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function textToSpeech(post: string, voiceId: string, modelId: string) {
|
|
54
|
-
const url = `https://api.elevenlabs.io/v1/text-to-speech/${voiceId}`;
|
|
55
|
-
const headers = {
|
|
56
|
-
"Content-Type": "application/json",
|
|
57
|
-
"xi-api-key": process.env.ELEVEN_API_KEY,
|
|
58
|
-
};
|
|
59
|
-
const data = {
|
|
60
|
-
model_id: modelId,
|
|
61
|
-
text: post,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
const response = await axios.post(url, data, {
|
|
66
|
-
headers,
|
|
67
|
-
responseType: "arraybuffer",
|
|
68
|
-
});
|
|
69
|
-
return response.data;
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.error("Error making text-to-speech request:", error);
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export async function speechToText(filePath: string) {
|
|
77
|
-
const { result } = await deepgramClient.listen.prerecorded.transcribeFile(
|
|
78
|
-
fs.readFileSync(filePath),
|
|
79
|
-
{
|
|
80
|
-
model: "nova-2",
|
|
81
|
-
smart_format: true,
|
|
82
|
-
},
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function main() {
|
|
89
|
-
const argv = await yargs(hideBin(process.argv)).options({
|
|
90
|
-
voice: {
|
|
91
|
-
alias: "v",
|
|
92
|
-
describe: "The name of the eleven labs voice to use",
|
|
93
|
-
type: "string",
|
|
94
|
-
default: "Sarah",
|
|
95
|
-
},
|
|
96
|
-
post: {
|
|
97
|
-
alias: "p",
|
|
98
|
-
describe: "The Reddit post URL",
|
|
99
|
-
type: "string",
|
|
100
|
-
default:
|
|
101
|
-
"https://www.reddit.com/r/TrueOffMyChest/comments/1bllfgk/i_hate_having_old_parents/",
|
|
102
|
-
},
|
|
103
|
-
textcolor: {
|
|
104
|
-
alias: "c",
|
|
105
|
-
describe: "color of the text",
|
|
106
|
-
type: "string",
|
|
107
|
-
default: "red",
|
|
108
|
-
},
|
|
109
|
-
onlyMetadata: {
|
|
110
|
-
alias: "m",
|
|
111
|
-
describe: "only save metadata and do not render the video",
|
|
112
|
-
type: "boolean",
|
|
113
|
-
default: false,
|
|
114
|
-
},
|
|
115
|
-
}).argv;
|
|
116
|
-
|
|
117
|
-
const url = argv.post;
|
|
118
|
-
const voiceName = argv.voice;
|
|
119
|
-
const textColor = argv.textcolor;
|
|
120
|
-
|
|
121
|
-
const post = await getPostText(url);
|
|
122
|
-
const voiceId = await voiceNameToId(voiceName);
|
|
123
|
-
const ttsRes = await textToSpeech(post, voiceId, "eleven_multilingual_v2");
|
|
124
|
-
|
|
125
|
-
await fs.writeFileSync("./output/audio.wav", ttsRes);
|
|
126
|
-
|
|
127
|
-
const transcriptionResponse = await speechToText("./output/audio.wav");
|
|
128
|
-
const words =
|
|
129
|
-
transcriptionResponse.results.channels[0].alternatives[0].words.map(
|
|
130
|
-
(word: any) => ({
|
|
131
|
-
punctuated_word: word.punctuated_word,
|
|
132
|
-
start: word.start,
|
|
133
|
-
end: word.end,
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const metaData: MetaData = {
|
|
138
|
-
audioFile: "./output/audio.wav",
|
|
139
|
-
text: words,
|
|
140
|
-
textColor: textColor,
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
fs.writeFileSync("./metadata.json", JSON.stringify(metaData, null, 2));
|
|
144
|
-
console.log("saved metadata to ./metadata.json");
|
|
145
|
-
|
|
146
|
-
if (!argv.onlyMetadata) {
|
|
147
|
-
const file = renderVideo({
|
|
148
|
-
projectFile: "./vite.config.ts",
|
|
149
|
-
variables: { data: metaData },
|
|
150
|
-
settings: { logProgress: true }
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
console.log(`rendered video to ${file}`)
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
main();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Audio, Txt, Video, View2D, makeScene2D } from "@revideo/2d";
|
|
2
|
-
import { createRef, useScene, waitFor } from "@revideo/core";
|
|
3
|
-
import { MetaData, Word } from "../render";
|
|
4
|
-
|
|
5
|
-
export default makeScene2D(function* (view) {
|
|
6
|
-
const videoRef = createRef<Video>();
|
|
7
|
-
const data: MetaData = useScene().variables.get("data", {
|
|
8
|
-
audioFile: "hi",
|
|
9
|
-
text: [],
|
|
10
|
-
textColor: "red",
|
|
11
|
-
})();
|
|
12
|
-
|
|
13
|
-
yield view.add(
|
|
14
|
-
<>
|
|
15
|
-
<Video
|
|
16
|
-
ref={videoRef}
|
|
17
|
-
volume={0}
|
|
18
|
-
src={"https://revideo-example-assets.s3.amazonaws.com/minecraft.mp4"}
|
|
19
|
-
play={true}
|
|
20
|
-
size={"100%"}
|
|
21
|
-
/>
|
|
22
|
-
<Audio src={data.audioFile} play={true} />
|
|
23
|
-
</>,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
let waitBefore = data.text[0].start;
|
|
27
|
-
|
|
28
|
-
for (let i = 0; i < data.text.length; i++) {
|
|
29
|
-
const currentClip = data.text[i];
|
|
30
|
-
const nextClipStart =
|
|
31
|
-
i < data.text.length - 1 ? data.text[i + 1].start : null;
|
|
32
|
-
const isLastClip = i === data.text.length - 1;
|
|
33
|
-
const waitAfter = isLastClip ? 1 : 0;
|
|
34
|
-
yield* displayTextClip(
|
|
35
|
-
currentClip,
|
|
36
|
-
waitBefore,
|
|
37
|
-
waitAfter,
|
|
38
|
-
view,
|
|
39
|
-
data.textColor,
|
|
40
|
-
);
|
|
41
|
-
waitBefore = nextClipStart !== null ? nextClipStart - currentClip.end : 0;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function* displayTextClip(
|
|
46
|
-
textClip: Word,
|
|
47
|
-
waitBefore: number,
|
|
48
|
-
waitAfter: number,
|
|
49
|
-
view: View2D,
|
|
50
|
-
textColor: string,
|
|
51
|
-
) {
|
|
52
|
-
const textRef = createRef<Txt>();
|
|
53
|
-
yield* waitFor(waitBefore);
|
|
54
|
-
view.add(
|
|
55
|
-
<Txt
|
|
56
|
-
fontSize={100}
|
|
57
|
-
fontWeight={800}
|
|
58
|
-
ref={textRef}
|
|
59
|
-
fontFamily={"Raleway"}
|
|
60
|
-
textWrap={true}
|
|
61
|
-
textAlign={"center"}
|
|
62
|
-
fill={textColor}
|
|
63
|
-
width={"70%"}
|
|
64
|
-
lineWidth={2}
|
|
65
|
-
shadowOffset={10}
|
|
66
|
-
shadowBlur={30}
|
|
67
|
-
shadowColor={"black"}
|
|
68
|
-
>
|
|
69
|
-
{textClip.punctuated_word}
|
|
70
|
-
</Txt>,
|
|
71
|
-
);
|
|
72
|
-
yield* waitFor(textClip.end - textClip.start + waitAfter);
|
|
73
|
-
textRef().remove();
|
|
74
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 0,
|
|
3
|
-
"shared": {
|
|
4
|
-
"background": "rgb(255,255,255)",
|
|
5
|
-
"range": [
|
|
6
|
-
0,
|
|
7
|
-
null
|
|
8
|
-
],
|
|
9
|
-
"size": {
|
|
10
|
-
"x": 1920,
|
|
11
|
-
"y": 1080
|
|
12
|
-
},
|
|
13
|
-
"audioOffset": 0
|
|
14
|
-
},
|
|
15
|
-
"preview": {
|
|
16
|
-
"fps": 30,
|
|
17
|
-
"resolutionScale": 1
|
|
18
|
-
},
|
|
19
|
-
"rendering": {
|
|
20
|
-
"fps": 30,
|
|
21
|
-
"resolutionScale": 1,
|
|
22
|
-
"colorSpace": "srgb",
|
|
23
|
-
"exporter": {
|
|
24
|
-
"name": "@revideo/core/wasm",
|
|
25
|
-
"options": {
|
|
26
|
-
"fastStart": true,
|
|
27
|
-
"includeAudio": true
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { waitFor, createRef, all, Reference, chain } from '@revideo/core';
|
|
2
|
-
import {
|
|
3
|
-
Img,
|
|
4
|
-
makeScene2D,
|
|
5
|
-
Rive,
|
|
6
|
-
Txt,
|
|
7
|
-
Layout,
|
|
8
|
-
LezerHighlighter, Code, word, lines, Rect,
|
|
9
|
-
View2D
|
|
10
|
-
} from '@revideo/2d';
|
|
11
|
-
import {parser} from '@lezer/javascript';
|
|
12
|
-
import {tags} from '@lezer/highlight';
|
|
13
|
-
import {HighlightStyle} from '@codemirror/language';
|
|
14
|
-
|
|
15
|
-
const MyStyle = HighlightStyle.define([
|
|
16
|
-
{
|
|
17
|
-
tag: tags.comment,
|
|
18
|
-
color: '#8E908C',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
tag: [tags.variableName, tags.self, tags.propertyName, tags.attributeName, tags.regexp],
|
|
22
|
-
color: '#C82829',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
tag: [tags.number, tags.bool, tags.null],
|
|
26
|
-
color: '#F5871F',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
tag: [tags.className, tags.typeName, tags.definition(tags.typeName)],
|
|
30
|
-
color: '#C99E00',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
tag: [tags.string, tags.special(tags.brace)],
|
|
34
|
-
color: '#718C00',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
tag: tags.operator,
|
|
38
|
-
color: '#3E999F',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
tag: [tags.definition(tags.propertyName), tags.function(tags.variableName)],
|
|
42
|
-
color: '#4271AE',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
tag: tags.keyword,
|
|
46
|
-
color: '#8959A8',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
tag: tags.derefOperator,
|
|
50
|
-
color: '#4D4D4C',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
tag: tags.bracket,
|
|
54
|
-
color: "grey"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
tag: tags.separator,
|
|
58
|
-
color: "grey"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
tag: tags.punctuation,
|
|
62
|
-
color: "grey"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
tag: tags.typeOperator,
|
|
66
|
-
color: "grey"
|
|
67
|
-
}
|
|
68
|
-
]);
|
|
69
|
-
|
|
70
|
-
Code.defaultHighlighter = new LezerHighlighter(
|
|
71
|
-
parser.configure({
|
|
72
|
-
dialect: 'jsx ts',
|
|
73
|
-
}),
|
|
74
|
-
MyStyle
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export default makeScene2D(function* (view) {
|
|
79
|
-
|
|
80
|
-
const textRef = createRef<Txt>();
|
|
81
|
-
view.add(
|
|
82
|
-
<Txt fontFamily={"Lexend"} fontSize={100} fontWeight={600} ref={textRef}/>
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
yield* all(textRef().text("Rive Animations in Revideo", 1.25))
|
|
86
|
-
yield* all(
|
|
87
|
-
textRef().scale(0.75, 0.75),
|
|
88
|
-
textRef().position.y(-400, 0.75)
|
|
89
|
-
)
|
|
90
|
-
yield* waitFor(0.25);
|
|
91
|
-
|
|
92
|
-
const codeRef= createRef<Code>();
|
|
93
|
-
const videoBoxRef = createRef<Layout>();
|
|
94
|
-
view.add(<Layout opacity={0} position={[550, 100]} size={[600, 600]} ref={videoBoxRef} />);
|
|
95
|
-
view.add(
|
|
96
|
-
<Code
|
|
97
|
-
ref={codeRef}
|
|
98
|
-
textAlign={"left"}
|
|
99
|
-
fontSize={35}
|
|
100
|
-
x={-400}
|
|
101
|
-
y={100}
|
|
102
|
-
opacity={0}
|
|
103
|
-
fontFamily={'JetBrains Mono, monospace'}
|
|
104
|
-
code={
|
|
105
|
-
`export default makeScene2D(function* (view){
|
|
106
|
-
yield view.add(
|
|
107
|
-
<Img
|
|
108
|
-
src={"/sf.png"}
|
|
109
|
-
size={["100%", "100%"]}
|
|
110
|
-
/>
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
});
|
|
114
|
-
`
|
|
115
|
-
}/>);
|
|
116
|
-
|
|
117
|
-
videoBoxRef().add(
|
|
118
|
-
<Img
|
|
119
|
-
src={"https://revideo-example-assets.s3.amazonaws.com/sf.png"}
|
|
120
|
-
size={[videoBoxRef().width(), videoBoxRef().height()]}
|
|
121
|
-
/>
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
yield* all(
|
|
125
|
-
codeRef().opacity(1, 0.75),
|
|
126
|
-
videoBoxRef().opacity(1, 0.75)
|
|
127
|
-
);
|
|
128
|
-
yield* waitFor(0.5);
|
|
129
|
-
|
|
130
|
-
const riveRef = createRef<Rive>();
|
|
131
|
-
videoBoxRef().add(
|
|
132
|
-
<Rive
|
|
133
|
-
src={"https://revideo-example-assets.s3.amazonaws.com/emoji.riv"}
|
|
134
|
-
animationId={1}
|
|
135
|
-
size={[600, 600]}
|
|
136
|
-
opacity={0}
|
|
137
|
-
ref={riveRef}
|
|
138
|
-
/>
|
|
139
|
-
);
|
|
140
|
-
yield* all(codeRef().code.insert([8, 0],
|
|
141
|
-
`\n yield view.add(
|
|
142
|
-
<Rive
|
|
143
|
-
src={"/emoji.riv"}
|
|
144
|
-
animationId={1}
|
|
145
|
-
size={[600, 600]}
|
|
146
|
-
/>
|
|
147
|
-
);\n`, 1),
|
|
148
|
-
riveRef().opacity(1, 1)
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
yield* waitFor(1);
|
|
152
|
-
|
|
153
|
-
yield* codeRef().selection(lines(11, 13), 1),
|
|
154
|
-
yield replaceRive(videoBoxRef, riveRef)
|
|
155
|
-
yield* all(
|
|
156
|
-
codeRef().code.replace(word(11, 17, 5), "dog", 2),
|
|
157
|
-
codeRef().code.replace(word(13, 17, 3), "900", 2),
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
yield* codeRef().selection(lines(0, 17), 1);
|
|
161
|
-
|
|
162
|
-
yield* waitFor(1);
|
|
163
|
-
yield* all(
|
|
164
|
-
codeRef().opacity(0, 1),
|
|
165
|
-
videoBoxRef().opacity(0, 1),
|
|
166
|
-
textRef().opacity(0, 1)
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
yield* waitFor(0.5);
|
|
170
|
-
yield* logoAnimation(view);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
function* replaceRive(box: Reference<Layout>, rive: Reference<Rive>){
|
|
174
|
-
yield* rive().opacity(0, 1);
|
|
175
|
-
rive().remove();
|
|
176
|
-
|
|
177
|
-
const riveRef = createRef<Rive>();
|
|
178
|
-
box().add(
|
|
179
|
-
<Rive
|
|
180
|
-
src={"https://revideo-example-assets.s3.amazonaws.com/dog.riv"}
|
|
181
|
-
size={[1000, 600]}
|
|
182
|
-
opacity={0}
|
|
183
|
-
animationId={1}
|
|
184
|
-
ref={riveRef}
|
|
185
|
-
/>
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
yield* riveRef().opacity(1, 1);
|
|
189
|
-
yield* waitFor(5);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function* logoAnimation(view: View2D){
|
|
193
|
-
const block1 = createRef<Rect>()
|
|
194
|
-
const block2 = createRef<Rect>()
|
|
195
|
-
const block3 = createRef<Rect>()
|
|
196
|
-
const blocks = createRef<Layout>();
|
|
197
|
-
const logoText = createRef<Txt>();
|
|
198
|
-
view.add(
|
|
199
|
-
<>
|
|
200
|
-
<Layout ref={blocks} x={-600}>
|
|
201
|
-
<Rect fill={"#151515"} height={60} y={-80} x={-620} width={180} radius={9.3} ref={block1} />
|
|
202
|
-
<Rect fill={"#151515"} height={60} width={180} x={-540} radius={9.3} ref={block2} />
|
|
203
|
-
<Rect fill={"#151515"} height={60} width={180} x={-460} y={80} radius={9.3} ref={block3} />
|
|
204
|
-
<Txt ref={logoText} fontFamily={"Lexend"} x={53+757.5} y={20} fontSize={300} letterSpacing={-4} fontWeight={700} text={""}/>
|
|
205
|
-
</Layout>
|
|
206
|
-
</>
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
yield* all(
|
|
210
|
-
block1().position.x(-80, 0.5),
|
|
211
|
-
chain(waitFor(0.1), block2().position.x(0, 0.4)),
|
|
212
|
-
chain(waitFor(0.2), block3().position.x(80, 0.3)),
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
yield* logoText().text("revideo", 1);
|
|
216
|
-
|
|
217
|
-
yield* waitFor(1);
|
|
218
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 0,
|
|
3
|
-
"shared": {
|
|
4
|
-
"background": "rgb(0,0,0)",
|
|
5
|
-
"range": [
|
|
6
|
-
0,
|
|
7
|
-
null
|
|
8
|
-
],
|
|
9
|
-
"size": {
|
|
10
|
-
"x": 1920,
|
|
11
|
-
"y": 1080
|
|
12
|
-
},
|
|
13
|
-
"audioOffset": 0
|
|
14
|
-
},
|
|
15
|
-
"preview": {
|
|
16
|
-
"fps": 30,
|
|
17
|
-
"resolutionScale": 1
|
|
18
|
-
},
|
|
19
|
-
"rendering": {
|
|
20
|
-
"fps": 30,
|
|
21
|
-
"resolutionScale": 1,
|
|
22
|
-
"colorSpace": "srgb",
|
|
23
|
-
"exporter": {
|
|
24
|
-
"name": "@revideo/core/wasm",
|
|
25
|
-
"options": {}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {makeProject} from '@revideo/core';
|
|
2
|
-
import example from './scenes/example?scene';
|
|
3
|
-
|
|
4
|
-
export default makeProject({
|
|
5
|
-
scenes: [example],
|
|
6
|
-
variables: {
|
|
7
|
-
videos: [
|
|
8
|
-
{
|
|
9
|
-
src: "https://revideo-example-assets.s3.amazonaws.com/beach-3.mp4",
|
|
10
|
-
start: 1,
|
|
11
|
-
duration: 6
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
src: "https://revideo-example-assets.s3.amazonaws.com/beach-2.mp4",
|
|
15
|
-
start: 2,
|
|
16
|
-
duration: 10
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# 3D Animations with Three JS
|
|
2
|
-
|
|
3
|
-
This example project demonstrates how you can build render 3d animations with [three.js](https://threejs.org/) Revideo.
|
|
4
|
-
|
|
5
|
-
The animation itself in this project is not very complex - its main purpose is to demonstrate how you can use three.js together with Revideo and make use of concepts such as [tweening](https://docs.re.video/tweening/) in 3D.
|
|
6
|
-
|
|
7
|
-
https://github.com/user-attachments/assets/41af8137-e16a-43b3-a3e1-01b9cc9b700b
|
|
8
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 0,
|
|
3
|
-
"shared": {
|
|
4
|
-
"background": "rgb(255,255,255)",
|
|
5
|
-
"range": [
|
|
6
|
-
0,
|
|
7
|
-
null
|
|
8
|
-
],
|
|
9
|
-
"size": {
|
|
10
|
-
"x": 1920,
|
|
11
|
-
"y": 1080
|
|
12
|
-
},
|
|
13
|
-
"audioOffset": 0
|
|
14
|
-
},
|
|
15
|
-
"preview": {
|
|
16
|
-
"fps": 30,
|
|
17
|
-
"resolutionScale": 1
|
|
18
|
-
},
|
|
19
|
-
"rendering": {
|
|
20
|
-
"fps": 60,
|
|
21
|
-
"resolutionScale": 1,
|
|
22
|
-
"colorSpace": "srgb",
|
|
23
|
-
"exporter": {
|
|
24
|
-
"name": "@revideo/core/wasm",
|
|
25
|
-
"options": {
|
|
26
|
-
"fastStart": true,
|
|
27
|
-
"includeAudio": true
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="@revideo/core/project" />
|