createSmoothSvgPath()
Part of the @remotion/media-utils package of helper functions.
This function takes points, usually generated from visualizeAudioWaveform() or visualizeAudio(), and adds SVG C (curve) statements inbetween them to create a smooth path.
Arguments
An object with the following properties:
points
{x: number; y: number}[]
The points that the path should go through.
Return value
string
An SVG path string that can be passed to the d attribute of a <path> element.
Example
import {createSmoothSvgPath } from '@remotion/media-utils';
import React from 'react';
const points = [
{x : 0, y : 0},
{x : 100, y : 100},
{x : 200, y : 50},
{x : 300, y : 150},
];
const path = createSmoothSvgPath ({points });See a practical example here.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||