makeStar()
Part of the @remotion/shapes package.
Generates a star SVG path.
Example
star.tsimport {makeStar } from "@remotion/shapes"; const {path ,width ,height ,transformOrigin ,instructions } =makeStar ({innerRadius : 150,outerRadius : 200,points : 5, });console .log (path ); // M 190.21130325903073 0 L 278.3790911029017 78.64745084375788 L 380.42260651806146 138.19660112501052 L 332.8697807033037 246.3525491562421 L 307.7683537175254 361.8033988749895 L 190.21130325903073 350 L 72.65425280053613 361.8033988749895 L 47.55282581475771 246.35254915624213 L 0 138.19660112501055 L 102.04351541515975 78.6474508437579 L 190.21130325903073 0 Zconsole .log (width ); // 380.42260651806146console .log (height ); // 361.8033988749895console .log (transformOrigin ); // '190.21130325903073 200'console .log (instructions ); // '[{type: "M"}, ...]'
Arguments
points
number
The amount of points of the star.
innerRadius
number
The inner radius of the star.
outerRadius
number
The outer radius of the star.
edgeRoundness
number | null
Allows to modify the shape by rounding the edges using bezier curves. Default null.
cornerRadius
number
Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness. Default 0.
Return type
path
A string that is suitable as an argument for d in a <path> element.
width
The width of the star. Suitable for defining the viewBox of an <svg> tag.
height
The height of the star. 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 <Star />.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||