@remotion/shapes 4.0.314 → 4.0.315

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.
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { MakeHeartProps } from '../utils/make-heart';
3
+ import type { AllShapesProps } from './render-svg';
4
+ export type HeartProps = MakeHeartProps & AllShapesProps;
5
+ /**
6
+ * @description Renders an SVG element containing a heart.
7
+ * @param {Number} size The size of the heart.
8
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/heart)
9
+ */
10
+ export declare const Heart: React.FC<HeartProps>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Heart = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const make_heart_1 = require("../utils/make-heart");
6
+ const render_svg_1 = require("./render-svg");
7
+ /**
8
+ * @description Renders an SVG element containing a heart.
9
+ * @param {Number} size The size of the heart.
10
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/heart)
11
+ */
12
+ const Heart = ({ aspectRatio, height, bottomRoundnessAdjustment = 0, depthAdjustment = 0, ...props }) => {
13
+ return ((0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_heart_1.makeHeart)({
14
+ aspectRatio,
15
+ height,
16
+ bottomRoundnessAdjustment,
17
+ depthAdjustment,
18
+ }), ...props }));
19
+ };
20
+ exports.Heart = Heart;
@@ -192,8 +192,119 @@ var Ellipse = ({ rx, ry, ...props }) => {
192
192
  ...props
193
193
  });
194
194
  };
195
- // src/utils/make-pie.ts
195
+ // src/utils/make-heart.ts
196
196
  import { serializeInstructions as serializeInstructions3 } from "@remotion/paths";
