Skip to main content

makeHeart()v4.0.315

Part of the @remotion/shapes package.

Generates an SVG path for a heart.

Example​

make-heart.ts
import {makeHeart} from '@remotion/shapes'; const {path, width, height, transformOrigin, instructions} = makeHeart({ height: 100, }); console.log(path); // M 55.00000000000001 100 C 32.00000000000001 69 0 60 0 25 C 0 13 13.000000000000004 0 27.500000000000004 0 C 42 0 50.00000000000001 7.000000000000001 55.00000000000001 17 C 60.00000000000001 7.000000000000001 70 0 82.50000000000001 0 C 97.00000000000001 0 110.00000000000001 13 110.00000000000001 25 C 110.00000000000001 60 78 69 55.00000000000001 100 Z console.log(width); // 110.00000000000001 console.log(height); // 100 console.log(transformOrigin); // '55.00000000000001 50' console.log(instructions); // Instruction[]

Arguments​

height

number

The height of the heart.

aspectRatio

number

The aspect ratio of the heart. Default 1.1.

bottomRoundnessAdjustment

number

The amount of bottom roundness deviation from the default. Negative values make the bottom point sharper, positive values make it rounder. Default 0.

depthAdjustment

number

The deviation of the default depth (how deep the top of the heart is). Negative values make the heart deeper, positive values make it shallower. Default 0.

Return type​

path

A string that is suitable as an argument for d in a <path> element.

width

The width of the heart. Suitable for defining the viewBox of an <svg> tag.

height

The height of the heart. Suitable for defining the viewBox of an <svg> tag.

instructions

An array with SVG instructions. The type for a instruction can be seen by importing Instruction from @remotion/shapes.

transformOrigin

A string representing the point of origin if a shape should be rotated around itself.

If you want to rotate the shape around its center, use the transform-origin CSS property and pass this value, and also add transform-box: fill-box. This is the default for <Heart />.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​