Skip to main content

makeHeart()

可从 v4.0.315 获取

🌐 available from v4.0.315

生成心形的SVG路径。

🌐 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 100 120 C 40 110 20 70 60 60 C 90 40 110 40 140 60 C 180 70 160 110 100 120 Z console.log(width); // 200 console.log(height); // 160 console.log(transformOrigin); // "100 80" 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.

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.

返回类型

🌐 Return type

该函数返回一个具有以下属性的对象:

🌐 The function returns an object with the following properties:

  • path:SVG 路径字符串
  • width:心的宽度
  • height:心的高度
  • transformOrigin:心形的变换原点
  • instructions:一组路径指令

另请参阅

🌐 See also