Skip to main content

lines()v4.0.470

Part of the @remotion/effects package.

Adds an alternating line pattern to canvas-based components such as <Video>, <HtmlInCanvas> and <Solid>.

Each line color is composited over the source. Transparent colors leave the source unchanged.

Preview

Example

MyComp.tsx
import {lines} from '@remotion/effects/lines'; import {Video} from '@remotion/media'; import {AbsoluteFill, useCurrentFrame} from 'remotion'; export const MyComp: React.FC = () => { const frame = useCurrentFrame(); return ( <AbsoluteFill> <Video src="https://remotion.media/video.mp4" effects={[ lines({ colors: ['#dff4ff', 'transparent'], direction: 'horizontal', thickness: 40, gap: 24, angle: 20, offset: frame * 2, }), ]} /> </AbsoluteFill> ); };

API

Pass an object with the following properties. You can also call lines() without arguments.

colors?

An array of color strings for the line stripes. Colors are assigned cyclically. Must contain at least 2 colors.

Defaults to ['#dff4ff', 'transparent'].

direction?

Direction of the unrotated lines. Either 'horizontal' or 'vertical'. Defaults to 'horizontal'.

thickness?

Thickness of each stripe in pixels. Defaults to 40.

gap?

Transparent gap in pixels between each stripe. Defaults to 0.

With gap: 0 (the default), stripes are packed solid with no gap between them — colors are directly adjacent to each other.
With gap > 0, a transparent band appears between each stripe, allowing the source content to show through.

For example, with colors: ['red', 'blue'] and gap: 10:

  • 40px red stripe
  • 10px transparent (source image visible)
  • 40px blue stripe
  • 10px transparent (source image visible)
  • …and so on

angle?

Rotates the line pattern in degrees. Defaults to 0.

offset?

Offset in pixels. Defaults to 0.

Animate this value with useCurrentFrame() to scroll the lines.

disabled?

When true, the effect is skipped. Defaults to false.

Requirements

lines() uses a WebGL2 backend. During renders, enable WebGL via Config.setChromiumOpenGlRenderer() (for example 'angle'). See Using WebGL during renders.

See also