### Create a New Revideo Project Source: https://github.com/midrender/docs/blob/main/src/content/guide/installation-and-setup.mdx Run this command in your terminal to initialize a new revideo project. It will guide you through the setup process. ```bash npm init @revideo@latest ``` -------------------------------- ### Navigate and Install Dependencies Source: https://github.com/midrender/docs/blob/main/src/content/guide/installation-and-setup.mdx After creating the project, navigate to the project directory and install all necessary dependencies using npm. ```bash cd npm install ``` -------------------------------- ### Install Revideo Player React Source: https://github.com/midrender/docs/blob/main/src/content/api-reference/player-react/player.mdx Install the @revideo/player-react package using npm. ```bash npm install @revideo/player-react ``` -------------------------------- ### Install Dependencies and Run Conversion Source: https://github.com/midrender/docs/blob/main/scripts/README.md Install project dependencies and then run the conversion script. This is typically done once for dependencies and then for the conversion process. ```bash npm install # Install dependencies (only needed once) npm run convert ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/midrender/docs/blob/main/scripts/__tests__/README.md Execute these commands from the `scripts` directory to install dependencies and run the conversion script tests. ```bash npm install # Install dependencies (only needed once) npm test # Run the tests ``` -------------------------------- ### Start the Revideo Editor Source: https://github.com/midrender/docs/blob/main/src/content/guide/installation-and-setup.mdx Run this command to start the revideo editor and preview your video in the browser. The editor will be accessible at http://localhost:9000/. ```bash npm start ``` -------------------------------- ### Docusaurus Header Example Source: https://github.com/midrender/docs/blob/main/scripts/README.md Example of a Docusaurus header configuration, including sidebar position and slug. ```mdx --- sidebar_position: 2 slug: /ffmpeg/concatenateMedia --- ``` -------------------------------- ### Install JavaScript Grammar Source: https://github.com/midrender/docs/blob/main/src/content/motion-canvas/code-animations.mdx Install the `@lezer/javascript` package to enable syntax highlighting for JavaScript code. ```bash npm i @lezer/javascript ``` -------------------------------- ### Serve Revideo Project with CLI Source: https://github.com/midrender/docs/blob/main/src/content/api-reference/player-react/player.mdx Start a local server to build and serve your Revideo project assets using the npx revideo serve command. ```bash npx revideo serve ``` -------------------------------- ### React Component Example Source: https://github.com/midrender/docs/blob/main/scripts/__tests__/fixtures/code-blocks.mdx A React component example in JSX format. Attributes like 'mode' are ignored. ```jsx function Component() { return
Hello World
; } ``` -------------------------------- ### Basic Video Rendering with Static Text Source: https://github.com/midrender/docs/blob/main/src/content/guide/parameterized-video.mdx A simple example demonstrating how to render a video with static text content using @revideo/2d. ```tsx import {Txt, makeScene2D} from '@revideo/2d'; import {useScene, createRef} from '@revideo/core'; export default makeScene2D(function* (view) { const textRef = createRef(); const name = 'new user'; view.add( Hello {name}! , ); yield* textRef().scale(30, 2); }); ``` -------------------------------- ### Serve Revideo Project Locally Source: https://github.com/midrender/docs/blob/main/src/content/guide/building-webapps/rendering-endpoint.mdx Use the Revideo CLI to deploy your project and start a local web server. The port parameter is optional; defaults to 4000. ```bash npx revideo serve --projectFile ./src/project.ts --port 3000 ``` -------------------------------- ### Simple Scene Hierarchy Example Source: https://github.com/midrender/docs/blob/main/src/content/motion-canvas/hierarchy.mdx Demonstrates a basic scene hierarchy using JSX syntax with Circle, Layout, Rect, and Txt nodes. ```tsx view.add( <> Hi , ); ``` -------------------------------- ### Example Project Structure Source: https://github.com/midrender/docs/blob/main/src/content/motion-canvas/transitions.mdx This is a typical project structure for a Motion Canvas project, showing the location of scene files and the main project configuration. ```tree my-animation/ └─ src/ ├─ scenes/ │ ├─ firstScene.tsx │ └─ secondScene.tsx └─ project.ts ``` -------------------------------- ### Setup and Animation of a 3D Scene with Three.js Source: https://github.com/midrender/docs/blob/main/src/content/guide/designing-animations/3d-animations-with-threejs.mdx This snippet demonstrates setting up a basic 3D scene using Three.js, including a rotating cube, and integrating it into a Revideo animation. It requires importing necessary modules from '@revideo/2d', '@revideo/core', and 'three'. ```tsx import {Three} from '../components/Three'; import {makeScene2D, Txt} from '@revideo/2d'; import { tween, waitFor, delay, createRef, all, chain, linear, } from '@revideo/core'; import * as THREE from 'three'; function setup3DScene() { const threeScene = new THREE.Scene(); const geometry = new THREE.BoxGeometry(0.2, 0.2, 0.2); const material = new THREE.MeshNormalMaterial(); const mesh = new THREE.Mesh(geometry, material); threeScene.add(mesh); const camera = new THREE.PerspectiveCamera(90); mesh.position.set(0, 0, 0); mesh.scale.set(1, 1, 1); camera.rotation.set(0, 0, 0); camera.position.set(0, 0, 0.5); return {threeScene, camera, mesh}; } export default makeScene2D(function* (view) { const {threeScene, camera, mesh} = setup3DScene(); const threeRef = createRef(); const txtRef = createRef(); yield view.add( <> , ); yield view.add( , ); yield* chain( txtRef().text('Revideo x 3D with Three.js', 1), all(txtRef().position.y(-300, 1), delay(0.5, threeRef().opacity(1, 0.5))), ); yield tween(4, value => { mesh.rotation.set(0, linear(value, 0, 2 * 3.14), 0); }); yield* waitFor(2); yield addRotatingCube(threeRef().scene(), 0.1, 0.3, -0.2, 0.1); yield addRotatingCube(threeRef().scene(), 0.1, -0.3, -0.2, 0.1); yield* waitFor(2); }); function* addRotatingCube( threeScene: THREE.Scene, size: number, x: number, y: number, z: number, ) { const geometry = new THREE.BoxGeometry(size, size, size); const material = new THREE.MeshNormalMaterial(); const mesh = new THREE.Mesh(geometry, material); mesh.position.set(x, y, z); mesh.scale.set(1, 1, 1); threeScene.add(mesh); yield* tween(4, value => { mesh.rotation.set(0, linear(value, 0, 2 * 3.14), 0); }); } ``` -------------------------------- ### Accessing Local Video in Scene Source: https://github.com/midrender/docs/blob/main/src/content/guide/project-structure.mdx Place local video files in the `/public` directory to access them within your scene. This example demonstrates adding a video from `/public/my-video.mp4` to the scene and playing it. ```tsx import {Video, makeScene2D} from '@revideo/2d'; import {waitFor} from '@revideo/core'; export default makeScene2D(function* (view) { yield view.add(