Skip to content

Compositions

A composition is the top-level container for a video. It defines the video's dimensions, frame rate, and duration.

Defining a Composition

jsx
import { Composition } from 'framely';
import { MyVideo } from './MyVideo';

export function Root() {
  return (
    <Composition
      id="my-video"
      component={MyVideo}
      width={1920}
      height={1080}
      fps={30}
      durationInFrames={150}
    />
  );
}

Props

PropTypeDescription
idstringUnique identifier for the composition
componentReact.FCThe component to render
widthnumberVideo width in pixels
heightnumberVideo height in pixels
fpsnumberFrames per second
durationInFramesnumberTotal number of frames
defaultPropsobjectDefault props passed to the component

Multiple Compositions

You can define multiple compositions in a single project:

jsx
export function Root() {
  return (
    <>
      <Composition id="intro" component={Intro} width={1920} height={1080} fps={30} durationInFrames={90} />
      <Composition id="main" component={Main} width={1920} height={1080} fps={30} durationInFrames={300} />
      <Composition id="outro" component={Outro} width={1920} height={1080} fps={30} durationInFrames={60} />
    </>
  );
}

Each composition appears in the studio sidebar and can be rendered independently.

Released under the MIT License.