@remotion/shapes 4.0.477 → 4.0.479

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.
@@ -58,7 +58,7 @@ const ArrowInner = ({ length, headWidth, headLength, shaftWidth, direction, corn
58
58
  cornerRadius,
59
59
  }), ...props }));
60
60
  };
61
- exports.Arrow = remotion_1.Internals.wrapInSchema({
61
+ exports.Arrow = remotion_1.Interactive.withSchema({
62
62
  Component: ArrowInner,
63
63
  componentIdentity: 'dev.remotion.shapes.Arrow',
64
64
  schema: arrowSchema,
@@ -69,7 +69,7 @@ const CalloutInner = ({ width, height, pointerLength, pointerBaseWidth, pointerP
69
69
  cornerRadius,
70
70
  }), ...props }));
71
71
  };
72
- exports.Callout = remotion_1.Internals.wrapInSchema({
72
+ exports.Callout = remotion_1.Interactive.withSchema({
73
73
  Component: CalloutInner,
74
74
  componentIdentity: 'dev.remotion.shapes.Callout',
75
75
  schema: calloutSchema,
@@ -21,7 +21,7 @@ const circleSchema = (0, schema_1.makeShapeSchema)({
21
21
  const CircleInner = ({ radius, ...props }) => {
22
22
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Circle>", documentationLink: "https://www.remotion.dev/docs/shapes/circle", ...(0, make_circle_1.makeCircle)({ radius }), ...props }));
23
23
  };
24
- exports.Circle = remotion_1.Internals.wrapInSchema({
24
+ exports.Circle = remotion_1.Interactive.withSchema({
25
25
  Component: CircleInner,
26
26
  componentIdentity: 'dev.remotion.shapes.Circle',
27
27
  schema: circleSchema,
@@ -27,7 +27,7 @@ const ellipseSchema = (0, schema_1.makeShapeSchema)({
27
27
  const EllipseInner = ({ rx, ry, ...props }) => {
28
28
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Ellipse>", documentationLink: "https://www.remotion.dev/docs/shapes/ellipse", ...(0, make_ellipse_1.makeEllipse)({ rx, ry }), ...props }));
29
29
  };
30
- exports.Ellipse = remotion_1.Internals.wrapInSchema({
30
+ exports.Ellipse = remotion_1.Interactive.withSchema({
31
31
  Component: EllipseInner,
32
32
  componentIdentity: 'dev.remotion.shapes.Ellipse',
33
33
  schema: ellipseSchema,
@@ -42,7 +42,7 @@ const HeartInner = ({ aspectRatio, height, bottomRoundnessAdjustment = 0, depthA
42
42
  depthAdjustment,
43
43
  }), ...props }));
44
44
  };
45
- exports.Heart = remotion_1.Internals.wrapInSchema({
45
+ exports.Heart = remotion_1.Interactive.withSchema({
46
46
  Component: HeartInner,
47
47
  componentIdentity: 'dev.remotion.shapes.Heart',
48
48
  schema: heartSchema,
@@ -45,7 +45,7 @@ const pieSchema = (0, schema_1.makeShapeSchema)({
45
45
  const PieInner = ({ radius, progress, closePath, counterClockwise, rotation, ...props }) => {
46
46
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Pie>", documentationLink: "https://www.remotion.dev/docs/shapes/pie", ...(0, make_pie_1.makePie)({ radius, progress, closePath, counterClockwise, rotation }), ...props }));
47
47
  };
48
- exports.Pie = remotion_1.Internals.wrapInSchema({
48
+ exports.Pie = remotion_1.Interactive.withSchema({
49
49
  Component: PieInner,
50
50
  componentIdentity: 'dev.remotion.shapes.Pie',
51
51
  schema: pieSchema,
@@ -32,7 +32,7 @@ const PolygonInner = ({ points, radius, cornerRadius, edgeRoundness, ...props })
32
32
  radius,
33
33
  }), ...props }));
34
34
  };
35
- exports.Polygon = remotion_1.Internals.wrapInSchema({
35
+ exports.Polygon = remotion_1.Interactive.withSchema({
36
36
  Component: PolygonInner,
37
37
  componentIdentity: 'dev.remotion.shapes.Polygon',
38
38
  schema: polygonSchema,
@@ -34,7 +34,7 @@ const rectSchema = (0, schema_1.makeShapeSchema)({
34
34
  const RectInner = ({ width, edgeRoundness, height, cornerRadius, ...props }) => {
35
35
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Rect>", documentationLink: "https://www.remotion.dev/docs/shapes/rect", ...(0, make_rect_1.makeRect)({ height, width, edgeRoundness, cornerRadius }), ...props }));
36
36
  };
37
- exports.Rect = remotion_1.Internals.wrapInSchema({
37
+ exports.Rect = remotion_1.Interactive.withSchema({
38
38
  Component: RectInner,
39
39
  componentIdentity: 'dev.remotion.shapes.Rect',
40
40
  schema: rectSchema,
@@ -1,8 +1,8 @@
1
1
  import type { Instruction } from '@remotion/paths';
2
2
  import React from 'react';
3
- import { type EffectsProp, type HtmlInCanvasPixelDensity, type SequenceControls, type SequenceProps } from 'remotion';
4
- type ShapeSequenceProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'> & {
5
- readonly _experimentalControls?: SequenceControls;
3
+ import { type EffectsProp, type HtmlInCanvasPixelDensity, type InteractiveBaseProps, type SequenceControls } from 'remotion';
4
+ type ShapeSequenceProps = InteractiveBaseProps & {
5
+ readonly controls?: SequenceControls;
6
6
  };
7
7
  export type AllShapesProps = Omit<React.SVGProps<SVGPathElement>, 'width' | 'height' | 'd' | 'hidden' | 'name'> & ShapeSequenceProps & {
8
8
  readonly debug?: boolean;
@@ -14,7 +14,7 @@ export type AllShapesProps = Omit<React.SVGProps<SVGPathElement>, 'width' | 'hei
14
14
  */
15
15
  readonly stack?: string;
16
16
  };
17
- export declare const RenderSvg: ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects, instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, _experimentalControls: controls, stack, ...props }: {
17
+ export declare const RenderSvg: ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects, instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, controls, stack, ...props }: {
18
18
  readonly defaultName: string;
19
19
  readonly documentationLink: string;
20
20
  readonly width: number;
@@ -22,8 +22,8 @@ export declare const RenderSvg: ({ defaultName, documentationLink, width, height
22
22
  readonly path: string;
23
23
  readonly instructions: Instruction[];
24
24
  readonly transformOrigin: string;
25
- } & Omit<React.SVGProps<SVGPathElement>, "d" | "height" | "hidden" | "name" | "width"> & Pick<SequenceProps, "durationInFrames" | "freeze" | "from" | "hidden" | "name" | "showInTimeline"> & {
26
- readonly _experimentalControls?: SequenceControls | undefined;
25
+ } & Omit<React.SVGProps<SVGPathElement>, "d" | "height" | "hidden" | "name" | "width"> & InteractiveBaseProps & {
26
+ readonly controls?: SequenceControls | undefined;
27
27
  } & {
28
28
  readonly debug?: boolean | undefined;
29
29
  readonly effects?: EffectsProp | undefined;
@@ -39,7 +39,8 @@ const react_1 = __importStar(require("react"));
39
39
  const react_dom_1 = require("react-dom");
40
40
  const remotion_1 = require("remotion");
41
41
  const does_react_support_canary_1 = require("../utils/does-react-support-canary");
42
- const RenderSvg = ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects = [], instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, _experimentalControls: controls, stack, ...props }) => {
42
+ const HtmlInCanvasWithPrivateProps = remotion_1.HtmlInCanvas;
43
+ const RenderSvg = ({ defaultName, documentationLink, width, height, path, style, pathStyle, transformOrigin, debug, effects = [], instructions, pixelDensity, durationInFrames, from, freeze, hidden, name, showInTimeline, controls, stack, ...props }) => {
43
44
  const actualStyle = (0, react_1.useMemo)(() => {
44
45
  return {
45
46
  overflow: 'visible',
@@ -102,11 +103,11 @@ const RenderSvg = ({ defaultName, documentationLink, width, height, path, style,
102
103
  return null;
103
104
  })
104
105
  : null] }));
105
- const content = effects.length === 0 ? (svg) : (jsx_runtime_1.jsx(remotion_1.HtmlInCanvas, { ref: setCanvasRef, width: Math.ceil(width), height: Math.ceil(height), effects: effects, pixelDensity: pixelDensity, showInTimeline: false, style: actualStyle, _experimentalControls: controls, children: svg }));
106
+ const content = effects.length === 0 ? (svg) : (jsx_runtime_1.jsx(HtmlInCanvasWithPrivateProps, { ref: setCanvasRef, width: Math.ceil(width), height: Math.ceil(height), effects: effects, pixelDensity: pixelDensity, showInTimeline: false, style: actualStyle, controls: controls, children: svg }));
106
107
  const stackProps = stack === undefined ? null : { stack };
107
108
  if (!videoConfig) {
108
109
  return svg;
109
110
  }
110
- return (jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, _experimentalControls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : defaultName, _remotionInternalRefForOutline: outlineRef, _remotionInternalDocumentationLink: name === undefined ? documentationLink : undefined, ...stackProps, children: content }));
111
+ return (jsx_runtime_1.jsx(remotion_1.Sequence, { layout: "none", from: from, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : defaultName, outlineRef: outlineRef, _remotionInternalDocumentationLink: name === undefined ? documentationLink : undefined, ...stackProps, children: content }));
111
112
  };
112
113
  exports.RenderSvg = RenderSvg;
@@ -1,4 +1,4 @@
1
- import { type SequenceFieldSchema, type SequenceSchema } from 'remotion';
1
+ import { type InteractivitySchemaField, type InteractivitySchema } from 'remotion';
2
2
  export declare const numberField: ({ defaultValue, description, hiddenFromList, max, min, step, }: {
3
3
  readonly defaultValue: number | undefined;
4
4
  readonly description: string;
@@ -6,18 +6,18 @@ export declare const numberField: ({ defaultValue, description, hiddenFromList,
6
6
  readonly max?: number | undefined;
7
7
  readonly min?: number | undefined;
8
8
  readonly step?: number | undefined;
9
- }) => SequenceFieldSchema;
9
+ }) => InteractivitySchemaField;
10
10
  export declare const booleanField: ({ defaultValue, description, }: {
11
11
  readonly defaultValue: boolean;
12
12
  readonly description: string;
13
- }) => SequenceFieldSchema;
13
+ }) => InteractivitySchemaField;
14
14
  export declare const colorField: ({ defaultValue, description, }: {
15
15
  readonly defaultValue: string | undefined;
16
16
  readonly description: string;
17
- }) => SequenceFieldSchema;
17
+ }) => InteractivitySchemaField;
18
18
  export declare const enumField: <T extends string>({ defaultValue, description, variants, }: {
19
19
  readonly defaultValue: T;
20
20
  readonly description: string;
21
21
  readonly variants: readonly T[];
22
- }) => SequenceFieldSchema;
23
- export declare const makeShapeSchema: (shapeFields: SequenceSchema) => SequenceSchema;
22
+ }) => InteractivitySchemaField;
23
+ export declare const makeShapeSchema: (shapeFields: InteractivitySchema) => InteractivitySchema;
@@ -41,16 +41,13 @@ const enumField = ({ defaultValue, description, variants, }) => {
41
41
  exports.enumField = enumField;
42
42
  const makeShapeSchema = (shapeFields) => {
43
43
  return {
44
- from: remotion_1.Internals.sequenceSchema.from,
45
- freeze: remotion_1.Internals.sequenceSchema.freeze,
46
- durationInFrames: remotion_1.Internals.sequenceSchema.durationInFrames,
44
+ ...remotion_1.Internals.baseSchema,
47
45
  ...shapeFields,
48
46
  fill: (0, exports.colorField)({
49
47
  defaultValue: '#0b84ff',
50
48
  description: 'Fill',
51
49
  }),
52
- ...remotion_1.Internals.sequenceVisualStyleSchema,
53
- hidden: remotion_1.Internals.sequenceSchema.hidden,
50
+ ...remotion_1.Internals.transformSchema,
54
51
  };
55
52
  };
56
53
  exports.makeShapeSchema = makeShapeSchema;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { MakeSparkProps } from '../utils/make-spark';
3
+ import type { AllShapesProps } from './render-svg';
4
+ export type SparkProps = MakeSparkProps & AllShapesProps;
5
+ export declare const Spark: React.FC<SparkProps>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Spark = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const remotion_1 = require("remotion");
6
+ const make_spark_1 = require("../utils/make-spark");
7
+ const render_svg_1 = require("./render-svg");
8
+ const schema_1 = require("./schema");
9
+ const sparkSchema = (0, schema_1.makeShapeSchema)({
10
+ width: (0, schema_1.numberField)({
11
+ defaultValue: 100,
12
+ description: 'Width',
13
+ min: 0,
14
+ }),
15
+ height: (0, schema_1.numberField)({
16
+ defaultValue: 140,
17
+ description: 'Height',
18
+ min: 0,
19
+ }),
20
+ edgeRoundness: (0, schema_1.numberField)({
21
+ defaultValue: 1,
22
+ description: 'Edge Roundness',
23
+ min: 0,
24
+ step: 0.01,
25
+ }),
26
+ cornerRadius: (0, schema_1.numberField)({
27
+ defaultValue: 0,
28
+ description: 'Corner Radius',
29
+ min: 0,
30
+ }),
31
+ });
32
+ /**
33
+ * @description Renders an SVG element containing a spark.
34
+ * @param {Number} width The width of the spark.
35
+ * @param {Number} height The height of the spark.
36
+ * @param {Number} edgeRoundness Controls the inward curvature between the points. Default 1.
37
+ * @param {Number} cornerRadius Rounds the four points. Default 0.
38
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/spark)
39
+ */
40
+ const SparkInner = ({ width, height, edgeRoundness, cornerRadius, ...props }) => {
41
+ return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Spark>", documentationLink: "https://www.remotion.dev/docs/shapes/spark", ...(0, make_spark_1.makeSpark)({ width, height, edgeRoundness, cornerRadius }), ...props }));
42
+ };
43
+ exports.Spark = remotion_1.Interactive.withSchema({
44
+ Component: SparkInner,
45
+ componentIdentity: 'dev.remotion.shapes.Spark',
46
+ schema: sparkSchema,
47
+ supportsEffects: true,
48
+ });
49
+ remotion_1.Internals.addSequenceStackTraces(exports.Spark);
@@ -47,7 +47,7 @@ const StarInner = ({ innerRadius, outerRadius, points, cornerRadius, edgeRoundne
47
47
  edgeRoundness,
48
48
  }), ...props }));
49
49
  };
50
- exports.Star = remotion_1.Internals.wrapInSchema({
50
+ exports.Star = remotion_1.Interactive.withSchema({
51
51
  Component: StarInner,
52
52
  componentIdentity: 'dev.remotion.shapes.Star',
53
53
  schema: starSchema,
@@ -34,7 +34,7 @@ const triangleSchema = (0, schema_1.makeShapeSchema)({
34
34
  const TriangleInner = ({ length, direction, edgeRoundness, cornerRadius, ...props }) => {
35
35
  return (jsx_runtime_1.jsx(render_svg_1.RenderSvg, { defaultName: "<Triangle>", documentationLink: "https://www.remotion.dev/docs/shapes/triangle", ...(0, make_triangle_1.makeTriangle)({ length, direction, edgeRoundness, cornerRadius }), ...props }));
36
36
  };
37
- exports.Triangle = remotion_1.Internals.wrapInSchema({
37
+ exports.Triangle = remotion_1.Interactive.withSchema({
38
38
  Component: TriangleInner,
39
39
  componentIdentity: 'dev.remotion.shapes.Triangle',
40
40
  schema: triangleSchema,
@@ -1,5 +1,5 @@
1
1
  // src/components/arrow.tsx
2
- import { Internals as Internals3 } from "remotion";
2
+ import { Internals as Internals3, Interactive } from "remotion";
3
3
 
4
4
  // src/utils/make-arrow.ts
5
5
  import { serializeInstructions } from "@remotion/paths";
@@ -160,6 +160,7 @@ var doesReactSupportTransformOriginProperty = (version) => {
160
160
 
161
161
  // src/components/render-svg.tsx
162
162
  import { jsx, jsxs } from "react/jsx-runtime";
163
+ var HtmlInCanvasWithPrivateProps = HtmlInCanvas;
163
164
  var RenderSvg = ({
164
165
  defaultName,
165
166
  documentationLink,
@@ -179,7 +180,7 @@ var RenderSvg = ({
179
180
  hidden,
180
181
  name,
181
182
  showInTimeline,
182
- _experimentalControls: controls,
183
+ controls,
183
184
  stack,
184
185
  ...props
185
186
  }) => {
@@ -266,7 +267,7 @@ var RenderSvg = ({
266
267
  }) : null
267
268
  ]
268
269
  });
269
- const content = effects.length === 0 ? svg : /* @__PURE__ */ jsx(HtmlInCanvas, {
270
+ const content = effects.length === 0 ? svg : /* @__PURE__ */ jsx(HtmlInCanvasWithPrivateProps, {
270
271
  ref: setCanvasRef,
271
272
  width: Math.ceil(width),
272
273
  height: Math.ceil(height),
@@ -274,7 +275,7 @@ var RenderSvg = ({
274
275
  pixelDensity,
275
276
  showInTimeline: false,
276
277
  style: actualStyle,
277
- _experimentalControls: controls,
278
+ controls,
278
279
  children: svg
279
280
  });
280
281
  const stackProps = stack === undefined ? null : { stack };
@@ -287,11 +288,11 @@ var RenderSvg = ({
287
288
  freeze,
288
289
  hidden,
289
290
  showInTimeline,
290
- _experimentalControls: controls,
291
+ controls,
291
292
  _remotionInternalEffects: memoizedEffectDefinitions,
292
293
  durationInFrames,
293
294
  name: name ?? defaultName,
294
- _remotionInternalRefForOutline: outlineRef,
295
+ outlineRef,
295
296
  _remotionInternalDocumentationLink: name === undefined ? documentationLink : undefined,
296
297
  ...stackProps,
297
298
  children: content
@@ -354,16 +355,13 @@ var enumField = ({
354
355
  };
355
356
  var makeShapeSchema = (shapeFields) => {
356
357
  return {
357
- from: Internals2.sequenceSchema.from,
358
- freeze: Internals2.sequenceSchema.freeze,
359
- durationInFrames: Internals2.sequenceSchema.durationInFrames,
358
+ ...Internals2.baseSchema,
360
359
  ...shapeFields,
361
360
  fill: colorField({
362
361
  defaultValue: "#0b84ff",
363
362
  description: "Fill"
364
363
  }),
365
- ...Internals2.sequenceVisualStyleSchema,
366
- hidden: Internals2.sequenceSchema.hidden
364
+ ...Internals2.transformSchema
367
365
  };
368
366
  };
369
367
 
@@ -424,7 +422,7 @@ var ArrowInner = ({
424
422
  ...props
425
423
  });
426
424
  };
427
- var Arrow = Internals3.wrapInSchema({
425
+ var Arrow = Interactive.withSchema({
428
426
  Component: ArrowInner,
429
427
  componentIdentity: "dev.remotion.shapes.Arrow",
430
428
  schema: arrowSchema,
@@ -432,7 +430,7 @@ var Arrow = Internals3.wrapInSchema({
432
430
  });
433
431
  Internals3.addSequenceStackTraces(Arrow);
434
432
  // src/components/callout.tsx
435
- import { Internals as Internals4 } from "remotion";
433
+ import { Internals as Internals4, Interactive as Interactive2 } from "remotion";
436
434
 
437
435
  // src/utils/make-callout.ts
438
436
  import { serializeInstructions as serializeInstructions2 } from "@remotion/paths";
@@ -860,7 +858,7 @@ var CalloutInner = ({
860
858
  ...props
861
859
  });
862
860
  };
863
- var Callout = Internals4.wrapInSchema({
861
+ var Callout = Interactive2.withSchema({
864
862
  Component: CalloutInner,
865
863
  componentIdentity: "dev.remotion.shapes.Callout",
866
864
  schema: calloutSchema,
@@ -868,7 +866,7 @@ var Callout = Internals4.wrapInSchema({
868
866
  });
869
867
  Internals4.addSequenceStackTraces(Callout);
870
868
  // src/components/circle.tsx
871
- import { Internals as Internals5 } from "remotion";
869
+ import { Internals as Internals5, Interactive as Interactive3 } from "remotion";
872
870
 
873
871
  // src/utils/make-circle.ts
874
872
  import { serializeInstructions as serializeInstructions3 } from "@remotion/paths";
@@ -930,7 +928,7 @@ var CircleInner = ({ radius, ...props }) => {
930
928
  ...props
931
929
  });
932
930
  };
933
- var Circle = Internals5.wrapInSchema({
931
+ var Circle = Interactive3.withSchema({
934
932
  Component: CircleInner,
935
933
  componentIdentity: "dev.remotion.shapes.Circle",
936
934
  schema: circleSchema,
@@ -938,7 +936,7 @@ var Circle = Internals5.wrapInSchema({
938
936
  });
939
937
  Internals5.addSequenceStackTraces(Circle);
940
938
  // src/components/ellipse.tsx
941
- import { Internals as Internals6 } from "remotion";
939
+ import { Internals as Internals6, Interactive as Interactive4 } from "remotion";
942
940
 
943
941
  // src/utils/make-ellipse.ts
944
942
  import { serializeInstructions as serializeInstructions4 } from "@remotion/paths";
@@ -995,7 +993,7 @@ var EllipseInner = ({ rx, ry, ...props }) => {
995
993
  ...props
996
994
  });
997
995
  };
998
- var Ellipse = Internals6.wrapInSchema({
996
+ var Ellipse = Interactive4.withSchema({
999
997
  Component: EllipseInner,
1000
998
  componentIdentity: "dev.remotion.shapes.Ellipse",
1001
999
  schema: ellipseSchema,
@@ -1003,7 +1001,7 @@ var Ellipse = Internals6.wrapInSchema({
1003
1001
  });
1004
1002
  Internals6.addSequenceStackTraces(Ellipse);
1005
1003
  // src/components/heart.tsx
1006
- import { Internals as Internals7 } from "remotion";
1004
+ import { Internals as Internals7, Interactive as Interactive5 } from "remotion";
1007
1005
 
1008
1006
  // src/utils/make-heart.ts
1009
1007
  import { serializeInstructions as serializeInstructions5 } from "@remotion/paths";
@@ -1141,7 +1139,7 @@ var HeartInner = ({
1141
1139
  ...props
1142
1140
  });
1143
1141
  };
1144
- var Heart = Internals7.wrapInSchema({
1142
+ var Heart = Interactive5.withSchema({
1145
1143
  Component: HeartInner,
1146
1144
  componentIdentity: "dev.remotion.shapes.Heart",
1147
1145
  schema: heartSchema,
@@ -1149,7 +1147,7 @@ var Heart = Internals7.wrapInSchema({
1149
1147
  });
1150
1148
  Internals7.addSequenceStackTraces(Heart);
1151
1149
  // src/components/pie.tsx
1152
- import { Internals as Internals8 } from "remotion";
1150
+ import { Internals as Internals8, Interactive as Interactive6 } from "remotion";
1153
1151
 
1154
1152
  // src/utils/make-pie.ts
1155
1153
  import { serializeInstructions as serializeInstructions6 } from "@remotion/paths";
@@ -1303,7 +1301,7 @@ var PieInner = ({
1303
1301
  ...props
1304
1302
  });
1305
1303
  };
1306
- var Pie = Internals8.wrapInSchema({
1304
+ var Pie = Interactive6.withSchema({
1307
1305
  Component: PieInner,
1308
1306
  componentIdentity: "dev.remotion.shapes.Pie",
1309
1307
  schema: pieSchema,
@@ -1311,7 +1309,7 @@ var Pie = Internals8.wrapInSchema({
1311
1309
  });
1312
1310
  Internals8.addSequenceStackTraces(Pie);
1313
1311
  // src/components/polygon.tsx
1314
- import { Internals as Internals9 } from "remotion";
1312
+ import { Internals as Internals9, Interactive as Interactive7 } from "remotion";
1315
1313
 
1316
1314
  // src/utils/make-polygon.ts
1317
1315
  import {
@@ -1415,7 +1413,7 @@ var PolygonInner = ({
1415
1413
  ...props
1416
1414
  });
1417
1415
  };
1418
- var Polygon = Internals9.wrapInSchema({
1416
+ var Polygon = Interactive7.withSchema({
1419
1417
  Component: PolygonInner,
1420
1418
  componentIdentity: "dev.remotion.shapes.Polygon",
1421
1419
  schema: polygonSchema,
@@ -1423,7 +1421,7 @@ var Polygon = Internals9.wrapInSchema({
1423
1421
  });
1424
1422
  Internals9.addSequenceStackTraces(Polygon);
1425
1423
  // src/components/rect.tsx
1426
- import { Internals as Internals10 } from "remotion";
1424
+ import { Internals as Internals10, Interactive as Interactive8 } from "remotion";
1427
1425
 
1428
1426
  // src/utils/make-rect.ts
1429
1427
  import { serializeInstructions as serializeInstructions8 } from "@remotion/paths";
@@ -1489,22 +1487,241 @@ var RectInner = ({
1489
1487
  ...props
1490
1488
  });
1491
1489
  };
1492
- var Rect = Internals10.wrapInSchema({
1490
+ var Rect = Interactive8.withSchema({
1493
1491
  Component: RectInner,
1494
1492
  componentIdentity: "dev.remotion.shapes.Rect",
1495
1493
  schema: rectSchema,
1496
1494
  supportsEffects: true
1497
1495
  });
1498
1496
  Internals10.addSequenceStackTraces(Rect);
1497
+ // src/components/spark.tsx
1498
+ import { Internals as Internals11, Interactive as Interactive9 } from "remotion";
1499
+
1500
+ // src/utils/make-spark.ts
1501
+ import { serializeInstructions as serializeInstructions9 } from "@remotion/paths";
1502
+ var KAPPA = 0.5522847498307936;
1503
+ var CAP_HANDLE = 4 / 3;
1504
+ var curve = ({
1505
+ to,
1506
+ cp1,
1507
+ cp2
1508
+ }) => {
1509
+ return {
1510
+ type: "C",
1511
+ cp1x: cp1[0],
1512
+ cp1y: cp1[1],
1513
+ cp2x: cp2[0],
1514
+ cp2y: cp2[1],
1515
+ x: to[0],
1516
+ y: to[1]
1517
+ };
1518
+ };
1519
+ var cap = ({
1520
+ from,
1521
+ to,
1522
+ radius,
1523
+ direction
1524
+ }) => {
1525
+ if (direction === "top") {
1526
+ return curve({
1527
+ to,
1528
+ cp1: [from[0], from[1] - radius * CAP_HANDLE],
1529
+ cp2: [to[0], to[1] - radius * CAP_HANDLE]
1530
+ });
1531
+ }
1532
+ if (direction === "right") {
1533
+ return curve({
1534
+ to,
1535
+ cp1: [from[0] + radius * CAP_HANDLE, from[1]],
1536
+ cp2: [to[0] + radius * CAP_HANDLE, to[1]]
1537
+ });
1538
+ }
1539
+ if (direction === "bottom") {
1540
+ return curve({
1541
+ to,
1542
+ cp1: [from[0], from[1] + radius * CAP_HANDLE],
1543
+ cp2: [to[0], to[1] + radius * CAP_HANDLE]
1544
+ });
1545
+ }
1546
+ return curve({
1547
+ to,
1548
+ cp1: [from[0] - radius * CAP_HANDLE, from[1]],
1549
+ cp2: [to[0] - radius * CAP_HANDLE, to[1]]
1550
+ });
1551
+ };
1552
+ var edge = ({
1553
+ from,
1554
+ to,
1555
+ edgeRoundness,
1556
+ direction
1557
+ }) => {
1558
+ const dx = to[0] - from[0];
1559
+ const dy = to[1] - from[1];
1560
+ const handleX = Math.abs(dx) * KAPPA * edgeRoundness;
1561
+ const handleY = Math.abs(dy) * KAPPA * edgeRoundness;
1562
+ if (direction === "top-right") {
1563
+ return curve({
1564
+ to,
1565
+ cp1: [from[0], from[1] + handleY],
1566
+ cp2: [to[0] - handleX, to[1]]
1567
+ });
1568
+ }
1569
+ if (direction === "right-bottom") {
1570
+ return curve({
1571
+ to,
1572
+ cp1: [from[0] - handleX, from[1]],
1573
+ cp2: [to[0], to[1] - handleY]
1574
+ });
1575
+ }
1576
+ if (direction === "bottom-left") {
1577
+ return curve({
1578
+ to,
1579
+ cp1: [from[0], from[1] - handleY],
1580
+ cp2: [to[0] + handleX, to[1]]
1581
+ });
1582
+ }
1583
+ return curve({
1584
+ to,
1585
+ cp1: [from[0] + handleX, from[1]],
1586
+ cp2: [to[0], to[1] + handleY]
1587
+ });
1588
+ };
1589
+ var clampCornerRadius = ({
1590
+ cornerRadius,
1591
+ width,
1592
+ height
1593
+ }) => {
1594
+ return Math.min(Math.max(cornerRadius, 0), width / 2, height / 2);
1595
+ };
1596
+ var makeSpark = ({
1597
+ width,
1598
+ height,
1599
+ edgeRoundness = 1,
1600
+ cornerRadius = 0
1601
+ }) => {
1602
+ const centerX = width / 2;
1603
+ const centerY = height / 2;
1604
+ const radius = clampCornerRadius({ cornerRadius, width, height });
1605
+ const top = [centerX, 0];
1606
+ const right = [width, centerY];
1607
+ const bottom = [centerX, height];
1608
+ const left = [0, centerY];
1609
+ const topRight = radius === 0 ? top : [centerX + radius, radius];
1610
+ const rightTop = radius === 0 ? right : [width - radius, centerY - radius];
1611
+ const rightBottom = radius === 0 ? right : [width - radius, centerY + radius];
1612
+ const bottomRight = radius === 0 ? bottom : [centerX + radius, height - radius];
1613
+ const bottomLeft = radius === 0 ? bottom : [centerX - radius, height - radius];
1614
+ const leftBottom = radius === 0 ? left : [radius, centerY + radius];
1615
+ const leftTop = radius === 0 ? left : [radius, centerY - radius];
1616
+ const topLeft = radius === 0 ? top : [centerX - radius, radius];
1617
+ const instructions = [
1618
+ {
1619
+ type: "M",
1620
+ x: topRight[0],
1621
+ y: topRight[1]
1622
+ },
1623
+ edge({
1624
+ from: topRight,
1625
+ to: rightTop,
1626
+ edgeRoundness,
1627
+ direction: "top-right"
1628
+ })
1629
+ ];
1630
+ if (radius > 0) {
1631
+ instructions.push(cap({ from: rightTop, to: rightBottom, radius, direction: "right" }));
1632
+ }
1633
+ instructions.push(edge({
1634
+ from: rightBottom,
1635
+ to: bottomRight,
1636
+ edgeRoundness,
1637
+ direction: "right-bottom"
1638
+ }));
1639
+ if (radius > 0) {
1640
+ instructions.push(cap({ from: bottomRight, to: bottomLeft, radius, direction: "bottom" }));
1641
+ }
1642
+ instructions.push(edge({
1643
+ from: bottomLeft,
1644
+ to: leftBottom,
1645
+ edgeRoundness,
1646
+ direction: "bottom-left"
1647
+ }));
1648
+ if (radius > 0) {
1649
+ instructions.push(cap({ from: leftBottom, to: leftTop, radius, direction: "left" }));
1650
+ }
1651
+ instructions.push(edge({
1652
+ from: leftTop,
1653
+ to: topLeft,
1654
+ edgeRoundness,
1655
+ direction: "left-top"
1656
+ }));
1657
+ if (radius > 0) {
1658
+ instructions.push(cap({ from: topLeft, to: topRight, radius, direction: "top" }));
1659
+ }
1660
+ instructions.push({ type: "Z" });
1661
+ return {
1662
+ path: serializeInstructions9(instructions),
1663
+ width,
1664
+ height,
1665
+ transformOrigin: `${centerX} ${centerY}`,
1666
+ instructions
1667
+ };
1668
+ };
1669
+
1670
+ // src/components/spark.tsx
1671
+ import { jsx as jsx10 } from "react/jsx-runtime";
1672
+ var sparkSchema = makeShapeSchema({
1673
+ width: numberField({
1674
+ defaultValue: 100,
1675
+ description: "Width",
1676
+ min: 0
1677
+ }),
1678
+ height: numberField({
1679
+ defaultValue: 140,
1680
+ description: "Height",
1681
+ min: 0
1682
+ }),
1683
+ edgeRoundness: numberField({
1684
+ defaultValue: 1,
1685
+ description: "Edge Roundness",
1686
+ min: 0,
1687
+ step: 0.01
1688
+ }),
1689
+ cornerRadius: numberField({
1690
+ defaultValue: 0,
1691
+ description: "Corner Radius",
1692
+ min: 0
1693
+ })
1694
+ });
1695
+ var SparkInner = ({
1696
+ width,
1697
+ height,
1698
+ edgeRoundness,
1699
+ cornerRadius,
1700
+ ...props
1701
+ }) => {
1702
+ return /* @__PURE__ */ jsx10(RenderSvg, {
1703
+ defaultName: "<Spark>",
1704
+ documentationLink: "https://www.remotion.dev/docs/shapes/spark",
1705
+ ...makeSpark({ width, height, edgeRoundness, cornerRadius }),
1706
+ ...props
1707
+ });
1708
+ };
1709
+ var Spark = Interactive9.withSchema({
1710
+ Component: SparkInner,
1711
+ componentIdentity: "dev.remotion.shapes.Spark",
1712
+ schema: sparkSchema,
1713
+ supportsEffects: true
1714
+ });
1715
+ Internals11.addSequenceStackTraces(Spark);
1499
1716
  // src/components/star.tsx
1500
- import { Internals as Internals11 } from "remotion";
1717
+ import { Internals as Internals12, Interactive as Interactive10 } from "remotion";
1501
1718
 
1502
1719
  // src/utils/make-star.ts
1503
1720
  import {
1504
1721
  PathInternals as PathInternals2,
1505
1722
  reduceInstructions as reduceInstructions2,
1506
1723
  resetPath as resetPath2,
1507
- serializeInstructions as serializeInstructions9
1724
+ serializeInstructions as serializeInstructions10
1508
1725
  } from "@remotion/paths";
1509
1726
  var star = ({
1510
1727
  centerX,
@@ -1555,7 +1772,7 @@ var makeStar = ({
1555
1772
  edgeRoundness
1556
1773
  });
1557
1774
  const reduced = reduceInstructions2(starPathInstructions);
1558
- const path = resetPath2(serializeInstructions9(reduced));
1775
+ const path = resetPath2(serializeInstructions10(reduced));
1559
1776
  const boundingBox = PathInternals2.getBoundingBoxFromInstructions(reduced);
1560
1777
  return {
1561
1778
  path,
@@ -1567,7 +1784,7 @@ var makeStar = ({
1567
1784
  };
1568
1785
 
1569
1786
  // src/components/star.tsx
1570
- import { jsx as jsx10 } from "react/jsx-runtime";
1787
+ import { jsx as jsx11 } from "react/jsx-runtime";
1571
1788
  var starSchema = makeShapeSchema({
1572
1789
  points: numberField({
1573
1790
  defaultValue: 5,
@@ -1599,7 +1816,7 @@ var StarInner = ({
1599
1816
  edgeRoundness,
1600
1817
  ...props
1601
1818
  }) => {
1602
- return /* @__PURE__ */ jsx10(RenderSvg, {
1819
+ return /* @__PURE__ */ jsx11(RenderSvg, {
1603
1820
  defaultName: "<Star>",
1604
1821
  documentationLink: "https://www.remotion.dev/docs/shapes/star",
1605
1822
  ...makeStar({
@@ -1612,18 +1829,18 @@ var StarInner = ({
1612
1829
  ...props
1613
1830
  });
1614
1831
  };
1615
- var Star = Internals11.wrapInSchema({
1832
+ var Star = Interactive10.withSchema({
1616
1833
  Component: StarInner,
1617
1834
  componentIdentity: "dev.remotion.shapes.Star",
1618
1835
  schema: starSchema,
1619
1836
  supportsEffects: true
1620
1837
  });
1621
- Internals11.addSequenceStackTraces(Star);
1838
+ Internals12.addSequenceStackTraces(Star);
1622
1839
  // src/components/triangle.tsx
1623
- import { Internals as Internals12 } from "remotion";
1840
+ import { Internals as Internals13, Interactive as Interactive11 } from "remotion";
1624
1841
 
1625
1842
  // src/utils/make-triangle.ts
1626
- import { serializeInstructions as serializeInstructions10 } from "@remotion/paths";
1843
+ import { serializeInstructions as serializeInstructions11 } from "@remotion/paths";
1627
1844
  var makeTriangle = ({
1628
1845
  length,
1629
1846
  direction = "right",
@@ -1683,7 +1900,7 @@ var makeTriangle = ({
1683
1900
  type: "Z"
1684
1901
  }
1685
1902
  ];
1686
- const path = serializeInstructions10(instructions);
1903
+ const path = serializeInstructions11(instructions);
1687
1904
  return {
1688
1905
  path,
1689
1906
  instructions,
@@ -1694,7 +1911,7 @@ var makeTriangle = ({
1694
1911
  };
1695
1912
 
1696
1913
  // src/components/triangle.tsx
1697
- import { jsx as jsx11 } from "react/jsx-runtime";
1914
+ import { jsx as jsx12 } from "react/jsx-runtime";
1698
1915
  var triangleSchema = makeShapeSchema({
1699
1916
  length: numberField({
1700
1917
  defaultValue: 100,
@@ -1719,23 +1936,24 @@ var TriangleInner = ({
1719
1936
  cornerRadius,
1720
1937
  ...props
1721
1938
  }) => {
1722
- return /* @__PURE__ */ jsx11(RenderSvg, {
1939
+ return /* @__PURE__ */ jsx12(RenderSvg, {
1723
1940
  defaultName: "<Triangle>",
1724
1941
  documentationLink: "https://www.remotion.dev/docs/shapes/triangle",
1725
1942
  ...makeTriangle({ length, direction, edgeRoundness, cornerRadius }),
1726
1943
  ...props
1727
1944
  });
1728
1945
  };
1729
- var Triangle = Internals12.wrapInSchema({
1946
+ var Triangle = Interactive11.withSchema({
1730
1947
  Component: TriangleInner,
1731
1948
  componentIdentity: "dev.remotion.shapes.Triangle",
1732
1949
  schema: triangleSchema,
1733
1950
  supportsEffects: true
1734
1951
  });
1735
- Internals12.addSequenceStackTraces(Triangle);
1952
+ Internals13.addSequenceStackTraces(Triangle);
1736
1953
  export {
1737
1954
  makeTriangle,
1738
1955
  makeStar,
1956
+ makeSpark,
1739
1957
  makeRect,
1740
1958
  makePolygon,
1741
1959
  makePie,
@@ -1746,6 +1964,7 @@ export {
1746
1964
  makeArrow,
1747
1965
  Triangle,
1748
1966
  Star,
1967
+ Spark,
1749
1968
  Rect,
1750
1969
  Polygon,
1751
1970
  Pie,
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { Heart, HeartProps } from './components/heart';
7
7
  export { Pie, PieProps } from './components/pie';
8
8
  export { Polygon, PolygonProps } from './components/polygon';
9
9
  export { Rect, RectProps } from './components/rect';
10
+ export { Spark, SparkProps } from './components/spark';
10
11
  export { Star, StarProps } from './components/star';
11
12
  export { Triangle, TriangleProps } from './components/triangle';
12
13
  export { MakeArrowProps, makeArrow } from './utils/make-arrow';
@@ -17,5 +18,6 @@ export { MakeHeartProps, makeHeart } from './utils/make-heart';
17
18
  export { MakePieProps, makePie } from './utils/make-pie';
18
19
  export { MakePolygonProps, makePolygon } from './utils/make-polygon';
19
20
  export { MakeRectOptions, makeRect } from './utils/make-rect';
21
+ export { MakeSparkProps, makeSpark } from './utils/make-spark';
20
22
  export { MakeStarProps, makeStar } from './utils/make-star';
21
23
  export { MakeTriangleProps, makeTriangle } from './utils/make-triangle';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeTriangle = exports.makeStar = exports.makeRect = exports.makePolygon = exports.makePie = exports.makeHeart = exports.makeEllipse = exports.makeCircle = exports.makeCallout = exports.makeArrow = exports.Triangle = exports.Star = exports.Rect = exports.Polygon = exports.Pie = exports.Heart = exports.Ellipse = exports.Circle = exports.Callout = exports.Arrow = void 0;
3
+ exports.makeTriangle = exports.makeStar = exports.makeSpark = exports.makeRect = exports.makePolygon = exports.makePie = exports.makeHeart = exports.makeEllipse = exports.makeCircle = exports.makeCallout = exports.makeArrow = exports.Triangle = exports.Star = exports.Spark = exports.Rect = exports.Polygon = exports.Pie = exports.Heart = exports.Ellipse = exports.Circle = exports.Callout = exports.Arrow = void 0;
4
4
  const arrow_1 = require("./components/arrow");
5
5
  Object.defineProperty(exports, "Arrow", { enumerable: true, get: function () { return arrow_1.Arrow; } });
6
6
  const callout_1 = require("./components/callout");
@@ -17,6 +17,8 @@ const polygon_1 = require("./components/polygon");
17
17
  Object.defineProperty(exports, "Polygon", { enumerable: true, get: function () { return polygon_1.Polygon; } });
18
18
  const rect_1 = require("./components/rect");
19
19
  Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.Rect; } });
20
+ const spark_1 = require("./components/spark");
21
+ Object.defineProperty(exports, "Spark", { enumerable: true, get: function () { return spark_1.Spark; } });
20
22
  const star_1 = require("./components/star");
21
23
  Object.defineProperty(exports, "Star", { enumerable: true, get: function () { return star_1.Star; } });
22
24
  const triangle_1 = require("./components/triangle");
@@ -37,6 +39,8 @@ const make_polygon_1 = require("./utils/make-polygon");
37
39
  Object.defineProperty(exports, "makePolygon", { enumerable: true, get: function () { return make_polygon_1.makePolygon; } });
38
40
  const make_rect_1 = require("./utils/make-rect");
39
41
  Object.defineProperty(exports, "makeRect", { enumerable: true, get: function () { return make_rect_1.makeRect; } });
42
+ const make_spark_1 = require("./utils/make-spark");
43
+ Object.defineProperty(exports, "makeSpark", { enumerable: true, get: function () { return make_spark_1.makeSpark; } });
40
44
  const make_star_1 = require("./utils/make-star");
41
45
  Object.defineProperty(exports, "makeStar", { enumerable: true, get: function () { return make_star_1.makeStar; } });
42
46
  const make_triangle_1 = require("./utils/make-triangle");
@@ -0,0 +1,16 @@
1
+ import type { ShapeInfo } from './shape-info';
2
+ export type MakeSparkProps = {
3
+ width: number;
4
+ height: number;
5
+ edgeRoundness?: number;
6
+ cornerRadius?: number;
7
+ };
8
+ /**
9
+ * @description Generates a spark SVG path.
10
+ * @param {Number} width The width of the spark.
11
+ * @param {Number} height The height of the spark.
12
+ * @param {Number} edgeRoundness Controls the inward curvature between the points. Default 1.
13
+ * @param {Number} cornerRadius Rounds the four points. Default 0.
14
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/make-spark)
15
+ */
16
+ export declare const makeSpark: ({ width, height, edgeRoundness, cornerRadius, }: MakeSparkProps) => ShapeInfo;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeSpark = void 0;
4
+ const paths_1 = require("@remotion/paths");
5
+ const KAPPA = 0.5522847498307936;
6
+ const CAP_HANDLE = 4 / 3;
7
+ const curve = ({ to, cp1, cp2, }) => {
8
+ return {
9
+ type: 'C',
10
+ cp1x: cp1[0],
11
+ cp1y: cp1[1],
12
+ cp2x: cp2[0],
13
+ cp2y: cp2[1],
14
+ x: to[0],
15
+ y: to[1],
16
+ };
17
+ };
18
+ const cap = ({ from, to, radius, direction, }) => {
19
+ if (direction === 'top') {
20
+ return curve({
21
+ to,
22
+ cp1: [from[0], from[1] - radius * CAP_HANDLE],
23
+ cp2: [to[0], to[1] - radius * CAP_HANDLE],
24
+ });
25
+ }
26
+ if (direction === 'right') {
27
+ return curve({
28
+ to,
29
+ cp1: [from[0] + radius * CAP_HANDLE, from[1]],
30
+ cp2: [to[0] + radius * CAP_HANDLE, to[1]],
31
+ });
32
+ }
33
+ if (direction === 'bottom') {
34
+ return curve({
35
+ to,
36
+ cp1: [from[0], from[1] + radius * CAP_HANDLE],
37
+ cp2: [to[0], to[1] + radius * CAP_HANDLE],
38
+ });
39
+ }
40
+ return curve({
41
+ to,
42
+ cp1: [from[0] - radius * CAP_HANDLE, from[1]],
43
+ cp2: [to[0] - radius * CAP_HANDLE, to[1]],
44
+ });
45
+ };
46
+ const edge = ({ from, to, edgeRoundness, direction, }) => {
47
+ const dx = to[0] - from[0];
48
+ const dy = to[1] - from[1];
49
+ const handleX = Math.abs(dx) * KAPPA * edgeRoundness;
50
+ const handleY = Math.abs(dy) * KAPPA * edgeRoundness;
51
+ if (direction === 'top-right') {
52
+ return curve({
53
+ to,
54
+ cp1: [from[0], from[1] + handleY],
55
+ cp2: [to[0] - handleX, to[1]],
56
+ });
57
+ }
58
+ if (direction === 'right-bottom') {
59
+ return curve({
60
+ to,
61
+ cp1: [from[0] - handleX, from[1]],
62
+ cp2: [to[0], to[1] - handleY],
63
+ });
64
+ }
65
+ if (direction === 'bottom-left') {
66
+ return curve({
67
+ to,
68
+ cp1: [from[0], from[1] - handleY],
69
+ cp2: [to[0] + handleX, to[1]],
70
+ });
71
+ }
72
+ return curve({
73
+ to,
74
+ cp1: [from[0] + handleX, from[1]],
75
+ cp2: [to[0], to[1] + handleY],
76
+ });
77
+ };
78
+ const clampCornerRadius = ({ cornerRadius, width, height, }) => {
79
+ return Math.min(Math.max(cornerRadius, 0), width / 2, height / 2);
80
+ };
81
+ /**
82
+ * @description Generates a spark SVG path.
83
+ * @param {Number} width The width of the spark.
84
+ * @param {Number} height The height of the spark.
85
+ * @param {Number} edgeRoundness Controls the inward curvature between the points. Default 1.
86
+ * @param {Number} cornerRadius Rounds the four points. Default 0.
87
+ * @see [Documentation](https://www.remotion.dev/docs/shapes/make-spark)
88
+ */
89
+ const makeSpark = ({ width, height, edgeRoundness = 1, cornerRadius = 0, }) => {
90
+ const centerX = width / 2;
91
+ const centerY = height / 2;
92
+ const radius = clampCornerRadius({ cornerRadius, width, height });
93
+ const top = [centerX, 0];
94
+ const right = [width, centerY];
95
+ const bottom = [centerX, height];
96
+ const left = [0, centerY];
97
+ const topRight = radius === 0 ? top : [centerX + radius, radius];
98
+ const rightTop = radius === 0 ? right : [width - radius, centerY - radius];
99
+ const rightBottom = radius === 0 ? right : [width - radius, centerY + radius];
100
+ const bottomRight = radius === 0 ? bottom : [centerX + radius, height - radius];
101
+ const bottomLeft = radius === 0 ? bottom : [centerX - radius, height - radius];
102
+ const leftBottom = radius === 0 ? left : [radius, centerY + radius];
103
+ const leftTop = radius === 0 ? left : [radius, centerY - radius];
104
+ const topLeft = radius === 0 ? top : [centerX - radius, radius];
105
+ const instructions = [
106
+ {
107
+ type: 'M',
108
+ x: topRight[0],
109
+ y: topRight[1],
110
+ },
111
+ edge({
112
+ from: topRight,
113
+ to: rightTop,
114
+ edgeRoundness,
115
+ direction: 'top-right',
116
+ }),
117
+ ];
118
+ if (radius > 0) {
119
+ instructions.push(cap({ from: rightTop, to: rightBottom, radius, direction: 'right' }));
120
+ }
121
+ instructions.push(edge({
122
+ from: rightBottom,
123
+ to: bottomRight,
124
+ edgeRoundness,
125
+ direction: 'right-bottom',
126
+ }));
127
+ if (radius > 0) {
128
+ instructions.push(cap({ from: bottomRight, to: bottomLeft, radius, direction: 'bottom' }));
129
+ }
130
+ instructions.push(edge({
131
+ from: bottomLeft,
132
+ to: leftBottom,
133
+ edgeRoundness,
134
+ direction: 'bottom-left',
135
+ }));
136
+ if (radius > 0) {
137
+ instructions.push(cap({ from: leftBottom, to: leftTop, radius, direction: 'left' }));
138
+ }
139
+ instructions.push(edge({
140
+ from: leftTop,
141
+ to: topLeft,
142
+ edgeRoundness,
143
+ direction: 'left-top',
144
+ }));
145
+ if (radius > 0) {
146
+ instructions.push(cap({ from: topLeft, to: topRight, radius, direction: 'top' }));
147
+ }
148
+ instructions.push({ type: 'Z' });
149
+ return {
150
+ path: (0, paths_1.serializeInstructions)(instructions),
151
+ width,
152
+ height,
153
+ transformOrigin: `${centerX} ${centerY}`,
154
+ instructions,
155
+ };
156
+ };
157
+ exports.makeSpark = makeSpark;
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.477",
6
+ "version": "4.0.479",
7
7
  "description": "Generate SVG shapes",
8
8
  "main": "dist/index.js",
9
9
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "react": "19.2.3",
35
35
  "react-dom": "19.2.3",
36
36
  "@happy-dom/global-registrator": "14.5.1",
37
- "@remotion/eslint-config-internal": "4.0.477",
37
+ "@remotion/eslint-config-internal": "4.0.479",
38
38
  "eslint": "9.19.0",
39
39
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
40
40
  },
@@ -51,8 +51,8 @@
51
51
  "react-dom": ">=16.8.0"
52
52
  },
53
53
  "dependencies": {
54
- "@remotion/paths": "4.0.477",
55
- "remotion": "4.0.477"
54
+ "@remotion/paths": "4.0.479",
55
+ "remotion": "4.0.479"
56
56
  },
57
57
  "homepage": "https://www.remotion.dev/docs/shapes"
58
58
  }