RVE LogoReact Video EditorDOCS
RVE SDK/Features/Shapes

Shapes

The Shapes panel and the ShapeItem — rectangles, ellipses, arcs, lines, particles, and paper, with gradients, shadows, and soft edges

The Shapes panel adds vector shapes to the canvas. A shape is a ShapeItem with type: 'shape'. The editor player and the browser export draw shapes the same way, so the export looks the same as the preview.

The Shapes panel

The panel shows four shapes: Rectangle, Ellipse, Arc, and Line. A click adds the shape at the playhead, in the centre of the canvas, on a new track. A new shape is 400×400 px and 90 frames long.

When you select a shape, the panel shows two tabs:

  • Style — the shape, the fill, the stroke, the shadow, and the settings of the shape kind.
  • Animate — the enter and exit animations and the keyframes.

To remove the panel from the sidebar, add 'shape' to the disabledPanels prop:

<ReactVideoEditor projectId="my-project" disabledPanels={['shape']} />

Shape kinds

The shape field selects the geometry. Its type is ShapeKind:

ValueDescriptionSettings field
'rectangle'A rectangle with an optional corner radius. This is the default if shape is not set.styles.borderRadius
'ellipse'An ellipse that fills the item box.—
'arc'A part of a ring.styles.arc
'line'An open or closed line through points.styles.line
'particles'Dots on one canvas that move into a shape.styles.particles
'paper'A procedural paper texture.styles.paper

The panel adds only rectangles, ellipses, arcs, and lines. Particles and paper shapes come from templates or from your own editorState.

Fill and gradients

styles.fill is a solid colour. styles.gradient replaces the fill with a linear or radial gradient. In the Style tab, the Fill type control has three options: Solid, Linear, and Radial.

A gradient has two or more colour stops:

interface ShapeGradientStop {
  color: string;
  offset: number; // The position on the gradient, from 0 to 100
}

Linear gradient (ShapeLinearGradient)

FieldTypeDescription
type'linear'The gradient type.
anglenumberThe angle, in degrees. 0 points up and 90 points right, the same as CSS linear-gradient().
stopsShapeGradientStop[]The colour stops.

Radial gradient (ShapeRadialGradient)

FieldTypeDescription
type'radial'The gradient type.
centreXnumberThe centre, in % of the shape width.
centreYnumberThe centre, in % of the shape height.
radiusnumberThe radius, in % of the shape width and height. The gradient is an ellipse.
stopsShapeGradientStop[]The colour stops. The offsets go from the centre (0) to the radius (100).

Old projects can keep a CSS linear-gradient() string in styles.gradient. The editor reads the string and writes the data form when you edit the gradient.

Stroke, corners, soft edge, and shadow

FieldTypeDescription
styles.strokestringThe stroke colour.
styles.strokeWidthnumberThe stroke width, in px. A line uses the stroke to draw the line.
styles.borderRadiusstringThe corner radius of a rectangle or a paper shape, for example '24px'.
styles.softEdgenumberThe blur of the shape edge, in px. 0 or no value gives a hard edge.
styles.dropShadowShapeShadowA blurred copy of the shape behind the shape.
styles.opacitynumberFrom 0 to 1.

ShapeShadow has these fields:

FieldTypeDescription
xnumberThe offset to the right, in px.
ynumberThe offset down, in px.
blurnumberThe blur, in px.
colorstringThe shadow colour.

Arc (ShapeArc)

An arc is a part of a ring in the item box. The fill or the gradient colours the ring.

FieldTypeDescription
startAnglenumberThe start of the arc, in degrees. 0 points up and 90 points right.
sweepnumberThe length of the arc, in degrees, clockwise from the start.
thicknessnumberThe width of the ring, in px.
roundEndsbooleanOptional. If true, the arc has round ends.

A new arc has startAngle: 0, sweep: 270, thickness: 48, and roundEnds: true.

Line (ShapeLine)

The stroke colour and the stroke width draw the line.

FieldTypeDescription
pointsArray<[x: number, y: number]>The points, in % of the item box.
smoothbooleanOptional. If true, the line is a smooth curve through the points.
closedbooleanOptional. If true, a straight edge joins the last point to the first point. The fill or the gradient colours the inside. The stroke is optional.

Draw on

styles.draw sets the drawn part of an arc or a line, from 0 to 100 %. If you do not set it, the full shape shows. Add keyframes to the draw property to draw the shape on over time.

Particles (ShapeParticles)

A particles shape draws many dots on one canvas. The dots move from a cloud into a formed shape. Its Style tab has a Particles section in place of the fill, stroke, and shadow sections.

