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:
| Value | Description | Settings 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)
| Field | Type | Description |
|---|---|---|
type | 'linear' | The gradient type. |
angle | number | The angle, in degrees. 0 points up and 90 points right, the same as CSS linear-gradient(). |
stops | ShapeGradientStop[] | The colour stops. |
Radial gradient (ShapeRadialGradient)
| Field | Type | Description |
|---|---|---|
type | 'radial' | The gradient type. |
centreX | number | The centre, in % of the shape width. |
centreY | number | The centre, in % of the shape height. |
radius | number | The radius, in % of the shape width and height. The gradient is an ellipse. |
stops | ShapeGradientStop[] | 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
| Field | Type | Description |
|---|---|---|
styles.stroke | string | The stroke colour. |
styles.strokeWidth | number | The stroke width, in px. A line uses the stroke to draw the line. |
styles.borderRadius | string | The corner radius of a rectangle or a paper shape, for example '24px'. |
styles.softEdge | number | The blur of the shape edge, in px. 0 or no value gives a hard edge. |
styles.dropShadow | ShapeShadow | A blurred copy of the shape behind the shape. |
styles.opacity | number | From 0 to 1. |
ShapeShadow has these fields:
| Field | Type | Description |
|---|---|---|
x | number | The offset to the right, in px. |
y | number | The offset down, in px. |
blur | number | The blur, in px. |
color | string | The shadow colour. |
Arc (ShapeArc)
An arc is a part of a ring in the item box. The fill or the gradient colours the ring.
| Field | Type | Description |
|---|---|---|
startAngle | number | The start of the arc, in degrees. 0 points up and 90 points right. |
sweep | number | The length of the arc, in degrees, clockwise from the start. |
thickness | number | The width of the ring, in px. |
roundEnds | boolean | Optional. 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.
| Field | Type | Description |
|---|---|---|
points | Array<[x: number, y: number]> | The points, in % of the item box. |
smooth | boolean | Optional. If true, the line is a smooth curve through the points. |
closed | boolean | Optional. 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.
| Field | Type | Description |
|---|---|---|
count | number | The number of dots. |
seed | number | The 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. |
colors | string[] | The dot colours, from the left to the right of the formed shape. Hex colours blend. |
points | number[] | Optional. The points that the dots form, in % of the item box: [x0, y0, x1, y1, …]. |
drift | number | How far a dot moves while it waits in the cloud, in px. |
appear | number | Optional. If set, the dots come in one by one over this number of frames from the item start. |
progress | number | Optional. The move from the cloud (0) to the formed shape (100), in %. Default: 100. |
shimmer | number | Optional. A pulse that moves from the left (0) to the right (100) of the formed shape, in %. |
grid | ParticlesGrid | Optional. 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).
| Field | Type | Default | Description |
|---|---|---|---|
color | string | '#F4EFE3' | The base colour, as a hex colour. |
grain | number | 0.5 | The fine grain and the soft mottle. |
fibers | number | 0.4 | The amount of curly fibres. |
fiberSize | number | 0.5 | The length of the fibres. |
crumples | number | 0.3 | The soft shading of crumples. |
folds | number | 0.2 | The strength of the folds. |
foldCount | number | 2 | The number of folds, from 0 to 8. |
speckles | number | 0.3 | The amount of small dark and light flecks. |
scale | number | 1 | The size of the crumples, folds, and fibres, from 0.25 to 4. |
seed | number | 1 | The seed of the texture. The same seed gives the same paper. |
boil | number | 0 | If 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.
| ID | Name | Look |
|---|---|---|
newsprint | Newsprint | Warm cream paper with a fine grain, two soft folds, and flecks. |
cotton | Cotton | Bright white paper with long soft fibres and wide, soft crumples. |
kraft | Kraft | Brown paper with many strong fibres and a coarse grain. |
recycled | Recycled | Grey paper with many dark and light flecks. |
parchment | Parchment | Warm, old parchment with three folds and a dense mottle. |
crumpled | Crumpled | A crushed sheet with strong crumples and many creases. |
cardStock | Card stock | Smooth, light card with a fine grain, few fibres, and no folds. |
black | Black | Near-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 anameand apaperlook.PAPER_PRESET_IDS— the preset IDs, in the quick-select order.applyPaperPreset(paper, id)— gives the settings of the preset, with theseedand theboilofpaper.findPaperPreset(paper)— gives the ID of the preset with the same look, ornull. 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.