@remotion/shapes 3.3.54 → 3.3.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/circle.d.ts +5 -0
- package/dist/components/circle.js +5 -0
- package/dist/components/ellipse.d.ts +6 -0
- package/dist/components/ellipse.js +6 -0
- package/dist/components/pie.d.ts +9 -0
- package/dist/components/pie.js +9 -0
- package/dist/components/rect.d.ts +8 -0
- package/dist/components/rect.js +8 -0
- package/dist/components/star.d.ts +9 -0
- package/dist/components/star.js +9 -0
- package/dist/components/triangle.d.ts +8 -0
- package/dist/components/triangle.js +8 -0
- package/dist/utils/make-circle.d.ts +5 -0
- package/dist/utils/make-circle.js +5 -0
- package/dist/utils/make-ellipse.d.ts +6 -0
- package/dist/utils/make-ellipse.js +6 -0
- package/dist/utils/make-pie.d.ts +9 -0
- package/dist/utils/make-pie.js +9 -0
- package/dist/utils/make-rect.d.ts +8 -0
- package/dist/utils/make-rect.js +8 -0
- package/dist/utils/make-star.js +9 -0
- package/dist/utils/make-triangle.d.ts +8 -0
- package/dist/utils/make-triangle.js +8 -0
- package/package.json +3 -3
- package/dist/utils/instructions.d.ts +0 -32
- package/dist/utils/instructions.js +0 -25
|
@@ -2,4 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import type { MakeCircleProps } from '../utils/make-circle';
|
|
3
3
|
import type { AllShapesProps } from './render-svg';
|
|
4
4
|
export declare type CircleProps = MakeCircleProps & AllShapesProps;
|
|
5
|
+
/**
|
|
6
|
+
* @description Renders an SVG element drawing a circle.
|
|
7
|
+
* @param {Number} radius The radius of the circle.
|
|
8
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/circle)
|
|
9
|
+
*/
|
|
5
10
|
export declare const Circle: React.FC<CircleProps>;
|
|
@@ -4,6 +4,11 @@ exports.Circle = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const make_circle_1 = require("../utils/make-circle");
|
|
6
6
|
const render_svg_1 = require("./render-svg");
|
|
7
|
+
/**
|
|
8
|
+
* @description Renders an SVG element drawing a circle.
|
|
9
|
+
* @param {Number} radius The radius of the circle.
|
|
10
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/circle)
|
|
11
|
+
*/
|
|
7
12
|
const Circle = ({ radius, ...props }) => {
|
|
8
13
|
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_circle_1.makeCircle)({ radius }), ...props });
|
|
9
14
|
};
|
|
@@ -2,4 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import type { MakeEllipseOptions } from '../utils/make-ellipse';
|
|
3
3
|
import type { AllShapesProps } from './render-svg';
|
|
4
4
|
export declare type EllipseProps = MakeEllipseOptions & AllShapesProps;
|
|
5
|
+
/**
|
|
6
|
+
* @description Renders an SVG element drawing an ellipse.
|
|
7
|
+
* @param {Number} rx The radius of the ellipse on the X axis.
|
|
8
|
+
* @param {Number} ry The radius of the ellipse on the Y axis.
|
|
9
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/ellipse)
|
|
10
|
+
*/
|
|
5
11
|
export declare const Ellipse: React.FC<EllipseProps>;
|
|
@@ -4,6 +4,12 @@ exports.Ellipse = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const make_ellipse_1 = require("../utils/make-ellipse");
|
|
6
6
|
const render_svg_1 = require("./render-svg");
|
|
7
|
+
/**
|
|
8
|
+
* @description Renders an SVG element drawing an ellipse.
|
|
9
|
+
* @param {Number} rx The radius of the ellipse on the X axis.
|
|
10
|
+
* @param {Number} ry The radius of the ellipse on the Y axis.
|
|
11
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/ellipse)
|
|
12
|
+
*/
|
|
7
13
|
const Ellipse = ({ rx, ry, ...props }) => {
|
|
8
14
|
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_ellipse_1.makeEllipse)({ rx, ry }), ...props });
|
|
9
15
|
};
|
package/dist/components/pie.d.ts
CHANGED
|
@@ -2,4 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import type { MakePieProps } from '../utils/make-pie';
|
|
3
3
|
import type { AllShapesProps } from './render-svg';
|
|
4
4
|
export declare type PieProps = MakePieProps & AllShapesProps;
|
|
5
|
+
/**
|
|
6
|
+
* @description Renders an SVG element drawing a pie piece.
|
|
7
|
+
* @param {Number} radius The radius of the circle..
|
|
8
|
+
* @param {Number} progress The percentage of the circle that is filled. 0 means fully empty, 1 means fully filled.
|
|
9
|
+
* @param {Boolean} closePath If set to false, no path to the middle of the circle will be drawn, leading to an open arc. Default true.
|
|
10
|
+
* @param {Boolean} counterClockwise If set, the circle gets filled counterclockwise instead of clockwise. Default false.
|
|
11
|
+
* @param {Boolean} rotation Add rotation to the path. 0 means no rotation, Math.PI * 2 means 1 full clockwise rotation
|
|
12
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/pie)
|
|
13
|
+
*/
|
|
5
14
|
export declare const Pie: React.FC<PieProps>;
|
package/dist/components/pie.js
CHANGED
|
@@ -4,6 +4,15 @@ exports.Pie = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const make_pie_1 = require("../utils/make-pie");
|
|
6
6
|
const render_svg_1 = require("./render-svg");
|
|
7
|
+
/**
|
|
8
|
+
* @description Renders an SVG element drawing a pie piece.
|
|
9
|
+
* @param {Number} radius The radius of the circle..
|
|
10
|
+
* @param {Number} progress The percentage of the circle that is filled. 0 means fully empty, 1 means fully filled.
|
|
11
|
+
* @param {Boolean} closePath If set to false, no path to the middle of the circle will be drawn, leading to an open arc. Default true.
|
|
12
|
+
* @param {Boolean} counterClockwise If set, the circle gets filled counterclockwise instead of clockwise. Default false.
|
|
13
|
+
* @param {Boolean} rotation Add rotation to the path. 0 means no rotation, Math.PI * 2 means 1 full clockwise rotation
|
|
14
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/pie)
|
|
15
|
+
*/
|
|
7
16
|
const Pie = ({ radius, progress, closePath, counterClockwise, rotation, ...props }) => {
|
|
8
17
|
return ((0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_pie_1.makePie)({ radius, progress, closePath, counterClockwise, rotation }), ...props }));
|
|
9
18
|
};
|
|
@@ -2,4 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import type { MakeRectOptions } from '../utils/make-rect';
|
|
3
3
|
import type { AllShapesProps } from './render-svg';
|
|
4
4
|
export declare type RectProps = MakeRectOptions & AllShapesProps;
|
|
5
|
+
/**
|
|
6
|
+
* @description Renders an SVG element containing a rectangle.
|
|
7
|
+
* @param {Number} width The width of the Rectangle
|
|
8
|
+
* @param {Number} height The height of the Rectangle
|
|
9
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
10
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
11
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/rect)
|
|
12
|
+
*/
|
|
5
13
|
export declare const Rect: React.FC<RectProps>;
|
package/dist/components/rect.js
CHANGED
|
@@ -4,6 +4,14 @@ exports.Rect = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const make_rect_1 = require("../utils/make-rect");
|
|
6
6
|
const render_svg_1 = require("./render-svg");
|
|
7
|
+
/**
|
|
8
|
+
* @description Renders an SVG element containing a rectangle.
|
|
9
|
+
* @param {Number} width The width of the Rectangle
|
|
10
|
+
* @param {Number} height The height of the Rectangle
|
|
11
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
12
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
13
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/rect)
|
|
14
|
+
*/
|
|
7
15
|
const Rect = ({ width, edgeRoundness, height, cornerRadius, ...props }) => {
|
|
8
16
|
return ((0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_rect_1.makeRect)({ height, width, edgeRoundness, cornerRadius }), ...props }));
|
|
9
17
|
};
|
|
@@ -2,4 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import type { MakeStarProps } from '../utils/make-star';
|
|
3
3
|
import type { AllShapesProps } from './render-svg';
|
|
4
4
|
export declare type StarProps = MakeStarProps & Omit<AllShapesProps, 'points'>;
|
|
5
|
+
/**
|
|
6
|
+
* @description Renders an SVG element containing a star.
|
|
7
|
+
* @param {Number} innerRadius The inner radius of the star.
|
|
8
|
+
* @param {Number} outerRadius The outer radius of the star.
|
|
9
|
+
* @param {Number} points The amount of points of the star.
|
|
10
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
11
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
12
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/star)
|
|
13
|
+
*/
|
|
5
14
|
export declare const Star: React.FC<StarProps>;
|
package/dist/components/star.js
CHANGED
|
@@ -4,6 +4,15 @@ exports.Star = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const make_star_1 = require("../utils/make-star");
|
|
6
6
|
const render_svg_1 = require("./render-svg");
|
|
7
|
+
/**
|
|
8
|
+
* @description Renders an SVG element containing a star.
|
|
9
|
+
* @param {Number} innerRadius The inner radius of the star.
|
|
10
|
+
* @param {Number} outerRadius The outer radius of the star.
|
|
11
|
+
* @param {Number} points The amount of points of the star.
|
|
12
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
13
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
14
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/star)
|
|
15
|
+
*/
|
|
7
16
|
const Star = ({ innerRadius, outerRadius, points, cornerRadius, edgeRoundness, ...props }) => {
|
|
8
17
|
return ((0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_star_1.makeStar)({
|
|
9
18
|
innerRadius,
|
|
@@ -2,4 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import type { MakeTriangleProps } from '../utils/make-triangle';
|
|
3
3
|
import type { AllShapesProps } from './render-svg';
|
|
4
4
|
export declare type TriangleProps = MakeTriangleProps & AllShapesProps;
|
|
5
|
+
/**
|
|
6
|
+
* @description Renders an SVG element containing a triangle with same length on all sides.
|
|
7
|
+
* @param {Number} length The length of one triangle side.
|
|
8
|
+
* @param {string} direction The direction of the triangle
|
|
9
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
10
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
11
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/triangle)
|
|
12
|
+
*/
|
|
5
13
|
export declare const Triangle: React.FC<TriangleProps>;
|
|
@@ -4,6 +4,14 @@ exports.Triangle = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const make_triangle_1 = require("../utils/make-triangle");
|
|
6
6
|
const render_svg_1 = require("./render-svg");
|
|
7
|
+
/**
|
|
8
|
+
* @description Renders an SVG element containing a triangle with same length on all sides.
|
|
9
|
+
* @param {Number} length The length of one triangle side.
|
|
10
|
+
* @param {string} direction The direction of the triangle
|
|
11
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
12
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
13
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/triangle)
|
|
14
|
+
*/
|
|
7
15
|
const Triangle = ({ length, direction, edgeRoundness, cornerRadius, ...props }) => {
|
|
8
16
|
return ((0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_triangle_1.makeTriangle)({ length, direction, edgeRoundness, cornerRadius }), ...props }));
|
|
9
17
|
};
|
|
@@ -2,4 +2,9 @@ import type { ShapeInfo } from './shape-info';
|
|
|
2
2
|
export declare type MakeCircleProps = {
|
|
3
3
|
radius: number;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* @description Generates a circle SVG path.
|
|
7
|
+
* @param {Number} radius The radius of the circle.
|
|
8
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-circle)
|
|
9
|
+
*/
|
|
5
10
|
export declare const makeCircle: ({ radius }: MakeCircleProps) => ShapeInfo;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeCircle = void 0;
|
|
4
4
|
const paths_1 = require("@remotion/paths");
|
|
5
|
+
/**
|
|
6
|
+
* @description Generates a circle SVG path.
|
|
7
|
+
* @param {Number} radius The radius of the circle.
|
|
8
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-circle)
|
|
9
|
+
*/
|
|
5
10
|
const makeCircle = ({ radius }) => {
|
|
6
11
|
const instructions = [
|
|
7
12
|
{
|
|
@@ -3,4 +3,10 @@ export declare type MakeEllipseOptions = {
|
|
|
3
3
|
rx: number;
|
|
4
4
|
ry: number;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* @description Generates an ellipse SVG path.
|
|
8
|
+
* @param {Number} rx The radius of the ellipse on the X axis.
|
|
9
|
+
* @param {Number} ry The radius of the ellipse on the Y axis.
|
|
10
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-ellipse)
|
|
11
|
+
*/
|
|
6
12
|
export declare const makeEllipse: ({ rx, ry }: MakeEllipseOptions) => ShapeInfo;
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeEllipse = void 0;
|
|
4
4
|
const paths_1 = require("@remotion/paths");
|
|
5
|
+
/**
|
|
6
|
+
* @description Generates an ellipse SVG path.
|
|
7
|
+
* @param {Number} rx The radius of the ellipse on the X axis.
|
|
8
|
+
* @param {Number} ry The radius of the ellipse on the Y axis.
|
|
9
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-ellipse)
|
|
10
|
+
*/
|
|
5
11
|
const makeEllipse = ({ rx, ry }) => {
|
|
6
12
|
const instructions = [
|
|
7
13
|
{
|
package/dist/utils/make-pie.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ export declare type MakePieProps = {
|
|
|
6
6
|
counterClockwise?: boolean;
|
|
7
7
|
rotation?: number;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @description Generates a piece of pie SVG path.
|
|
11
|
+
* @param {Number} radius The radius of the circle..
|
|
12
|
+
* @param {Number} progress The percentage of the circle that is filled. 0 means fully empty, 1 means fully filled.
|
|
13
|
+
* @param {Boolean} closePath If set to false, no path to the middle of the circle will be drawn, leading to an open arc. Default true.
|
|
14
|
+
* @param {Boolean} counterClockwise If set, the circle gets filled counterclockwise instead of clockwise. Default false.
|
|
15
|
+
* @param {Boolean} rotation Add rotation to the path. 0 means no rotation, Math.PI * 2 means 1 full clockwise rotation
|
|
16
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-pie)
|
|
17
|
+
*/
|
|
9
18
|
export declare const makePie: ({ progress, radius, closePath, counterClockwise, rotation, }: MakePieProps) => {
|
|
10
19
|
height: number;
|
|
11
20
|
width: number;
|
package/dist/utils/make-pie.js
CHANGED
|
@@ -10,6 +10,15 @@ const getCoord = ({ counterClockwise, actualProgress, rotation, radius, coord, }
|
|
|
10
10
|
const rounded = Math.round(val * 100000) / 100000;
|
|
11
11
|
return rounded;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* @description Generates a piece of pie SVG path.
|
|
15
|
+
* @param {Number} radius The radius of the circle..
|
|
16
|
+
* @param {Number} progress The percentage of the circle that is filled. 0 means fully empty, 1 means fully filled.
|
|
17
|
+
* @param {Boolean} closePath If set to false, no path to the middle of the circle will be drawn, leading to an open arc. Default true.
|
|
18
|
+
* @param {Boolean} counterClockwise If set, the circle gets filled counterclockwise instead of clockwise. Default false.
|
|
19
|
+
* @param {Boolean} rotation Add rotation to the path. 0 means no rotation, Math.PI * 2 means 1 full clockwise rotation
|
|
20
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-pie)
|
|
21
|
+
*/
|
|
13
22
|
const makePie = ({ progress, radius, closePath = true, counterClockwise = false, rotation = 0, }) => {
|
|
14
23
|
const actualProgress = Math.min(Math.max(progress, 0), 1);
|
|
15
24
|
const endAngleX = getCoord({
|
|
@@ -5,4 +5,12 @@ export declare type MakeRectOptions = {
|
|
|
5
5
|
edgeRoundness?: number | null;
|
|
6
6
|
cornerRadius?: number;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* @description Generates an SVG rectangle.
|
|
10
|
+
* @param {Number} width The width of the rectangle.
|
|
11
|
+
* @param {Number} height The height of the rectangle
|
|
12
|
+
* @param {Number | null} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
13
|
+
* @param {Number} cornerRadius * @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
14
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-rect)
|
|
15
|
+
*/
|
|
8
16
|
export declare const makeRect: ({ width, height, edgeRoundness, cornerRadius, }: MakeRectOptions) => ShapeInfo;
|
package/dist/utils/make-rect.js
CHANGED
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeRect = void 0;
|
|
4
4
|
const paths_1 = require("@remotion/paths");
|
|
5
5
|
const join_points_1 = require("./join-points");
|
|
6
|
+
/**
|
|
7
|
+
* @description Generates an SVG rectangle.
|
|
8
|
+
* @param {Number} width The width of the rectangle.
|
|
9
|
+
* @param {Number} height The height of the rectangle
|
|
10
|
+
* @param {Number | null} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
11
|
+
* @param {Number} cornerRadius * @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
12
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-rect)
|
|
13
|
+
*/
|
|
6
14
|
const makeRect = ({ width, height, edgeRoundness = null, cornerRadius = 0, }) => {
|
|
7
15
|
const transformOrigin = [width / 2, height / 2];
|
|
8
16
|
const instructions = [
|
package/dist/utils/make-star.js
CHANGED
|
@@ -4,6 +4,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.makeStar = void 0;
|
|
5
5
|
const paths_1 = require("@remotion/paths");
|
|
6
6
|
const join_points_1 = require("./join-points");
|
|
7
|
+
/**
|
|
8
|
+
* @description Generates a star SVG path.
|
|
9
|
+
* @param {Number} innerRadius The inner radius of the star.
|
|
10
|
+
* @param {Number} outerRadius The outer radius of the star.
|
|
11
|
+
* @param {Number} points The amount of points of the star.
|
|
12
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
13
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
14
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-star)
|
|
15
|
+
*/
|
|
7
16
|
const star = ({ centerX, centerY, points, innerRadius, outerRadius, cornerRadius, edgeRoundness, }) => {
|
|
8
17
|
const degreeIncrement = (Math.PI * 2) / (points * 2);
|
|
9
18
|
const d = new Array(points * 2).fill(true).map((_p, i) => {
|
|
@@ -6,5 +6,13 @@ export declare type MakeTriangleProps = {
|
|
|
6
6
|
edgeRoundness?: number | null;
|
|
7
7
|
cornerRadius?: number;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @description Generates an SVG path for a triangle with the same length on all sides.
|
|
11
|
+
* @param {Number} length The length of one triangle side.
|
|
12
|
+
* @param {string} direction The direction of the triangle
|
|
13
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
14
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
15
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-triangle)
|
|
16
|
+
*/
|
|
9
17
|
export declare const makeTriangle: ({ length, direction, edgeRoundness, cornerRadius, }: MakeTriangleProps) => ShapeInfo;
|
|
10
18
|
export {};
|
|
@@ -4,6 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.makeTriangle = void 0;
|
|
5
5
|
const paths_1 = require("@remotion/paths");
|
|
6
6
|
const join_points_1 = require("./join-points");
|
|
7
|
+
/**
|
|
8
|
+
* @description Generates an SVG path for a triangle with the same length on all sides.
|
|
9
|
+
* @param {Number} length The length of one triangle side.
|
|
10
|
+
* @param {string} direction The direction of the triangle
|
|
11
|
+
* @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.
|
|
12
|
+
* @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.
|
|
13
|
+
* @see [Documentation](https://www.remotion.dev/docs/shapes/make-triangle)
|
|
14
|
+
*/
|
|
7
15
|
const makeTriangle = ({ length, direction = 'right', edgeRoundness = null, cornerRadius = 0, }) => {
|
|
8
16
|
const longerDimension = length;
|
|
9
17
|
const shorterSize = Math.sqrt(length ** 2 * 0.75); // Calculated on paper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/shapes",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.56",
|
|
4
4
|
"description": "Utility functions and components for SVG shapes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": ">=16.8.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@remotion/paths": "3.3.
|
|
48
|
+
"@remotion/paths": "3.3.56"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "40e96323b08717213c20fffcce8a985f0310f6e5"
|
|
51
51
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export declare type Instruction = {
|
|
2
|
-
type: 'M';
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
} | {
|
|
6
|
-
type: 'L';
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
} | {
|
|
10
|
-
type: 'C';
|
|
11
|
-
cp1x: number;
|
|
12
|
-
cp1y: number;
|
|
13
|
-
cp2x: number;
|
|
14
|
-
cp2y: number;
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
} | {
|
|
18
|
-
type: 'm';
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
} | {
|
|
22
|
-
type: 'a';
|
|
23
|
-
rx: number;
|
|
24
|
-
ry: number;
|
|
25
|
-
xAxisRotation: number;
|
|
26
|
-
largeArcFlag: boolean;
|
|
27
|
-
sweepFlag: boolean;
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
};
|
|
31
|
-
export declare const serializeInstructions: (instructions: Instruction[]) => string;
|
|
32
|
-
export declare const serializeInstruction: (instruction: Instruction) => string | undefined;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeInstruction = exports.serializeInstructions = void 0;
|
|
4
|
-
const serializeInstructions = (instructions) => {
|
|
5
|
-
return instructions.map(exports.serializeInstruction).join(' ');
|
|
6
|
-
};
|
|
7
|
-
exports.serializeInstructions = serializeInstructions;
|
|
8
|
-
const serializeInstruction = (instruction) => {
|
|
9
|
-
if (instruction.type === 'M') {
|
|
10
|
-
return `M ${instruction.x} ${instruction.y}`;
|
|
11
|
-
}
|
|
12
|
-
if (instruction.type === 'L') {
|
|
13
|
-
return `L ${instruction.x} ${instruction.y}`;
|
|
14
|
-
}
|
|
15
|
-
if (instruction.type === 'C') {
|
|
16
|
-
return `C ${instruction.cp1x} ${instruction.cp1y} ${instruction.cp2x} ${instruction.cp2y} ${instruction.x} ${instruction.y}`;
|
|
17
|
-
}
|
|
18
|
-
if (instruction.type === 'm') {
|
|
19
|
-
return `m ${instruction.x} ${instruction.y}`;
|
|
20
|
-
}
|
|
21
|
-
if (instruction.type === 'a') {
|
|
22
|
-
return `a ${instruction.rx} ${instruction.ry} ${instruction.xAxisRotation} ${Number(instruction.largeArcFlag)} ${Number(instruction.sweepFlag ? 1 : 0)} ${instruction.x} ${instruction.y}`;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.serializeInstruction = serializeInstruction;
|