FieldTypeDescription
countnumberThe number of dots.
seednumberThe seed of the random place, timing, and size of each dot.
size[min: number, max: number]The smallest and the largest dot diameter, in px.
colorsstring[]The dot colours, from the left to the right of the formed shape. Hex colours blend.
pointsnumber[]Optional. The points that the dots form, in % of the item box: [x0, y0, x1, y1, …].
driftnumberHow far a dot moves while it waits in the cloud, in px.
appearnumberOptional. If set, the dots come in one by one over this number of frames from the item start.
progressnumberOptional. The move from the cloud (0) to the formed shape (100), in %. Default: 100.
shimmernumberOptional. A pulse that moves from the left (0) to the right (100) of the formed shape, in %.
gridParticlesGridOptional. The grid mode.

Add keyframes to the progress and shimmer properties to animate the particles.

Grid mode

If you set grid, the dots stay on the marked cells of a grid that fills the item box. The progress value shows the dots in a sweep from the left to the right. In grid mode, the editor does not use count, points, seed, drift, or appear.

ParticlesGrid has columns, rows, and mask. The mask string holds one line for each row. Each line holds the lengths of the empty and marked runs of cells, in turn, and starts with an empty run. Each length is one character of 0-9a-zA-Z (0 to 61).

Type exports

ShapeParticles and ParticlesGrid are not exported from /types. Use ShapeItem['styles']['particles'] to get the type.

Paper (ShapePaper)

A paper shape draws a procedural paper texture. It also uses the corner radius, the stroke, and the stroke width. All fields are optional. The amounts go from 0 (none) to 1 (strong).

FieldTypeDefaultDescription
colorstring'#F4EFE3'The base colour, as a hex colour.
grainnumber0.5The fine grain and the soft mottle.
fibersnumber0.4The amount of curly fibres.
fiberSizenumber0.5The length of the fibres.
crumplesnumber0.3The soft shading of crumples.
foldsnumber0.2The strength of the folds.
foldCountnumber2The number of folds, from 0 to 8.
specklesnumber0.3The amount of small dark and light flecks.
scalenumber1The size of the crumples, folds, and fibres, from 0.25 to 4.
seednumber1The seed of the texture. The same seed gives the same paper.
boilnumber0If set, the paper changes every boil frames, for a stop-motion look. 0 gives a still paper.

Paper presets

The SDK has 8 paper presets. The Paper section of the Style tab shows them as a quick select.

IDNameLook
newsprintNewsprintWarm cream paper with a fine grain, two soft folds, and flecks.
cottonCottonBright white paper with long soft fibres and wide, soft crumples.
kraftKraftBrown paper with many strong fibres and a coarse grain.
recycledRecycledGrey paper with many dark and light flecks.
parchmentParchmentWarm, old parchment with three folds and a dense mottle.
crumpledCrumpledA crushed sheet with strong crumples and many creases.
cardStockCard stockSmooth, light card with a fine grain, few fibres, and no folds.
blackBlackNear-black paper with light fibres and flecks.

Use the preset helpers from /types:

import {
  PAPER_PRESETS,
  PAPER_PRESET_IDS,
  applyPaperPreset,
  findPaperPreset,
  type PaperPresetId,
} from '@reactvideoeditor/react-video-editor/types';

// Apply a preset. The preset keeps the seed and the boil of the current paper.
const paper = applyPaperPreset(item.styles.paper, 'kraft');

// Find the preset that matches a paper, or null.
const presetId: PaperPresetId | null = findPaperPreset(paper);
  • PAPER_PRESETS — an object of presets. Each preset has a name and a paper look.
  • PAPER_PRESET_IDS — the preset IDs, in the quick-select order.
  • applyPaperPreset(paper, id) — gives the settings of the preset, with the seed and the boil of paper.
  • findPaperPreset(paper) — gives the ID of the preset with the same look, or null. The seed and the boil are not part of the look.

Example

This editorState has one rectangle with a radial gradient and a shadow:

import { ItemType, type EditorState } from '@reactvideoeditor/react-video-editor/types';

const editorState: EditorState = {
  dimensions: { width: 1920, height: 1080 },
  playbackRate: 1,
  tracks: [
    {
      id: 'track-1',
      magnetic: false,
      muted: false,
      visible: true,
      items: [
        {
          id: 'card-1',
          type: ItemType.SHAPE,
          shape: 'rectangle',
          content: 'Rectangle',
          from: 0,
          durationInFrames: 90,
          left: 760,
          top: 340,
          width: 400,
          height: 400,
          rotation: 0,
          styles: {
            opacity: 1,
            borderRadius: '24px',
            gradient: {
              type: 'radial',
              centreX: 50,
              centreY: 40,
              radius: 70,
              stops: [
                { color: '#60a5fa', offset: 0 },
                { color: '#1e3a8a', offset: 100 },
              ],
            },
            softEdge: 0,
            dropShadow: { x: 0, y: 12, blur: 24, color: 'rgba(0,0,0,0.35)' },
          },
        },
      ],
    },
  ],
};

Custom compositions

If you render with your own composition, use ShapeLayerContent to draw shape items:

import { ShapeLayerContent } from '@reactvideoeditor/react-video-editor/remotion/components/shape-layer-content';

See Custom compositions.