@remotion/rough-notation 4.0.534 → 4.0.536
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/esm/index.mjs +36 -48
- package/package.json +4 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -8,14 +8,8 @@ import {
|
|
|
8
8
|
} from "remotion";
|
|
9
9
|
|
|
10
10
|
// src/create-annotation.tsx
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
useEffect as useEffect2,
|
|
14
|
-
useLayoutEffect,
|
|
15
|
-
useMemo as useMemo2,
|
|
16
|
-
useState as useState2
|
|
17
|
-
} from "react";
|
|
18
|
-
import { continueRender, delayRender, useCurrentFrame } from "remotion";
|
|
11
|
+
import { createRef, useLayoutEffect, useMemo as useMemo2, useState as useState2 } from "react";
|
|
12
|
+
import { useCurrentFrame, useDelayRender } from "remotion";
|
|
19
13
|
|
|
20
14
|
// src/element-size.ts
|
|
21
15
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -1477,12 +1471,12 @@ var makeArc = ({
|
|
|
1477
1471
|
t
|
|
1478
1472
|
});
|
|
1479
1473
|
});
|
|
1480
|
-
const
|
|
1474
|
+
const length = lengthProperties.arcLength;
|
|
1481
1475
|
const getPointAtLength = (fractionLength) => {
|
|
1482
1476
|
if (fractionLength < 0) {
|
|
1483
1477
|
fractionLength = 0;
|
|
1484
|
-
} else if (fractionLength >
|
|
1485
|
-
fractionLength =
|
|
1478
|
+
} else if (fractionLength > length) {
|
|
1479
|
+
fractionLength = length;
|
|
1486
1480
|
}
|
|
1487
1481
|
const position = pointOnEllipticalArc({
|
|
1488
1482
|
p0: { x: x0, y: y0 },
|
|
@@ -1492,7 +1486,7 @@ var makeArc = ({
|
|
|
1492
1486
|
largeArcFlag: LargeArcFlag,
|
|
1493
1487
|
sweepFlag: SweepFlag,
|
|
1494
1488
|
p1: { x: x1, y: y1 },
|
|
1495
|
-
t: fractionLength /
|
|
1489
|
+
t: fractionLength / length
|
|
1496
1490
|
});
|
|
1497
1491
|
return { x: position.x, y: position.y };
|
|
1498
1492
|
};
|
|
@@ -1501,18 +1495,18 @@ var makeArc = ({
|
|
|
1501
1495
|
getTangentAtLength: (fractionLength) => {
|
|
1502
1496
|
if (fractionLength < 0) {
|
|
1503
1497
|
fractionLength = 0;
|
|
1504
|
-
} else if (fractionLength >
|
|
1505
|
-
fractionLength =
|
|
1498
|
+
} else if (fractionLength > length) {
|
|
1499
|
+
fractionLength = length;
|
|
1506
1500
|
}
|
|
1507
1501
|
const point_dist = 0.05;
|
|
1508
1502
|
const p1 = getPointAtLength(fractionLength);
|
|
1509
1503
|
let p2;
|
|
1510
1504
|
if (fractionLength < 0) {
|
|
1511
1505
|
fractionLength = 0;
|
|
1512
|
-
} else if (fractionLength >
|
|
1513
|
-
fractionLength =
|
|
1506
|
+
} else if (fractionLength > length) {
|
|
1507
|
+
fractionLength = length;
|
|
1514
1508
|
}
|
|
1515
|
-
if (fractionLength <
|
|
1509
|
+
if (fractionLength < length - point_dist) {
|
|
1516
1510
|
p2 = getPointAtLength(fractionLength + point_dist);
|
|
1517
1511
|
} else {
|
|
1518
1512
|
p2 = getPointAtLength(fractionLength - point_dist);
|
|
@@ -1520,13 +1514,13 @@ var makeArc = ({
|
|
|
1520
1514
|
const xDist = p2.x - p1.x;
|
|
1521
1515
|
const yDist = p2.y - p1.y;
|
|
1522
1516
|
const dist = Math.sqrt(xDist * xDist + yDist * yDist);
|
|
1523
|
-
if (fractionLength <
|
|
1517
|
+
if (fractionLength < length - point_dist) {
|
|
1524
1518
|
return { x: -xDist / dist, y: -yDist / dist };
|
|
1525
1519
|
}
|
|
1526
1520
|
return { x: xDist / dist, y: yDist / dist };
|
|
1527
1521
|
},
|
|
1528
1522
|
getTotalLength: () => {
|
|
1529
|
-
return
|
|
1523
|
+
return length;
|
|
1530
1524
|
},
|
|
1531
1525
|
type: "arc"
|
|
1532
1526
|
};
|
|
@@ -1888,16 +1882,16 @@ var getLength = (path) => {
|
|
|
1888
1882
|
return constructucted.totalLength;
|
|
1889
1883
|
};
|
|
1890
1884
|
var evolvePath = (progress, path) => {
|
|
1891
|
-
const
|
|
1885
|
+
const length = getLength(path);
|
|
1892
1886
|
if (progress === 0) {
|
|
1893
|
-
const extendedLength =
|
|
1887
|
+
const extendedLength = length * 1.5;
|
|
1894
1888
|
return {
|
|
1895
1889
|
strokeDasharray: `${extendedLength} ${extendedLength}`,
|
|
1896
1890
|
strokeDashoffset: extendedLength
|
|
1897
1891
|
};
|
|
1898
1892
|
}
|
|
1899
|
-
const strokeDasharray = `${
|
|
1900
|
-
const strokeDashoffset =
|
|
1893
|
+
const strokeDasharray = `${length} ${length}`;
|
|
1894
|
+
const strokeDashoffset = length - progress * length;
|
|
1901
1895
|
return { strokeDasharray, strokeDashoffset };
|
|
1902
1896
|
};
|
|
1903
1897
|
|
|
@@ -1997,18 +1991,18 @@ function _doubleLine(x1, y1, x2, y2, o, filling = false) {
|
|
|
1997
1991
|
}
|
|
1998
1992
|
function _line(x1, y1, x2, y2, o, move, overlay) {
|
|
1999
1993
|
const lengthSq = Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2);
|
|
2000
|
-
const
|
|
1994
|
+
const length = Math.sqrt(lengthSq);
|
|
2001
1995
|
let roughnessGain = 1;
|
|
2002
|
-
if (
|
|
1996
|
+
if (length < 200) {
|
|
2003
1997
|
roughnessGain = 1;
|
|
2004
|
-
} else if (
|
|
1998
|
+
} else if (length > 500) {
|
|
2005
1999
|
roughnessGain = 0.4;
|
|
2006
2000
|
} else {
|
|
2007
|
-
roughnessGain = -0.0016668 *
|
|
2001
|
+
roughnessGain = -0.0016668 * length + 1.233334;
|
|
2008
2002
|
}
|
|
2009
2003
|
let offset = o.maxRandomnessOffset || 0;
|
|
2010
2004
|
if (offset * offset * 100 > lengthSq) {
|
|
2011
|
-
offset =
|
|
2005
|
+
offset = length / 10;
|
|
2012
2006
|
}
|
|
2013
2007
|
const halfOffset = offset / 2;
|
|
2014
2008
|
const divergePoint = 0.2 + random(o) * 0.2;
|
|
@@ -2616,14 +2610,16 @@ var createAnnotation = () => {
|
|
|
2616
2610
|
preserveVertices,
|
|
2617
2611
|
roughness
|
|
2618
2612
|
]);
|
|
2619
|
-
const
|
|
2613
|
+
const { delayRender, continueRender } = useDelayRender();
|
|
2620
2614
|
const size = useElementSize(ref);
|
|
2621
|
-
|
|
2622
|
-
|
|
2615
|
+
const isWaitingForSize = size === null;
|
|
2616
|
+
useLayoutEffect(() => {
|
|
2617
|
+
if (!isWaitingForSize) {
|
|
2623
2618
|
return;
|
|
2624
2619
|
}
|
|
2625
|
-
|
|
2626
|
-
|
|
2620
|
+
const handle = delayRender("Waiting for rough annotation size");
|
|
2621
|
+
return () => continueRender(handle);
|
|
2622
|
+
}, [continueRender, delayRender, isWaitingForSize]);
|
|
2627
2623
|
const [svgChildren, setSvgChildren] = useState2([]);
|
|
2628
2624
|
useLayoutEffect(() => {
|
|
2629
2625
|
if (!ref.current || !svgRef.current) {
|
|
@@ -2786,14 +2782,6 @@ var paddingSchema = {
|
|
|
2786
2782
|
var underlinePaddingSchema = {
|
|
2787
2783
|
"padding.top": paddingSchema["padding.top"]
|
|
2788
2784
|
};
|
|
2789
|
-
var textContentSchema = {
|
|
2790
|
-
children: {
|
|
2791
|
-
type: "text-content",
|
|
2792
|
-
default: "",
|
|
2793
|
-
description: "Text",
|
|
2794
|
-
keyframable: false
|
|
2795
|
-
}
|
|
2796
|
-
};
|
|
2797
2785
|
var sharedSchema = (defaultRoughness) => ({
|
|
2798
2786
|
...Interactive.baseSchema,
|
|
2799
2787
|
...Interactive.premountSchema,
|
|
@@ -2821,7 +2809,7 @@ var sharedSchema = (defaultRoughness) => ({
|
|
|
2821
2809
|
...roughJsControlsSchema(defaultRoughness),
|
|
2822
2810
|
...colorSchema,
|
|
2823
2811
|
...Interactive.textSchema,
|
|
2824
|
-
...
|
|
2812
|
+
...Interactive.childrenSchema,
|
|
2825
2813
|
...Interactive.backgroundSchema,
|
|
2826
2814
|
...Interactive.borderSchema,
|
|
2827
2815
|
...Interactive.borderRadiusSchema
|
|
@@ -3078,11 +3066,11 @@ var Circle = makeAnnotationComponent({
|
|
|
3078
3066
|
schema: circleSchema
|
|
3079
3067
|
});
|
|
3080
3068
|
export {
|
|
3081
|
-
|
|
3082
|
-
StrikeThrough,
|
|
3083
|
-
Highlight,
|
|
3084
|
-
CrossedOff,
|
|
3085
|
-
Circle,
|
|
3069
|
+
Box,
|
|
3086
3070
|
Bracket,
|
|
3087
|
-
|
|
3071
|
+
Circle,
|
|
3072
|
+
CrossedOff,
|
|
3073
|
+
Highlight,
|
|
3074
|
+
StrikeThrough,
|
|
3075
|
+
Underline
|
|
3088
3076
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/rough-notation",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.536",
|
|
4
4
|
"description": "Rough annotation primitives for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@remotion/paths": "4.0.
|
|
30
|
-
"remotion": "4.0.
|
|
29
|
+
"@remotion/paths": "4.0.536",
|
|
30
|
+
"remotion": "4.0.536",
|
|
31
31
|
"roughjs": "4.6.6"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"react": "19.2.3",
|
|
47
47
|
"react-dom": "19.2.3",
|
|
48
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
48
|
+
"@remotion/eslint-config-internal": "4.0.536",
|
|
49
49
|
"eslint": "9.19.0",
|
|
50
50
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
51
51
|
},
|