Quickstart
Last updated
Last updated
Let's install revideo with a sample project. To use revideo, make sure that you have version 16 or greater.
If you're on Linux, also make sure that you have nscd installed: sudo apt-get install nscd
. You need this package for .
Run the following command to create a new revideo project (If this fails, check out the section):
Now, select the default project, navigate to its folder and install all dependencies:
To preview your video in the editor, run:
The editor can now be accessed by visiting .
You can render your video by running:
This will call the ./src/render.ts
script in your code:
Alternatively, you can also render your video using the button in the editor that starts when you run npm run start
.
To render videos from the editor, simply click the "Render" Button:
For now, we can ignore all files in our revideo project except for src/scenes/example.tsx
, as this is where the visuals and audio of our video are defined. Let's walk through all the parts of the code that might confuse you, and provide explanations and references.
Our animation is defined within a generator function that is passed to makeScene2D
- this function describes the sequence of events happening in our video:
A few points about input arguments:
In both cases, src
refers to the file, which points to a remote url on the bucket. Alternatively, you can use local files by passing their path.
Passing size={["100%", "100%"]}
makes the video stretch to the full width and height of its canvas.
Adding play={true}
makes both media elements play immediately, instead of being in a paused state.
After adding our background video and audio, we execute
Lastly, we let the revideo logo spin into our video:
In our code, we use a reference to the revideo logo to later animate it. Particularly, we run the following commands:
scale(x, s)
: scales the size of the logo to x
times its original size, within n
seconds.
rotation(d, s)
: rotates the image by d
degrees within s
seconds
The flow of these animations is determined by the keywords chain and all. The former instructs revideo to play its input animations after one another, while the latter instructs revideo to play them simultaneously. As a result, we first see the revideo logo rotating around 360 degrees while growing to 40x its original size. After this is done, the logo still grows to 60x its original size.
For more information, check out the API reference.
Generator functions can return multiple values - when they are called, they will execute until they first encounter a yield
statement, and return the yielded value. Revideo renders animations by continually calling the generator function, which will yield frames that we can export. It is not neccessary to understand how this works exactly, but if you are interested, you can read about the animation flow in revideo .
At the start of our generator function, we add and tags to our view
, which will display them on the canvas. Other components you could add include or tags, or basic shapes like or . You can find the API for all components .
The function does - as the name suggests - nothing. It is particularly useful when waiting for media (like videos and audio) to play or when we want to have a still-standing image.
A few things happen here: First, we add the revideo logo as an to our canvas. We set its initial width to only 1% of the screen, as we want it to grow as the video plays. We also pass a through ref={logoRef}
, which we had initialized before. Like , references allow us to access and modify the behavior of elements after they've been initialized.
There was causing the above command to fail. It got fixed in version 8.15.1
. You can follow to update your npm. Alternatively, you can use the following command instead:
For more information view the .