197
+ var makeHeart = ({
198
+ height,
199
+ aspectRatio = 1.1,
200
+ bottomRoundnessAdjustment = 0,
201
+ depthAdjustment = 0
202
+ }) => {
203
+ const width = height * aspectRatio;
204
+ const bottomControlPointX = 23 / 110 * width + bottomRoundnessAdjustment * width;
205
+ const bottomControlPointY = 69 / 100 * height;
206
+ const bottomLeftControlPointY = 60 / 100 * height;
207
+ const topLeftControlPoint = 13 / 100 * height;
208
+ const topBezierWidth = 29 / 110 * width;
209
+ const topRightControlPointX = 15 / 110 * width;
210
+ const innerControlPointX = 5 / 110 * width;
211
+ const innerControlPointY = 7 / 100 * height;
212
+ const depth = 17 / 100 * height + depthAdjustment * height;
213
+ const instructions = [
214
+ {
215
+ type: "M",
216
+ x: width / 2,
217
+ y: height
218
+ },
219
+ {
220
+ type: "C",
221
+ cp1x: width / 2 - bottomControlPointX,
222
+ cp1y: bottomControlPointY,
223
+ cp2x: 0,
224
+ cp2y: bottomLeftControlPointY,
225
+ x: 0,
226
+ y: height / 4
227
+ },
228
+ {
229
+ type: "C",
230
+ cp1x: 0,
231
+ cp1y: topLeftControlPoint,
232
+ cp2x: width / 4 - topBezierWidth / 2,
233
+ cp2y: 0,
234
+ x: width / 4,
235
+ y: 0
236
+ },
237
+ {
238
+ type: "C",
239
+ cp1x: width / 4 + topBezierWidth / 2,
240
+ cp1y: 0,
241
+ cp2x: width / 2 - innerControlPointX,
242
+ cp2y: innerControlPointY,
243
+ x: width / 2,
244
+ y: depth
245
+ },
246
+ {
247
+ type: "C",
248
+ cp1x: width / 2 + innerControlPointX,
249
+ cp1y: innerControlPointY,
250
+ cp2x: width / 2 + topRightControlPointX,
251
+ cp2y: 0,
252
+ x: width / 4 * 3,
253
+ y: 0
254
+ },
255
+ {
256
+ type: "C",
257
+ cp1x: width / 4 * 3 + topBezierWidth / 2,
258
+ cp1y: 0,
259
+ cp2x: width,
260
+ cp2y: topLeftControlPoint,
261
+ x: width,
262
+ y: height / 4
263
+ },
264
+ {
265
+ type: "C",
266
+ x: width / 2,
267
+ y: height,
268
+ cp1x: width,
269
+ cp1y: bottomLeftControlPointY,
270
+ cp2x: width / 2 + bottomControlPointX,
271
+ cp2y: bottomControlPointY
272
+ },
273
+ {
274
+ type: "Z"
275
+ }
276
+ ];
277
+ const path = serializeInstructions3(instructions);
278
+ return {
279
+ path,
280
+ width,
281
+ height,
282
+ transformOrigin: `${width / 2} ${height / 2}`,
283
+ instructions
284
+ };
285
+ };
286
+
287
+ // src/components/heart.tsx
288
+ import { jsx as jsx4 } from "react/jsx-runtime";
289
+ var Heart = ({
290
+ aspectRatio,
291
+ height,
292
+ bottomRoundnessAdjustment = 0,
293
+ depthAdjustment = 0,
294
+ ...props
295
+ }) => {
296
+ return /* @__PURE__ */ jsx4(RenderSvg, {
297
+ ...makeHeart({
298
+ aspectRatio,
299
+ height,
300
+ bottomRoundnessAdjustment,
301
+ depthAdjustment
302
+ }),
303
+ ...props
304
+ });
305
+ };
306
+ // src/utils/make-pie.ts
307
+ import { serializeInstructions as serializeInstructions4 } from "@remotion/paths";
197
308
  var getCoord = ({
198
309
  counterClockwise,
199
310
  actualProgress,
@@ -290,7 +401,7 @@ var makePie = ({
290
401
  type: "Z"
291
402
  } : null
292
403
  ].filter(Boolean);
293
- const path = serializeInstructions3(instructions);
404
+ const path = serializeInstructions4(instructions);
294
405
  return {
295
406
  height: radius * 2,
296
407
  width: radius * 2,
@@ -301,7 +412,7 @@ var makePie = ({
301
412
  };
302
413
 
303
414
  // src/components/pie.tsx
304
- import { jsx as jsx4 } from "react/jsx-runtime";
415
+ import { jsx as jsx5 } from "react/jsx-runtime";
305
416
  var Pie = ({
306
417
  radius,
307
418
  progress,
@@ -310,7 +421,7 @@ var Pie = ({
310
421
  rotation,
311
422
  ...props
312
423
  }) => {
313
- return /* @__PURE__ */ jsx4(RenderSvg, {
424
+ return /* @__PURE__ */ jsx5(RenderSvg, {
314
425
  ...makePie({ radius, progress, closePath, counterClockwise, rotation }),
315
426
  ...props
316
427
  });
@@ -320,7 +431,7 @@ import {
320
431
  PathInternals,
321
432
  reduceInstructions,
322
433
  resetPath,
323
- serializeInstructions as serializeInstructions4
434
+ serializeInstructions as serializeInstructions5
324
435
  } from "@remotion/paths";
325
436
 
326
437
  // src/utils/join-points.ts
@@ -495,7 +606,7 @@ var makePolygon = ({
495
606
  edgeRoundness
496
607
  });
497
608
  const reduced = reduceInstructions(polygonPathInstructions);
498
- const path = resetPath(serializeInstructions4(reduced));
609
+ const path = resetPath(serializeInstructions5(reduced));
499
610
  const boundingBox = PathInternals.getBoundingBoxFromInstructions(reduced);
500
611
  return {
501
612
  path,
@@ -507,7 +618,7 @@ var makePolygon = ({
507
618
  };
508
619
 
509
620
  // src/components/polygon.tsx
510
- import { jsx as jsx5 } from "react/jsx-runtime";
621
+ import { jsx as jsx6 } from "react/jsx-runtime";
511
622
  var Polygon = ({
512
623
  points,
513
624
  radius,
@@ -515,7 +626,7 @@ var Polygon = ({
515
626
  edgeRoundness,
516
627
  ...props
517
628
  }) => {
518
- return /* @__PURE__ */ jsx5(RenderSvg, {
629
+ return /* @__PURE__ */ jsx6(RenderSvg, {
519
630
  ...makePolygon({
520
631
  points,
521
632
  cornerRadius,
@@ -526,7 +637,7 @@ var Polygon = ({
526
637
  });
527
638
  };
528
639
  // src/utils/make-rect.ts
529
- import { serializeInstructions as serializeInstructions5 } from "@remotion/paths";
640
+ import { serializeInstructions as serializeInstructions6 } from "@remotion/paths";
530
641
  var makeRect = ({
531
642
  width,
532
643
  height,
@@ -546,7 +657,7 @@ var makeRect = ({
546
657
  type: "Z"
547
658
  }
548
659
  ];
549
- const path = serializeInstructions5(instructions);
660
+ const path = serializeInstructions6(instructions);
550
661
  return {
551
662
  width,
552
663
  height,
@@ -557,7 +668,7 @@ var makeRect = ({
557
668
  };
558
669
 
559
670
  // src/components/rect.tsx
560
- import { jsx as jsx6 } from "react/jsx-runtime";
671
+ import { jsx as jsx7 } from "react/jsx-runtime";
561
672
  var Rect = ({
562
673
  width,
563
674
  edgeRoundness,
@@ -565,7 +676,7 @@ var Rect = ({
565
676
  cornerRadius,
566
677
  ...props
567
678
  }) => {
568
- return /* @__PURE__ */ jsx6(RenderSvg, {
679
+ return /* @__PURE__ */ jsx7(RenderSvg, {
569
680
  ...makeRect({ height, width, edgeRoundness, cornerRadius }),
570
681
  ...props
571
682
  });
@@ -575,7 +686,7 @@ import {
575
686
  PathInternals as PathInternals2,
576
687
  reduceInstructions as reduceInstructions2,
577
688
  resetPath as resetPath2,
578
- serializeInstructions as serializeInstructions6
689
+ serializeInstructions as serializeInstructions7
579
690
  } from "@remotion/paths";
580
691
  var star = ({
581
692
  centerX,
@@ -626,7 +737,7 @@ var makeStar = ({
626
737
  edgeRoundness
627
738
  });
628
739
  const reduced = reduceInstructions2(starPathInstructions);
629
- const path = resetPath2(serializeInstructions6(reduced));
740
+ const path = resetPath2(serializeInstructions7(reduced));
630
741
  const boundingBox = PathInternals2.getBoundingBoxFromInstructions(reduced);
631
742
  return {
632
743
  path,
@@ -638,7 +749,7 @@ var makeStar = ({
638
749
  };
639
750
 
640
751
  // src/components/star.tsx
641
- import { jsx as jsx7 } from "react/jsx-runtime";
752
+ import { jsx as jsx8 } from "react/jsx-runtime";
642
753
  var Star = ({
643
754
  innerRadius,
644
755
  outerRadius,
@@ -647,7 +758,7 @@ var Star = ({
647
758
  edgeRoundness,
648
759
  ...props
649
760
  }) => {
650
- return /* @__PURE__ */ jsx7(RenderSvg, {
761
+ return /* @__PURE__ */ jsx8(RenderSvg, {
651
762
  ...makeStar({
652
763
  innerRadius,
653
764
  outerRadius,
@@ -659,7 +770,7 @@ var Star = ({
659
770
  });
660
771
  };
661
772
  // src/utils/make-triangle.ts
662
- import { serializeInstructions as serializeInstructions7 } from "@remotion/paths";
773
+ import { serializeInstructions as serializeInstructions8 } from "@remotion/paths";
663
774
  var makeTriangle = ({
664
775
  length,
665
776
  direction = "right",
@@ -719,7 +830,7 @@ var makeTriangle = ({
719
830
  type: "Z"
720
831
  }
721
832
  ];
722
- const path = serializeInstructions7(instructions);
833
+ const path = serializeInstructions8(instructions);
723
834
  return {
724
835
  path,
725
836
  instructions,
@@ -730,7 +841,7 @@ var makeTriangle = ({
730
841
  };
731
842
 
732
843
  // src/components/triangle.tsx
733
- import { jsx as jsx8 } from "react/jsx-runtime";
844
+ import { jsx as jsx9 } from "react/jsx-runtime";
734
845
  var Triangle = ({
735
846
  length,
736
847
  direction,
@@ -738,7 +849,7 @@ var Triangle = ({
738
849
  cornerRadius,
739
850
  ...props
740
851
  }) => {
741
- return /* @__PURE__ */ jsx8(RenderSvg, {
852
+ return /* @__PURE__ */ jsx9(RenderSvg, {
742
853
  ...makeTriangle({ length, direction, edgeRoundness, cornerRadius }),
743
854
  ...props
744
855
  });
@@ -749,6 +860,7 @@ export {
749
860
  makeRect,
750
861
  makePolygon,
751
862
  makePie,
863
+ makeHeart,
752
864
  makeEllipse,
753
865
  makeCircle,
754
866
  Triangle,
@@ -756,6 +868,7 @@ export {
756
868
  Rect,
757
869
  Polygon,
758
870
  Pie,
871
+ Heart,
759
872
  Ellipse,
760
873
  Circle
761
874
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type { Instruction } from '@remotion/paths';
2
2
  export { Circle, CircleProps } from './components/circle';
3
3
  export { Ellipse, EllipseProps } from './components/ellipse';
4
+ export { Heart, HeartProps } from './components/heart';
4
5
  export { Pie, PieProps } from './components/pie';
5
6
  export { Polygon, PolygonProps } from './components/polygon';
6
7
  export { Rect, RectProps } from './components/rect';
@@ -8,6 +9,7 @@ export { Star, StarProps } from './components/star';
8
9
  export { Triangle, TriangleProps } from './components/triangle';
9
10
  export { MakeCircleProps, makeCircle } from './utils/make-circle';
10
11
  export { MakeEllipseOptions, makeEllipse } from './utils/make-ellipse';
12
+ export { MakeHeartProps, makeHeart } from './utils/make-heart';
11
13
  export { MakePieProps, makePie } from './utils/make-pie';
12
14
  export { MakePolygonProps, makePolygon } from './utils/make-polygon';
13
15
  export { MakeRectOptions, makeRect } from './utils/make-rect';
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeTriangle = exports.makeStar = exports.makeRect = exports.makePolygon = exports.makePie = exports.makeEllipse = exports.makeCircle = exports.Triangle = exports.Star = exports.Rect = exports.Polygon = exports.Pie = exports.Ellipse = exports.Circle = void 0;
3
+ exports.makeTriangle = exports.makeStar = exports.makeRect = exports.makePolygon = exports.makePie = exports.makeHeart = exports.makeEllipse = exports.makeCircle = exports.Triangle = exports.Star = exports.Rect = exports.Polygon = exports.Pie = exports.Heart = exports.Ellipse = exports.Circle = void 0;
4
4
  var circle_1 = require("./components/circle");
5
5
  Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.Circle; } });
6
6
  var ellipse_1 = require("./components/ellipse");
7
7
  Object.defineProperty(exports, "Ellipse", { enumerable: true, get: function () { return ellipse_1.Ellipse; } });
8
+ var heart_1 = require("./components/heart");
9
+ Object.defineProperty(exports, "Heart", { enumerable: true, get: function () { return heart_1.Heart; } });
8
10
  var pie_1 = require("./components/pie");
9
11
  Object.defineProperty(exports, "Pie", { enumerable: true, get: function () { return pie_1.Pie; } });
10
12
  var polygon_1 = require("./components/polygon");
@@ -19,6 +21,8 @@ var make_circle_1 = require("./utils/make-circle");
19
21
  Object.defineProperty(exports, "makeCircle", { enumerable: true, get: function () { return make_circle_1.makeCircle; } });
20
22
  var make_ellipse_1 = require("./utils/make-ellipse");
21
23
  Object.defineProperty(exports, "makeEllipse", { enumerable: true, get: function () { return make_ellipse_1.makeEllipse; } });
24
+ var make_heart_1 = require("./utils/make-heart");
25
+ Object.defineProperty(exports, "makeHeart", { enumerable: true, get: function () { return make_heart_1.makeHeart; } });
22
26
  var make_pie_1 = require("./utils/make-pie");
23
27
  Object.defineProperty(exports, "makePie", { enumerable: true, get: function () { return make_pie_1.makePie; } });
24
28
  var make_polygon_1 = require("./utils/make-polygon");
@@ -0,0 +1,13 @@
1
+ import type { ShapeInfo } from './shape-info';
2
+ export type MakeHeartProps = {
3
+ height: number;
4
+ aspectRatio?: number;
5
+ bottomRoundnessAdjustment?: number;
6
+ depthAdjustment?: number;
7
+ };
8
+ /**
9
+ * @description Generates a heart SVG path.
10
+ * @param {Number} size The size of the heart.
11
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/make-heart)
12
+ */
13
+ export declare const makeHeart: ({ height, aspectRatio, bottomRoundnessAdjustment, depthAdjustment, }: MakeHeartProps) => ShapeInfo;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeHeart = void 0;
4
+ const paths_1 = require("@remotion/paths");
5
+ /**
6
+ * @description Generates a heart SVG path.
7
+ * @param {Number} size The size of the heart.
8
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/make-heart)
9
+ */
10
+ const makeHeart = ({ height, aspectRatio = 1.1, bottomRoundnessAdjustment = 0, depthAdjustment = 0, }) => {
11
+ const width = height * aspectRatio;
12
+ const bottomControlPointX = (23 / 110) * width + bottomRoundnessAdjustment * width;
13
+ const bottomControlPointY = (69 / 100) * height;
14
+ const bottomLeftControlPointY = (60 / 100) * height;
15
+ const topLeftControlPoint = (13 / 100) * height;
16
+ const topBezierWidth = (29 / 110) * width;
17
+ const topRightControlPointX = (15 / 110) * width;
18
+ const innerControlPointX = (5 / 110) * width;
19
+ const innerControlPointY = (7 / 100) * height;
20
+ const depth = (17 / 100) * height + depthAdjustment * height;
21
+ const instructions = [
22
+ {
23
+ type: 'M',
24
+ x: width / 2,
25
+ y: height,
26
+ },
27
+ {
28
+ type: 'C',
29
+ cp1x: width / 2 - bottomControlPointX,
30
+ cp1y: bottomControlPointY,
31
+ cp2x: 0,
32
+ cp2y: bottomLeftControlPointY,
33
+ x: 0,
34
+ y: height / 4,
35
+ },
36
+ {
37
+ type: 'C',
38
+ cp1x: 0,
39
+ cp1y: topLeftControlPoint,
40
+ cp2x: width / 4 - topBezierWidth / 2,
41
+ cp2y: 0,
42
+ x: width / 4,
43
+ y: 0,
44
+ },
45
+ {
46
+ type: 'C',
47
+ cp1x: width / 4 + topBezierWidth / 2,
48
+ cp1y: 0,
49
+ cp2x: width / 2 - innerControlPointX,
50
+ cp2y: innerControlPointY,
51
+ x: width / 2,
52
+ y: depth,
53
+ },
54
+ {
55
+ type: 'C',
56
+ cp1x: width / 2 + innerControlPointX,
57
+ cp1y: innerControlPointY,
58
+ cp2x: width / 2 + topRightControlPointX,
59
+ cp2y: 0,
60
+ x: (width / 4) * 3,
61
+ y: 0,
62
+ },
63
+ {
64
+ type: 'C',
65
+ cp1x: (width / 4) * 3 + topBezierWidth / 2,
66
+ cp1y: 0,
67
+ cp2x: width,
68
+ cp2y: topLeftControlPoint,
69
+ x: width,
70
+ y: height / 4,
71
+ },
72
+ {
73
+ type: 'C',
74
+ x: width / 2,
75
+ y: height,
76
+ cp1x: width,
77
+ cp1y: bottomLeftControlPointY,
78
+ cp2x: width / 2 + bottomControlPointX,
79
+ cp2y: bottomControlPointY,
80
+ },
81
+ {
82
+ type: 'Z',
83
+ },
84
+ ];
85
+ const path = (0, paths_1.serializeInstructions)(instructions);
86
+ return {
87
+ path,
88
+ width,
89
+ height,
90
+ transformOrigin: `${width / 2} ${height / 2}`,
91
+ instructions,
92
+ };
93
+ };
94
+ exports.makeHeart = makeHeart;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/shapes"
4
4
  },
5
5
  "name": "@remotion/shapes",
6
- "version": "4.0.314",
6
+ "version": "4.0.315",
7
7
  "description": "Generate SVG shapes",
8
8
  "main": "dist/index.js",
9
9
  "sideEffects": false,
@@ -29,7 +29,7 @@
29
29
  "react-dom": "19.0.0",
30
30
  "@happy-dom/global-registrator": "14.5.1",
31
31
  "eslint": "9.19.0",
32
- "@remotion/eslint-config-internal": "4.0.314"
32
+ "@remotion/eslint-config-internal": "4.0.315"
33
33
  },
34
34
  "keywords": [
35
35
  "svg",
@@ -44,7 +44,7 @@
44
44
  "react-dom": ">=16.8.0"
45
45
  },
46
46
  "dependencies": {
47
- "@remotion/paths": "4.0.314"
47
+ "@remotion/paths": "4.0.315"
48
48
  },
49
49
  "homepage": "https://www.remotion.dev/docs/shapes",
50
50
  "scripts": {