Skip to content

Text layers

Text layers render a typographic element with full CSS-style control: font, weight, letter-spacing, alignment, background pill, padding, border-radius. Every property is animatable via .animate().

js
// LiveFlowDemo
const $ = new iLoveVideoEditor({ width: 512, height: 512, fps: 30, backgroundColor: '#0f0f23' });

$.addText(
  {
    text: 'Design.\nAnimate.\nShip.',
    fontSize: 11,
    fontWeight: 800,
    color: '#ffffff',
    fontFamily: 'Inter',
    letterSpacing: '0.02em',
    lineHeight: 1.15,
    position: [0.5, 0.5],
    textAlign: 'center',
    backgroundColor: 'rgba(255, 90, 31, 0.15)',
    padding: '0.3em 0.6em',
    borderRadius: '16px',
  },
  { transitionIn: { transition: 'zoom', duration: '800ms', easing: 'easeOut' } },
);

$.wait('1.5s');
return $;

Properties

PropType / defaultNotes
textstringPlain or multiline. Supports \n. Not animatable.
fontSizeem / 4Unitless = em (1em = 1% of project width).
fontWeight100–900 / 600Only weights the font actually ships are rendered.
fontFamilystring / Noto SansGoogle Fonts resolved automatically. Not animatable.
colorcss colour / #FFFFFFAny CSS colour.
letterSpacingem / 0emAnimatable.
lineHeightnumber / 1Multiplier of fontSize, or 'XXem' / 'XXpx'.
wordSpacing / textIndentem / 0Animatable.
textAlign`leftcenter
verticalAlign`topmiddle
fontStyle`normalitalic/normal`
textTransform`nonecapitalize
textDecoration`noneunderline
direction`ltrrtl/ltr`
backgroundColorcss colour / transparentPill background; pairs well with padding.
paddingem / 0Single value or [t,r,b,l].
borderWidth / borderColor / borderStyleem / colour / enumborderStyle ∈ `none
borderRadiusem or 'XX%' / 0Single value or [tl,tr,br,bl].
boxShadow + boxShadowBlur / boxShadowColor / boxShadowOffset / boxShadowSpreadboolean + propsSet boxShadow: true to enable; props animatable.
outlineWidth / outlineStyle / outlineColor / outlineOffsetem + enumCSS outline. outlineStyle not animatable.
textShadow + textShadowBlur / textShadowColor / textShadowOffsetboolean + propsSet textShadow: true to enable; props animatable.
textStroke + textStrokeWidth / textStrokeColorboolean + propsSet textStroke: true to enable; props animatable.
position[x, y] / [0.5, 0.5]Normalised 0..1 coordinates of the anchor. Accepts [x, y, z].
anchor[x, y] / [0.5, 0.5]Pivot inside the layer bbox (for position + rotation + scale).
scale`number[sx, sy]
rotation`degrees[rx, ry, rz]/0`
perspectiveem / 1003D perspective for child rotations / translations. Animatable.
opacity0–1 / 1Animatable.
visibleboolean / trueHard on/off (no interpolation).
blendMode16 values / normalMaps to CSS mix-blend-mode — normal, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity. Not animatable.
filterBlur / filterBrightness / filterContrast / filterSaturate / filterGrayscale / filterSepia / filterInvert / filterHueRotateem / multiplier / 0–1 / degPer-layer CSS filter chain. All animatable.
effectsLayerEffect[]Creation-time only — see Effects. Individual params are animatable via dot-path keys.
startTime (setting)Time / current flow pointerSee Time formats.
sourceDuration (setting)TimeRarely needed — prefer the flow pattern (add → $.wait() → .remove()).

Kinetic typography

Give each layer its own transitionIn and space them with $.wait() for the classic "kinetic type" stagger — no manual keyframing required.

js
// LiveFlowDemo
const $ = new iLoveVideoEditor({ width: 512, height: 512, fps: 30, backgroundColor: '#111' });

$.addText(
  {
    text: 'NOW AVAILABLE',
    fontSize: 4, fontWeight: 700, color: '#22c55e',
    letterSpacing: '0.3em', position: [0.5, 0.4],
  },
  { transitionIn: { transition: 'fade', duration: '600ms' } },
);

$.wait('150ms');

$.addText(
  {
    text: 'Videos\nas code.',
    fontSize: 14, fontWeight: 800, color: '#fff',
    lineHeight: 1.1, textAlign: 'center', position: [0.5, 0.58],
  },
  { transitionIn: { transition: 'slideUp', duration: '900ms', easing: 'easeOut' } },
);

$.wait('2s');
return $;

NOTE

Fonts. Pass any Google Font name as fontFamily — the renderer fetches WOFF2 at render time. For local fonts, register them on the iLoveVideoEditor instance before adding the layer.

Released under the MIT License.