VideoFlowcodeGitHubTry itCoreRenderersReact Video EditorPlaygroundExamplesDocscodeGitHubTry it
Getting started
InstallationQuick startCore conceptsYour first video
Builder
Builder APITime formatsParallel & wait
Layers
TextImageVideoAudioCaptionsShapeGroups
Animation
Animate & keyframesEasing functionsTransitionsEffects
Renderers
Browser rendererServer rendererDOM preview
React Video Editor
QuickstartThemingUploadsCustom panelsHooks & commandsKeyboard shortcuts
API reference
Overview@videoflow/core@videoflow/renderer-browser@videoflow/renderer-server@videoflow/renderer-dom@videoflow/react-video-editor

Shape layers

$.addShape(props, settings) draws a vector primitive. Pick the silhouette via settings.shapeType (rectangle, ellipse, polygon, or star). Width, height, fills, strokes, and corner radii are all animatable.

On this page
const $ = new VideoFlow({ width: 512, height: 512, fps: 30, backgroundColor: '#0f0f23' });

// All four shapeTypes pop in side by side.
const SHAPES = [
  { type: 'rectangle', x: 0.18, color: '#ff5a1f' },
  { type: 'ellipse',   x: 0.39, color: '#4ecdc4' },
  { type: 'polygon',   x: 0.61, color: '#a78bfa' },
  { type: 'star',      x: 0.82, color: '#facc15' },
];

const layers = [];
for (const s of SHAPES) {
  layers.push($.addShape(
    {
      width: 16, height: 16,
      fill: s.color,
      position: [s.x, 0.5],
      sides: 6, innerRadius: 0.45,
    },
    {
      shapeType: s.type,
      transitionIn:  { transition: 'overshootPop', duration: '500ms', params: { from: 0.3 } },
      transitionOut: { transition: 'fade', duration: '400ms' },
    },
    { waitFor: 0 },
  ));
  $.wait('150ms');
}
$.wait('1.5s');
for (const l of layers) l.remove();
$.wait('500ms');
return $;
Compiling00:00

Shape types

shapeTypeLooks likeKnobs
rectangleBox with optional rounded corners.width, height, cornerRadius
ellipseOval / circle when width = height.width, height
polygonRegular n-gon (triangle, hexagon, …).width, height, sides
starn-pointed star.width, height, sides, innerRadius

Properties

PropType / defaultNotes
width / heightem / 1001 em = 1% of project width. Animatable.
fillcss colour / #ffffff'transparent' disables the fill.
strokeColorcss colour / #000000Animatable.
strokeWidthem / 00 hides the stroke. Animatable.
strokeAlignmentinner | center | outer / innerWhere the stroke sits relative to the box edge.
strokeDash / strokeGapem / 0Dash pattern. 0 = solid.
strokeLinejoinmiter | round | bevelCorner style.
cornerRadiusem / 0Rectangle only. Capped at half the shorter side.
sides6Polygon vertices / star points. Integer ≥ 3. Not animatable.
innerRadius0.5Star only. Ratio of inner to outer radius.
shapeType (setting)rectanglePick the silhouette.

Examples

// A pill-shaped backdrop behind a heading
const pill = $.addShape(
  {
    width: 60, height: 12,
    fill: '#1c2233',
    strokeColor: '#3a4257', strokeWidth: 0.2,
    cornerRadius: 6,
    position: [0.5, 0.5],
  },
  { shapeType: 'rectangle' },
);
$.wait('3s');
pill.remove();

// A six-pointed star that pulses
const star = $.addShape(
  { width: 30, height: 30, fill: '#facc15', sides: 6, innerRadius: 0.4 },
  { shapeType: 'star' },
);
star.animate({ scale: 1 }, { scale: 1.15 }, { duration: '600ms', wait: false });
VideoFlow

Open-source toolkit for composing videos from code.

Product

CoreRenderersReact Video EditorPlayground

Learn

DocsAPI referenceExamplesvs. Remotionvs. FFmpeg

Project

GitHubLicenseContact

Legal

TermsPrivacy
© 2026 VideoFlow. Apache-2.0 core.