@revideo/2d 0.2.6-alpha.904 → 0.2.6
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/lib/code/CodeCursor.d.ts +74 -74
- package/lib/code/CodeCursor.js +286 -352
- package/lib/code/CodeDiffer.d.ts +16 -21
- package/lib/code/CodeDiffer.js +41 -39
- package/lib/code/CodeFragment.d.ts +8 -16
- package/lib/code/CodeFragment.js +36 -36
- package/lib/code/CodeHighlighter.d.ts +59 -59
- package/lib/code/CodeHighlighter.js +1 -1
- package/lib/code/CodeMetrics.d.ts +8 -12
- package/lib/code/CodeMetrics.js +24 -26
- package/lib/code/CodeRange.d.ts +5 -21
- package/lib/code/CodeRange.js +124 -131
- package/lib/code/CodeScope.d.ts +8 -18
- package/lib/code/CodeScope.js +61 -59
- package/lib/code/CodeSelection.d.ts +4 -9
- package/lib/code/CodeSelection.js +8 -8
- package/lib/code/CodeSignal.d.ts +47 -74
- package/lib/code/CodeSignal.js +189 -206
- package/lib/code/CodeTokenizer.d.ts +1 -1
- package/lib/code/CodeTokenizer.js +41 -41
- package/lib/code/DefaultHighlightStyle.d.ts +2 -2
- package/lib/code/DefaultHighlightStyle.js +96 -96
- package/lib/code/LezerHighlighter.d.ts +19 -21
- package/lib/code/LezerHighlighter.js +101 -101
- package/lib/code/diff.d.ts +9 -12
- package/lib/code/diff.js +205 -218
- package/lib/code/extractRange.d.ts +4 -7
- package/lib/code/extractRange.js +71 -79
- package/lib/code/index.d.ts +1 -1
- package/lib/code/index.js +1 -1
- package/lib/components/Bezier.d.ts +18 -18
- package/lib/components/Bezier.js +75 -86
- package/lib/components/Circle.d.ts +90 -95
- package/lib/components/Circle.js +74 -85
- package/lib/components/CodeBlock.d.ts +1 -1
- package/lib/components/CubicBezier.d.ts +36 -36
- package/lib/components/CubicBezier.js +49 -52
- package/lib/components/Curve.d.ts +198 -208
- package/lib/components/Grid.d.ts +42 -47
- package/lib/components/Icon.d.ts +50 -55
- package/lib/components/Knot.d.ts +78 -97
- package/lib/components/Latex.d.ts +12 -12
- package/lib/components/Line.d.ts +49 -61
- package/lib/components/Node.d.ts +1 -1
- package/lib/components/Path.d.ts +14 -35
- package/lib/components/Path.js +89 -100
- package/lib/components/Polygon.d.ts +55 -60
- package/lib/components/Polygon.js +66 -71
- package/lib/components/QuadBezier.d.ts +29 -29
- package/lib/components/QuadBezier.js +45 -50
- package/lib/components/Ray.d.ts +28 -28
- package/lib/components/Ray.js +64 -71
- package/lib/components/Rect.d.ts +108 -115
- package/lib/components/Rect.js +72 -78
- package/lib/components/SVG.d.ts +139 -165
- package/lib/components/Shape.d.ts +1 -1
- package/lib/components/Spline.d.ts +40 -46
- package/lib/components/Video.d.ts.map +1 -1
- package/lib/components/Video.js +7 -2
- package/lib/components/index.d.ts +1 -1
- package/lib/components/types.d.ts +9 -22
- package/lib/curves/ArcSegment.d.ts +24 -36
- package/lib/curves/CircleSegment.d.ts +16 -26
- package/lib/curves/CircleSegment.js +49 -56
- package/lib/curves/CubicBezierSegment.d.ts +13 -18
- package/lib/curves/CubicBezierSegment.js +46 -79
- package/lib/curves/CurveDrawingInfo.d.ts +9 -9
- package/lib/curves/CurveDrawingInfo.js +1 -1
- package/lib/curves/CurvePoint.d.ts +13 -13
- package/lib/curves/CurvePoint.js +1 -1
- package/lib/curves/CurveProfile.d.ts +5 -5
- package/lib/curves/CurveProfile.js +1 -1
- package/lib/curves/KnotInfo.d.ts +8 -8
- package/lib/curves/KnotInfo.js +1 -1
- package/lib/curves/LineSegment.d.ts +14 -19
- package/lib/curves/LineSegment.js +42 -42
- package/lib/curves/Polynomial.d.ts +110 -110
- package/lib/curves/Polynomial.js +239 -249
- package/lib/curves/Polynomial2D.d.ts +20 -20
- package/lib/curves/Polynomial2D.js +42 -46
- package/lib/curves/PolynomialSegment.d.ts +37 -42
- package/lib/curves/PolynomialSegment.js +81 -83
- package/lib/curves/QuadBezierSegment.d.ts +12 -12
- package/lib/curves/QuadBezierSegment.js +41 -71
- package/lib/curves/Segment.d.ts +7 -12
- package/lib/curves/Segment.js +3 -2
- package/lib/curves/UniformPolynomialCurveSampler.d.ts +34 -34
- package/lib/curves/UniformPolynomialCurveSampler.js +62 -68
- package/lib/curves/createCurveProfileLerp.d.ts +6 -17
- package/lib/curves/createCurveProfileLerp.js +208 -211
- package/lib/curves/getBezierSplineProfile.d.ts +4 -8
- package/lib/curves/getBezierSplineProfile.js +101 -145
- package/lib/curves/getCircleProfile.d.ts +4 -10
- package/lib/curves/getCircleProfile.js +40 -72
- package/lib/curves/getPathProfile.d.ts +2 -2
- package/lib/curves/getPathProfile.js +112 -135
- package/lib/curves/getPointAtDistance.d.ts +4 -7
- package/lib/curves/getPointAtDistance.js +12 -12
- package/lib/curves/getPolylineProfile.d.ts +4 -8
- package/lib/curves/getPolylineProfile.js +54 -67
- package/lib/curves/getRectProfile.d.ts +4 -9
- package/lib/curves/getRectProfile.js +52 -117
- package/lib/curves/index.d.ts +1 -1
- package/lib/curves/index.js +1 -1
- package/lib/decorators/canvasStyleSignal.d.ts +3 -3
- package/lib/decorators/canvasStyleSignal.js +10 -10
- package/lib/decorators/colorSignal.d.ts +1 -1
- package/lib/decorators/colorSignal.js +7 -7
- package/lib/decorators/compound.d.ts +2 -4
- package/lib/decorators/compound.js +23 -43
- package/lib/decorators/computed.d.ts +1 -1
- package/lib/decorators/computed.js +9 -9
- package/lib/decorators/defaultStyle.d.ts +2 -5
- package/lib/decorators/defaultStyle.js +11 -11
- package/lib/decorators/filtersSignal.d.ts +8 -28
- package/lib/decorators/filtersSignal.js +64 -87
- package/lib/decorators/index.d.ts +1 -1
- package/lib/decorators/index.js +1 -1
- package/lib/decorators/initializers.d.ts +2 -5
- package/lib/decorators/initializers.js +19 -18
- package/lib/decorators/nodeName.d.ts +1 -1
- package/lib/decorators/nodeName.js +4 -4
- package/lib/decorators/signal.d.ts +20 -40
- package/lib/decorators/signal.js +104 -113
- package/lib/decorators/spacingSignal.d.ts +1 -1
- package/lib/decorators/spacingSignal.js +13 -13
- package/lib/decorators/vector2Signal.d.ts +7 -13
- package/lib/decorators/vector2Signal.js +13 -15
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/jsx-dev-runtime.d.ts +3 -3
- package/lib/jsx-dev-runtime.js +3 -3
- package/lib/jsx-runtime.d.ts +9 -19
- package/lib/jsx-runtime.js +18 -18
- package/lib/partials/Filter.d.ts +16 -24
- package/lib/partials/Filter.js +69 -69
- package/lib/partials/Gradient.d.ts +24 -30
- package/lib/partials/Gradient.js +58 -69
- package/lib/partials/Pattern.d.ts +9 -14
- package/lib/partials/Pattern.js +24 -30
- package/lib/partials/ShaderConfig.d.ts +74 -81
- package/lib/partials/ShaderConfig.js +23 -22
- package/lib/partials/index.d.ts +1 -1
- package/lib/partials/index.js +1 -1
- package/lib/partials/types.d.ts +6 -19
- package/lib/partials/types.js +1 -1
- package/lib/scenes/index.d.ts +1 -1
- package/lib/scenes/makeScene2D.d.ts +5 -7
- package/lib/scenes/useScene2D.d.ts +2 -2
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/utils/CanvasUtils.d.ts +1 -1
- package/lib/utils/CanvasUtils.js +105 -186
- package/lib/utils/diff.d.ts +18 -25
- package/lib/utils/diff.js +87 -84
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/is.d.ts +2 -4
- package/lib/utils/is.js +2 -2
- package/lib/utils/makeSignalExtensions.d.ts +4 -11
- package/lib/utils/makeSignalExtensions.js +17 -17
- package/package.json +5 -5
- package/src/lib/components/Video.ts +7 -1
package/lib/components/Knot.d.ts
CHANGED
|
@@ -1,108 +1,89 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
SignalValue,
|
|
5
|
-
Vector2Signal,
|
|
6
|
-
} from '@revideo/core';
|
|
7
|
-
import {KnotInfo} from '../curves';
|
|
8
|
-
import {Node, NodeProps} from './Node';
|
|
1
|
+
import { PossibleVector2, Signal, SignalValue, Vector2Signal } from '@revideo/core';
|
|
2
|
+
import { KnotInfo } from '../curves';
|
|
3
|
+
import { Node, NodeProps } from './Node';
|
|
9
4
|
export interface KnotProps extends NodeProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
/**
|
|
6
|
+
* {@inheritDoc Knot.startHandle}
|
|
7
|
+
*/
|
|
8
|
+
startHandle?: SignalValue<PossibleVector2>;
|
|
9
|
+
/**
|
|
10
|
+
* {@inheritDoc Knot.endHandle}
|
|
11
|
+
*/
|
|
12
|
+
endHandle?: SignalValue<PossibleVector2>;
|
|
13
|
+
/**
|
|
14
|
+
* {@inheritDoc Knot.auto}
|
|
15
|
+
*/
|
|
16
|
+
auto?: SignalValue<PossibleKnotAuto>;
|
|
17
|
+
startHandleAuto?: SignalValue<number>;
|
|
18
|
+
endHandleAuto?: SignalValue<number>;
|
|
24
19
|
}
|
|
25
20
|
export type KnotAuto = {
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
startHandle: number;
|
|
22
|
+
endHandle: number;
|
|
28
23
|
};
|
|
29
24
|
export type PossibleKnotAuto = KnotAuto | number | [number, number];
|
|
30
|
-
export type KnotAutoSignal<TOwner> = Signal<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
TOwner
|
|
34
|
-
> & {
|
|
35
|
-
endHandle: Signal<number, number, TOwner>;
|
|
36
|
-
startHandle: Signal<number, number, TOwner>;
|
|
25
|
+
export type KnotAutoSignal<TOwner> = Signal<PossibleKnotAuto, KnotAuto, TOwner> & {
|
|
26
|
+
endHandle: Signal<number, number, TOwner>;
|
|
27
|
+
startHandle: Signal<number, number, TOwner>;
|
|
37
28
|
};
|
|
38
29
|
/**
|
|
39
30
|
* A node representing a knot of a {@link Spline}.
|
|
40
31
|
*/
|
|
41
32
|
export declare class Knot extends Node {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
number,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
get endHandleAuto(): Signal<
|
|
98
|
-
number,
|
|
99
|
-
number,
|
|
100
|
-
this,
|
|
101
|
-
import('@revideo/core').SignalContext<number, number, this>
|
|
102
|
-
>;
|
|
103
|
-
constructor(props: KnotProps);
|
|
104
|
-
points(): KnotInfo;
|
|
105
|
-
private getDefaultEndHandle;
|
|
106
|
-
private getDefaultStartHandle;
|
|
33
|
+
/**
|
|
34
|
+
* The position of the knot's start handle. The position is provided relative
|
|
35
|
+
* to the knot's position.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* By default, the position of the start handle will be the mirrored position
|
|
39
|
+
* of the {@link endHandle}.
|
|
40
|
+
*
|
|
41
|
+
* If neither an end handle nor a start handle is provided, the positions of
|
|
42
|
+
* the handles gets calculated automatically to create smooth curve through
|
|
43
|
+
* the knot. The smoothness of the resulting curve can be controlled via the
|
|
44
|
+
* {@link Spline.smoothness} property.
|
|
45
|
+
*
|
|
46
|
+
* It is also possible to blend between a user-defined position and the
|
|
47
|
+
* auto-calculated position by using the {@link auto} property.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue Mirrored position of the endHandle.
|
|
50
|
+
*/
|
|
51
|
+
readonly startHandle: Vector2Signal<this>;
|
|
52
|
+
/**
|
|
53
|
+
* The position of the knot's end handle. The position is provided relative
|
|
54
|
+
* to the knot's position.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* By default, the position of the end handle will be the mirrored position
|
|
58
|
+
* of the {@link startHandle}.
|
|
59
|
+
*
|
|
60
|
+
* If neither an end handle nor a start handle is provided, the positions of
|
|
61
|
+
* the handles gets calculated automatically to create smooth curve through
|
|
62
|
+
* the knot. The smoothness of the resulting curve can be controlled via the
|
|
63
|
+
* {@link Spline.smoothness} property.
|
|
64
|
+
*
|
|
65
|
+
* It is also possible to blend between a user-defined position and the
|
|
66
|
+
* auto-calculated position by using the {@link auto} property.
|
|
67
|
+
*
|
|
68
|
+
* @defaultValue Mirrored position of the startHandle.
|
|
69
|
+
*/
|
|
70
|
+
readonly endHandle: Vector2Signal<this>;
|
|
71
|
+
/**
|
|
72
|
+
* How much to blend between the user-provided handles and the auto-calculated
|
|
73
|
+
* handles.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This property has no effect if no explicit handles are provided for the
|
|
77
|
+
* knot.
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue 0
|
|
80
|
+
*/
|
|
81
|
+
readonly auto: KnotAutoSignal<this>;
|
|
82
|
+
get startHandleAuto(): Signal<number, number, this, import("@revideo/core").SignalContext<number, number, this>>;
|
|
83
|
+
get endHandleAuto(): Signal<number, number, this, import("@revideo/core").SignalContext<number, number, this>>;
|
|
84
|
+
constructor(props: KnotProps);
|
|
85
|
+
points(): KnotInfo;
|
|
86
|
+
private getDefaultEndHandle;
|
|
87
|
+
private getDefaultStartHandle;
|
|
107
88
|
}
|
|
108
|
-
//# sourceMappingURL=Knot.d.ts.map
|
|
89
|
+
//# sourceMappingURL=Knot.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {SignalValue, SimpleSignal} from '@revideo/core';
|
|
2
|
-
import {OptionList} from 'mathjax-full/js/util/Options';
|
|
3
|
-
import {Img, ImgProps} from './Img';
|
|
1
|
+
import { SignalValue, SimpleSignal } from '@revideo/core';
|
|
2
|
+
import { OptionList } from 'mathjax-full/js/util/Options';
|
|
3
|
+
import { Img, ImgProps } from './Img';
|
|
4
4
|
export interface LatexProps extends ImgProps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
tex?: SignalValue<string>;
|
|
6
|
+
renderProps?: SignalValue<OptionList>;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* A node for rendering equations with LaTeX.
|
|
@@ -24,11 +24,11 @@ export interface LatexProps extends ImgProps {
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export declare class Latex extends Img {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
private static svgContentsPool;
|
|
28
|
+
private readonly imageElement;
|
|
29
|
+
readonly options: SimpleSignal<OptionList, this>;
|
|
30
|
+
readonly tex: SimpleSignal<string, this>;
|
|
31
|
+
constructor(props: LatexProps);
|
|
32
|
+
protected image(): HTMLImageElement;
|
|
33
33
|
}
|
|
34
|
-
//# sourceMappingURL=Latex.d.ts.map
|
|
34
|
+
//# sourceMappingURL=Latex.d.ts.map
|
package/lib/components/Line.d.ts
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
SignalValue,
|
|
5
|
-
SimpleSignal,
|
|
6
|
-
ThreadGenerator,
|
|
7
|
-
TimingFunction,
|
|
8
|
-
Vector2,
|
|
9
|
-
} from '@revideo/core';
|
|
10
|
-
import {CurveProfile} from '../curves';
|
|
11
|
-
import {Curve, CurveProps} from './Curve';
|
|
1
|
+
import { BBox, PossibleVector2, SignalValue, SimpleSignal, ThreadGenerator, TimingFunction, Vector2 } from '@revideo/core';
|
|
2
|
+
import { CurveProfile } from '../curves';
|
|
3
|
+
import { Curve, CurveProps } from './Curve';
|
|
12
4
|
export interface LineProps extends CurveProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
/**
|
|
6
|
+
* {@inheritDoc Line.radius}
|
|
7
|
+
*/
|
|
8
|
+
radius?: SignalValue<number>;
|
|
9
|
+
/**
|
|
10
|
+
* {@inheritDoc Line.points}
|
|
11
|
+
*/
|
|
12
|
+
points?: SignalValue<SignalValue<PossibleVector2>[]>;
|
|
21
13
|
}
|
|
22
14
|
/**
|
|
23
15
|
* A node for drawing lines and polygons.
|
|
@@ -125,46 +117,42 @@ export interface LineProps extends CurveProps {
|
|
|
125
117
|
* ```
|
|
126
118
|
*/
|
|
127
119
|
export declare class Line extends Curve {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
profile(): CurveProfile;
|
|
166
|
-
protected lineWidthCoefficient(): number;
|
|
167
|
-
drawOverlay(context: CanvasRenderingContext2D, matrix: DOMMatrix): void;
|
|
168
|
-
private parsePoints;
|
|
120
|
+
/**
|
|
121
|
+
* Rotate the points to minimize the overall distance traveled when tweening.
|
|
122
|
+
*
|
|
123
|
+
* @param points - The points to rotate.
|
|
124
|
+
* @param reference - The reference points to which the distance is measured.
|
|
125
|
+
* @param closed - Whether the points form a closed polygon.
|
|
126
|
+
*/
|
|
127
|
+
private static rotatePoints;
|
|
128
|
+
/**
|
|
129
|
+
* Distribute additional points along the polyline.
|
|
130
|
+
*
|
|
131
|
+
* @param points - The points of a polyline along which new points should be
|
|
132
|
+
* distributed.
|
|
133
|
+
* @param count - The number of points to add.
|
|
134
|
+
*/
|
|
135
|
+
private static distributePoints;
|
|
136
|
+
/**
|
|
137
|
+
* The radius of the line's corners.
|
|
138
|
+
*/
|
|
139
|
+
readonly radius: SimpleSignal<number, this>;
|
|
140
|
+
/**
|
|
141
|
+
* The points of the line.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* When set to `null`, the Line will use the positions of its children as
|
|
145
|
+
* points.
|
|
146
|
+
*/
|
|
147
|
+
readonly points: SimpleSignal<SignalValue<PossibleVector2>[] | null, this>;
|
|
148
|
+
protected tweenPoints(value: SignalValue<SignalValue<PossibleVector2>[] | null>, time: number, timingFunction: TimingFunction): ThreadGenerator;
|
|
149
|
+
private tweenedPoints;
|
|
150
|
+
constructor(props: LineProps);
|
|
151
|
+
protected childrenBBox(): BBox;
|
|
152
|
+
parsedPoints(): Vector2[];
|
|
153
|
+
profile(): CurveProfile;
|
|
154
|
+
protected lineWidthCoefficient(): number;
|
|
155
|
+
drawOverlay(context: CanvasRenderingContext2D, matrix: DOMMatrix): void;
|
|
156
|
+
private parsePoints;
|
|
169
157
|
}
|
|
170
|
-
//# sourceMappingURL=Line.d.ts.map
|
|
158
|
+
//# sourceMappingURL=Line.d.ts.map
|
package/lib/components/Node.d.ts
CHANGED
|
@@ -231,7 +231,7 @@ export declare class Node implements Promisable<Node> {
|
|
|
231
231
|
readonly composite: SimpleSignal<boolean, this>;
|
|
232
232
|
readonly compositeOperation: SimpleSignal<GlobalCompositeOperation, this>;
|
|
233
233
|
private readonly compositeOverride;
|
|
234
|
-
protected tweenCompositeOperation(value: SignalValue<GlobalCompositeOperation>, time: number, timingFunction: TimingFunction): Generator<void |
|
|
234
|
+
protected tweenCompositeOperation(value: SignalValue<GlobalCompositeOperation>, time: number, timingFunction: TimingFunction): Generator<void | Promise<any> | ThreadGenerator | Promisable<any>, void, any>;
|
|
235
235
|
/**
|
|
236
236
|
* Represents the opacity of this node in the range 0-1.
|
|
237
237
|
*
|
package/lib/components/Path.d.ts
CHANGED
|
@@ -1,39 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
SimpleSignal,
|
|
5
|
-
TimingFunction,
|
|
6
|
-
Vector2,
|
|
7
|
-
} from '@revideo/core';
|
|
8
|
-
import {CurveProfile} from '../curves';
|
|
9
|
-
import {Curve, CurveProps} from './Curve';
|
|
1
|
+
import { BBox, SignalValue, SimpleSignal, TimingFunction, Vector2 } from '@revideo/core';
|
|
2
|
+
import { CurveProfile } from '../curves';
|
|
3
|
+
import { Curve, CurveProps } from './Curve';
|
|
10
4
|
export interface PathProps extends CurveProps {
|
|
11
|
-
|
|
5
|
+
data: SignalValue<string>;
|
|
12
6
|
}
|
|
13
7
|
export declare class Path extends Curve {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
endPoint: Vector2 | null,
|
|
24
|
-
): void;
|
|
25
|
-
protected tweenData(
|
|
26
|
-
newPath: SignalValue<string>,
|
|
27
|
-
time: number,
|
|
28
|
-
timingFunction: TimingFunction,
|
|
29
|
-
): Generator<
|
|
30
|
-
| void
|
|
31
|
-
| import('@revideo/core').ThreadGenerator
|
|
32
|
-
| Promise<any>
|
|
33
|
-
| import('@revideo/core').Promisable<any>,
|
|
34
|
-
void,
|
|
35
|
-
any
|
|
36
|
-
>;
|
|
37
|
-
drawOverlay(context: CanvasRenderingContext2D, matrix: DOMMatrix): void;
|
|
8
|
+
private currentProfile;
|
|
9
|
+
readonly data: SimpleSignal<string, this>;
|
|
10
|
+
constructor(props: PathProps);
|
|
11
|
+
profile(): CurveProfile;
|
|
12
|
+
protected childrenBBox(): BBox;
|
|
13
|
+
protected lineWidthCoefficient(): number;
|
|
14
|
+
protected processSubpath(path: Path2D, startPoint: Vector2 | null, endPoint: Vector2 | null): void;
|
|
15
|
+
protected tweenData(newPath: SignalValue<string>, time: number, timingFunction: TimingFunction): Generator<void | Promise<any> | import("@revideo/core").ThreadGenerator | import("@revideo/core").Promisable<any>, void, any>;
|
|
16
|
+
drawOverlay(context: CanvasRenderingContext2D, matrix: DOMMatrix): void;
|
|
38
17
|
}
|
|
39
|
-
//# sourceMappingURL=Path.d.ts.map
|
|
18
|
+
//# sourceMappingURL=Path.d.ts.map
|
package/lib/components/Path.js
CHANGED
|
@@ -1,107 +1,96 @@
|
|
|
1
|
-
var __decorate =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
r =
|
|
6
|
-
c < 3
|
|
7
|
-
? target
|
|
8
|
-
: desc === null
|
|
9
|
-
? (desc = Object.getOwnPropertyDescriptor(target, key))
|
|
10
|
-
: desc,
|
|
11
|
-
d;
|
|
12
|
-
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
13
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
-
else
|
|
15
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
16
|
-
if ((d = decorators[i]))
|
|
17
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
|
|
20
|
-
import {BBox, createSignal, isReactive, threadable, tween} from '@revideo/core';
|
|
21
|
-
import {createCurveProfileLerp} from '../curves/createCurveProfileLerp';
|
|
22
|
-
import {getPathProfile} from '../curves/getPathProfile';
|
|
23
|
-
import {computed, signal} from '../decorators';
|
|
24
|
-
import {drawLine, drawPivot} from '../utils';
|
|
25
|
-
import {Curve} from './Curve';
|
|
6
|
+
};
|
|
7
|
+
import { BBox, createSignal, isReactive, threadable, tween, } from '@revideo/core';
|
|
8
|
+
import { createCurveProfileLerp } from '../curves/createCurveProfileLerp';
|
|
9
|
+
import { getPathProfile } from '../curves/getPathProfile';
|
|
10
|
+
import { computed, signal } from '../decorators';
|
|
11
|
+
import { drawLine, drawPivot } from '../utils';
|
|
12
|
+
import { Curve } from './Curve';
|
|
26
13
|
export class Path extends Curve {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
profile() {
|
|
33
|
-
return this.currentProfile() ?? getPathProfile(this.data());
|
|
34
|
-
}
|
|
35
|
-
childrenBBox() {
|
|
36
|
-
const points = this.profile().segments.flatMap(segment => segment.points);
|
|
37
|
-
return BBox.fromPoints(...points);
|
|
38
|
-
}
|
|
39
|
-
lineWidthCoefficient() {
|
|
40
|
-
const join = this.lineJoin();
|
|
41
|
-
let coefficient = super.lineWidthCoefficient();
|
|
42
|
-
if (join === 'miter') {
|
|
43
|
-
const {minSin} = this.profile();
|
|
44
|
-
if (minSin > 0) {
|
|
45
|
-
coefficient = Math.max(coefficient, 0.5 / minSin);
|
|
46
|
-
}
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
this.currentProfile = createSignal(null);
|
|
17
|
+
this.canHaveSubpath = true;
|
|
47
18
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
processSubpath(path, startPoint, endPoint) {
|
|
51
|
-
if (startPoint && endPoint && startPoint.equals(endPoint)) {
|
|
52
|
-
path.closePath();
|
|
19
|
+
profile() {
|
|
20
|
+
return this.currentProfile() ?? getPathProfile(this.data());
|
|
53
21
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
22
|
+
childrenBBox() {
|
|
23
|
+
const points = this.profile().segments.flatMap(segment => segment.points);
|
|
24
|
+
return BBox.fromPoints(...points);
|
|
25
|
+
}
|
|
26
|
+
lineWidthCoefficient() {
|
|
27
|
+
const join = this.lineJoin();
|
|
28
|
+
let coefficient = super.lineWidthCoefficient();
|
|
29
|
+
if (join === 'miter') {
|
|
30
|
+
const { minSin } = this.profile();
|
|
31
|
+
if (minSin > 0) {
|
|
32
|
+
coefficient = Math.max(coefficient, 0.5 / minSin);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return coefficient;
|
|
36
|
+
}
|
|
37
|
+
processSubpath(path, startPoint, endPoint) {
|
|
38
|
+
if (startPoint && endPoint && startPoint.equals(endPoint)) {
|
|
39
|
+
path.closePath();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
*tweenData(newPath, time, timingFunction) {
|
|
43
|
+
const fromProfile = this.profile();
|
|
44
|
+
const toProfile = getPathProfile(isReactive(newPath) ? newPath() : newPath);
|
|
45
|
+
const interpolator = createCurveProfileLerp(fromProfile, toProfile);
|
|
46
|
+
this.currentProfile(fromProfile);
|
|
47
|
+
yield* tween(time, value => {
|
|
48
|
+
const progress = timingFunction(value);
|
|
49
|
+
this.currentProfile(interpolator(progress));
|
|
50
|
+
}, () => {
|
|
51
|
+
this.currentProfile(null);
|
|
52
|
+
this.data(newPath);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
drawOverlay(context, matrix) {
|
|
56
|
+
const box = this.childrenBBox().transformCorners(matrix);
|
|
57
|
+
const size = this.computedSize();
|
|
58
|
+
const offset = size.mul(this.offset()).scale(0.5).transformAsPoint(matrix);
|
|
59
|
+
const segments = this.profile().segments;
|
|
60
|
+
context.lineWidth = 1;
|
|
61
|
+
context.strokeStyle = 'white';
|
|
62
|
+
context.fillStyle = 'white';
|
|
63
|
+
context.save();
|
|
64
|
+
context.setTransform(matrix);
|
|
65
|
+
let endPoint = null;
|
|
66
|
+
let path = new Path2D();
|
|
67
|
+
for (const segment of segments) {
|
|
68
|
+
if (endPoint && !segment.getPoint(0).position.equals(endPoint)) {
|
|
69
|
+
context.stroke(path);
|
|
70
|
+
path = new Path2D();
|
|
71
|
+
endPoint = null;
|
|
72
|
+
}
|
|
73
|
+
const [, end] = segment.draw(path, 0, 1, endPoint == null);
|
|
74
|
+
endPoint = end.position;
|
|
75
|
+
}
|
|
86
76
|
context.stroke(path);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
context.restore();
|
|
78
|
+
context.beginPath();
|
|
79
|
+
drawPivot(context, offset);
|
|
80
|
+
context.stroke();
|
|
81
|
+
context.beginPath();
|
|
82
|
+
drawLine(context, box);
|
|
83
|
+
context.closePath();
|
|
84
|
+
context.stroke();
|
|
92
85
|
}
|
|
93
|
-
context.stroke(path);
|
|
94
|
-
context.restore();
|
|
95
|
-
context.beginPath();
|
|
96
|
-
drawPivot(context, offset);
|
|
97
|
-
context.stroke();
|
|
98
|
-
context.beginPath();
|
|
99
|
-
drawLine(context, box);
|
|
100
|
-
context.closePath();
|
|
101
|
-
context.stroke();
|
|
102
|
-
}
|
|
103
86
|
}
|
|
104
|
-
__decorate([
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
__decorate([
|
|
88
|
+
signal()
|
|
89
|
+
], Path.prototype, "data", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
computed()
|
|
92
|
+
], Path.prototype, "profile", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
threadable()
|
|
95
|
+
], Path.prototype, "tweenData", null);
|
|
96
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGF0aC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY29tcG9uZW50cy9QYXRoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLE9BQU8sRUFDTCxJQUFJLEVBQ0osWUFBWSxFQUNaLFVBQVUsRUFHVixVQUFVLEVBRVYsS0FBSyxHQUVOLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBQyxzQkFBc0IsRUFBQyxNQUFNLGtDQUFrQyxDQUFDO0FBQ3hFLE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBTSwwQkFBMEIsQ0FBQztBQUN4RCxPQUFPLEVBQUMsUUFBUSxFQUFFLE1BQU0sRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUMvQyxPQUFPLEVBQUMsUUFBUSxFQUFFLFNBQVMsRUFBQyxNQUFNLFVBQVUsQ0FBQztBQUM3QyxPQUFPLEVBQUMsS0FBSyxFQUFhLE1BQU0sU0FBUyxDQUFDO0FBTTFDLE1BQU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