Back to Remotion

makeTriangle()

packages/docs/docs/shapes/make-triangle.mdx

4.0.470914 B
Original Source

import {MakeShapeSeeAlso, ShapeOptions, MakeShapeReturnType} from "../../components/shapes/shapes-info"

Part of the @remotion/shapes package.

Generates an SVG path for a triangle with the same length on all sides.

Example

tsx
import { makeTriangle } from "@remotion/shapes";

const { path, width, height, transformOrigin } = makeTriangle({
  length: 100,
  direction: "right",
});

console.log(path); // M 0 0 L 0 100 L 86.60254037844386 50 z
console.log(width); // 86.60254037844386
console.log(height); // 100
console.log(transformOrigin); // '28.867513459481287 50'

Arguments

<ShapeOptions shape="triangle"/>

Return type

<MakeShapeReturnType shape="triangle"/>

Credits

Source code partially taken from this StackBlitz.

See also

<MakeShapeSeeAlso shape="triangle"/>