@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.5
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/CHANGELOG.md +220 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +93 -72
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +79 -4
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -3
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +1 -1
- package/dist/attributes/audio/filters/chain.js.map +1 -1
- package/dist/attributes/audio/filters/curve.d.ts +8 -8
- package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
- package/dist/attributes/audio/filters/curve.js +20 -19
- package/dist/attributes/audio/filters/curve.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
- package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/filters/index.d.ts +1 -1
- package/dist/attributes/audio/filters/index.d.ts.map +1 -1
- package/dist/attributes/audio/filters/index.js +1 -1
- package/dist/attributes/audio/filters/index.js.map +1 -1
- package/dist/attributes/audio/filters/registry.js.map +1 -1
- package/dist/attributes/audio/filters/union.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +17 -2
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +4 -2
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +15 -8
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +4 -2
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -4
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +3 -1
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +9 -2
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +15 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +28 -120
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +16 -88
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +15 -8
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +2 -6
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +23 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +44 -10
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/union.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +81 -44
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +4 -10
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -13
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +2 -2
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +6 -7
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
- package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
- package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
- package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +3 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +1 -1
- package/dist/document/audio.js +4 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +8 -14
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +13 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +15 -6
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +1 -1
- package/dist/document/expression/refs.js +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +2 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +2 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +2 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +19 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +70 -0
- package/dist/document/placement.d.ts.map +1 -0
- package/dist/document/placement.js +83 -0
- package/dist/document/placement.js.map +1 -0
- package/dist/document/project.d.ts +2 -2
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/registry.d.ts +17 -0
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +29 -2
- package/dist/document/registry.js.map +1 -1
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +73 -18
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +192 -40
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +12 -12
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +2 -2
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +2 -2
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +37 -31
- package/dist/document/validate.js.map +1 -1
- package/dist/document/withdraw.d.ts +28 -0
- package/dist/document/withdraw.d.ts.map +1 -0
- package/dist/document/withdraw.js +61 -0
- package/dist/document/withdraw.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +9 -1
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js +13 -3
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/nodes/2d/node-lifecycle.js.map +1 -1
- package/dist/nodes/2d/node-motion.js.map +1 -1
- package/dist/nodes/2d/node-render.d.ts +3 -3
- package/dist/nodes/2d/node-render.d.ts.map +1 -1
- package/dist/nodes/2d/node-render.js.map +1 -1
- package/dist/nodes/2d/node-transform.js.map +1 -1
- package/dist/nodes/2d/node2d.d.ts +115 -3
- package/dist/nodes/2d/node2d.d.ts.map +1 -1
- package/dist/nodes/2d/node2d.js +180 -28
- package/dist/nodes/2d/node2d.js.map +1 -1
- package/dist/nodes/2d/paint-node.d.ts +27 -0
- package/dist/nodes/2d/paint-node.d.ts.map +1 -1
- package/dist/nodes/2d/paint-node.js +42 -0
- package/dist/nodes/2d/paint-node.js.map +1 -1
- package/dist/nodes/audio/audio-bus.js.map +1 -1
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +2 -2
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +1 -1
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
- package/dist/nodes/geometry/bounds-shape-node.js +2 -2
- package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
- package/dist/nodes/geometry/box-path-node.d.ts +3 -3
- package/dist/nodes/geometry/box-path-node.js +2 -2
- package/dist/nodes/geometry/box-path-node.js.map +1 -1
- package/dist/nodes/geometry/ellipse-node.js.map +1 -1
- package/dist/nodes/geometry/group-bounds.d.ts +2 -2
- package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
- package/dist/nodes/geometry/group-bounds.js +1 -2
- package/dist/nodes/geometry/group-bounds.js.map +1 -1
- package/dist/nodes/geometry/path-node.d.ts.map +1 -1
- package/dist/nodes/geometry/path-node.js +6 -0
- package/dist/nodes/geometry/path-node.js.map +1 -1
- package/dist/nodes/geometry/polygon-node.js.map +1 -1
- package/dist/nodes/geometry/polygram-node.js.map +1 -1
- package/dist/nodes/geometry/rect-node.js.map +1 -1
- package/dist/nodes/geometry/shape-node.js.map +1 -1
- package/dist/nodes/geometry/shape-outline.d.ts +2 -2
- package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
- package/dist/nodes/geometry/shape-outline.js +2 -13
- package/dist/nodes/geometry/shape-outline.js.map +1 -1
- package/dist/nodes/index.d.ts +3 -8
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +3 -8
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/layout/camera-node.d.ts +9 -0
- package/dist/nodes/layout/camera-node.d.ts.map +1 -1
- package/dist/nodes/layout/camera-node.js +38 -3
- package/dist/nodes/layout/camera-node.js.map +1 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
- package/dist/nodes/layout/orbit-camera-node.js +1 -1
- package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
- package/dist/nodes/layout/rotated-box.js.map +1 -1
- package/dist/nodes/media/video-node.d.ts.map +1 -1
- package/dist/nodes/media/video-node.js +2 -0
- package/dist/nodes/media/video-node.js.map +1 -1
- package/dist/nodes/node/declare-paints.js.map +1 -1
- package/dist/nodes/node/node-editor-state.js.map +1 -1
- package/dist/nodes/node/node-reactive.js.map +1 -1
- package/dist/nodes/node/node-time.d.ts +3 -3
- package/dist/nodes/node/node-time.d.ts.map +1 -1
- package/dist/nodes/node/node-time.js +1 -1
- package/dist/nodes/node/node-time.js.map +1 -1
- package/dist/nodes/node/node-walk.js.map +1 -1
- package/dist/nodes/node/node.d.ts +5 -3
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +44 -19
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/node/text-defaults.d.ts +10 -12
- package/dist/nodes/node/text-defaults.d.ts.map +1 -1
- package/dist/nodes/node/text-defaults.js +10 -12
- package/dist/nodes/node/text-defaults.js.map +1 -1
- package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
- package/dist/nodes/root/canvas2d-node.js.map +1 -0
- package/dist/nodes/root/provider-node.d.ts.map +1 -0
- package/dist/nodes/root/provider-node.js.map +1 -0
- package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
- package/dist/nodes/root/theme-provider-node.js.map +1 -0
- package/dist/nodes/text/default-text-style-node.d.ts +5 -2
- package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
- package/dist/nodes/text/default-text-style-node.js +10 -4
- package/dist/nodes/text/default-text-style-node.js.map +1 -1
- package/dist/nodes/text/number-format.d.ts +1 -1
- package/dist/nodes/text/number-format.js +1 -1
- package/dist/nodes/text/number-format.js.map +1 -1
- package/dist/nodes/text/number-node.js.map +1 -1
- package/dist/nodes/text/number-pattern.js.map +1 -1
- package/dist/nodes/text/richtext-node.js +1 -1
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +1 -1
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-node.js.map +1 -1
- package/dist/nodes/text/text-selection.js.map +1 -1
- package/dist/nodes/three/camera-nodes.d.ts +21 -3
- package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
- package/dist/nodes/three/camera-nodes.js +42 -1
- package/dist/nodes/three/camera-nodes.js.map +1 -1
- package/dist/nodes/three/canvas3d-node.d.ts +29 -6
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +44 -2
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/nodes/three/drawable-nodes.d.ts +25 -11
- package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
- package/dist/nodes/three/drawable-nodes.js +43 -13
- package/dist/nodes/three/drawable-nodes.js.map +1 -1
- package/dist/nodes/three/environment-nodes.d.ts +9 -3
- package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
- package/dist/nodes/three/environment-nodes.js.map +1 -1
- package/dist/nodes/three/geometry-nodes.d.ts +2 -2
- package/dist/nodes/three/geometry-nodes.js +2 -2
- package/dist/nodes/three/geometry-nodes.js.map +1 -1
- package/dist/nodes/three/grid-geometry3d.js.map +1 -1
- package/dist/nodes/three/group3d.js.map +1 -1
- package/dist/nodes/three/light-nodes.d.ts.map +1 -1
- package/dist/nodes/three/light-nodes.js +3 -3
- package/dist/nodes/three/light-nodes.js.map +1 -1
- package/dist/nodes/three/mesh3d.js.map +1 -1
- package/dist/nodes/three/node3d.d.ts +48 -0
- package/dist/nodes/three/node3d.d.ts.map +1 -1
- package/dist/nodes/three/node3d.js +53 -3
- package/dist/nodes/three/node3d.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +2 -2
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/latex.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +8 -4
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +18 -10
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +11 -0
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +39 -6
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +9 -0
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +18 -1
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +27 -0
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +5 -3
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +10 -6
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +9 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +19 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -0
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +44 -3
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +118 -3
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +2 -1
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +5 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +31 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +63 -6
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +9 -7
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +12 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +1 -1
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +4 -3
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +19 -15
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +11 -6
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +2 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +15 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +37 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/seekable.d.ts +1 -1
- package/dist/tween/seekable.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +2 -1
- package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
- package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
- package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
- package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
- package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
- package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
- package/dist/nodes/geometry/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/provider-node.js +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bezier.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/bezier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAInE;;;;;;;;;;;;;;GAcG;AAEH,iGAAiG;AACjG,MAAM,kBAAkB,GAAqC,IAAI,GAAG,CAAC;IACjE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CACzC,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAyB;IACvD,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,OAAe;IAChE,OAAO,CAAC,GAAG,OAAO,GAAG,OAAO,CAAC;AACjC,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,QAAQ,CAAC,CAAU,EAAE,CAAU;IAC3C,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,MAA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AC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACpD,CAAC;AAED,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand } from \"@/render/descriptors/path\";\nimport type { ArcParams, Cubic } from \"./types\";\n\n/**\n * Shared Bézier, arc and path-geometry primitives.\n *\n * Everything under `shape/path/` that evaluates, splits, measures or bounds a\n * curve reaches for these rather than carrying its own copy. That used to be an\n * aspiration this file's header stated and only three of seven callers honoured:\n * De Casteljau existed three times, quad→cubic and cubic evaluation twice each,\n * and the arc's endpoint→center conversion twice — once returning a sampler and\n * once returning cubics, differing in nothing else.\n *\n * Two evaluation styles are provided:\n * - Scalar (`cubicAxis` / `quadAxis`) — evaluate a single axis. Cheaper when you\n * already have loose x/y numbers and want to avoid allocating a {@link Vector2}.\n * - Vector (`cubicPoint` / `quadPoint`) — evaluate both axes into a {@link Vector2}.\n */\n\n/** SVG curve commands whose tangent feeds the reflected control point of a following S/s/T/t. */\nconst SMOOTH_CURVE_TYPES: ReadonlySet<PathCommand[\"type\"]> = new Set([\n \"C\", \"c\", \"S\", \"s\", \"Q\", \"q\", \"T\", \"t\",\n]);\n\n\n\n/**\n * True when a command's trailing control point should be remembered so the next\n * smooth command (S/s/T/t) can reflect it. Per the SVG spec, if the previous\n * command was not one of these, the implied control point is the current point.\n */\nexport function isSmoothCurveType(type: PathCommand[\"type\"]): boolean {\n return SMOOTH_CURVE_TYPES.has(type);\n}\n\n/** Reflect a control point through the current point: `2 * current - control`. */\nexport function reflectControlPoint(current: number, control: number): number {\n return 2 * current - control;\n}\n\n/** Euclidean distance between two points. */\nexport function distance(a: Vector2, b: Vector2): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/** Evaluate one axis of a cubic Bézier at parameter `t` (0..1). */\nexport function cubicAxis(t: number, p0: number, p1: number, p2: number, p3: number): number {\n const u = 1 - t;\n return u * u * u * p0 + 3 * u * u * t * p1 + 3 * u * t * t * p2 + t * t * t * p3;\n}\n\n/** Evaluate one axis of a quadratic Bézier at parameter `t` (0..1). */\nexport function quadAxis(t: number, p0: number, p1: number, p2: number): number {\n const u = 1 - t;\n return u * u * p0 + 2 * u * t * p1 + t * t * p2;\n}\n\n/** Evaluate a cubic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\nexport function cubicPoint(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number): Vector2 {\n return {\n x: cubicAxis(t, p0.x, p1.x, p2.x, p3.x),\n y: cubicAxis(t, p0.y, p1.y, p2.y, p3.y),\n };\n}\n\n/** Evaluate a quadratic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\nexport function quadPoint(p0: Vector2, p1: Vector2, p2: Vector2, t: number): Vector2 {\n return {\n x: quadAxis(t, p0.x, p1.x, p2.x),\n y: quadAxis(t, p0.y, p1.y, p2.y),\n };\n}\n\n/**\n * Approximate the arc length of a parametric curve by sampling it into a polyline\n * and summing the segment distances. More `steps` trade speed for accuracy.\n */\nexport function sampleCurveLength(pointAt: (t: number) => Vector2, steps = 32): number {\n let length = 0;\n let prev = pointAt(0);\n for (let i = 1; i <= steps; i++) {\n const next = pointAt(i / steps);\n length += distance(prev, next);\n prev = next;\n }\n return length;\n}\n\n/**\n * Binary-search the curve parameter `t` whose arc length from the start equals\n * `targetDist`. Used to find exactly where a curve should be cut. The curve is\n * re-sampled on each probe, so this is intentionally simple rather than fast;\n * 20 iterations give sub-pixel precision for typical path lengths.\n */\nexport function paramAtDistance(\n pointAt: (t: number) => Vector2,\n targetDist: number,\n totalLen: number,\n): number {\n if (totalLen === 0 || targetDist <= 0) return 0;\n if (targetDist >= totalLen) return 1;\n\n let lo = 0, hi = 1;\n for (let i = 0; i < 20; i++) {\n const mid = (lo + hi) / 2;\n let len = 0;\n let prev = pointAt(0);\n const steps = 16;\n for (let j = 1; j <= steps; j++) {\n const p = pointAt(mid * j / steps);\n len += distance(prev, p);\n prev = p;\n }\n if (len < targetDist) lo = mid;\n else hi = mid;\n }\n return (lo + hi) / 2;\n}\n\n// --- Degree conversion -----------------------------------------------------\n\n/** A straight line as a cubic: controls sit on the line at 1/3 and 2/3. */\nexport function lineToCubic(from: Vector2, to: Vector2): Cubic {\n return {\n p0: from,\n c1: lerpVector2(from, to, 1 / 3),\n c2: lerpVector2(from, to, 2 / 3),\n p1: to,\n };\n}\n\n/** Elevate a quadratic Bézier to the equivalent cubic (exact, not an approximation). */\nexport function quadToCubic(from: Vector2, cp: Vector2, to: Vector2): Cubic {\n return {\n p0: from,\n c1: { x: from.x + (2 / 3) * (cp.x - from.x), y: from.y + (2 / 3) * (cp.y - from.y) },\n c2: { x: to.x + (2 / 3) * (cp.x - to.x), y: to.y + (2 / 3) * (cp.y - to.y) },\n p1: to,\n };\n}\n\n// --- De Casteljau splitting ---\n// Splitting a Bézier at parameter `t` yields two sub-curves that together trace\n// the exact same shape, so trimming preserves curvature instead of polylining it.\n\nexport function splitCubicAt(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number) {\n const a = lerpVector2(p0, p1, t);\n const b = lerpVector2(p1, p2, t);\n const c = lerpVector2(p2, p3, t);\n const d = lerpVector2(a, b, t);\n const e = lerpVector2(b, c, t);\n const f = lerpVector2(d, e, t);\n return {\n left: { from: p0, cp1: a, cp2: d, to: f },\n right: { from: f, cp1: e, cp2: c, to: p3 },\n };\n}\n\n/** The sub-cubic spanning parameters `t0..t1` of the original cubic. */\nexport function extractCubicRange(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t0: number, t1: number) {\n if (t0 === 0) return splitCubicAt(p0, p1, p2, p3, t1).left;\n const { right } = splitCubicAt(p0, p1, p2, p3, t0);\n const adj = (t1 - t0) / (1 - t0);\n return splitCubicAt(right.from, right.cp1, right.cp2, right.to, adj).left;\n}\n\nexport function splitQuadAt(p0: Vector2, p1: Vector2, p2: Vector2, t: number) {\n const a = lerpVector2(p0, p1, t);\n const b = lerpVector2(p1, p2, t);\n const c = lerpVector2(a, b, t);\n return {\n left: { from: p0, cp: a, to: c },\n right: { from: c, cp: b, to: p2 },\n };\n}\n\n/** The sub-quadratic spanning parameters `t0..t1` of the original quadratic. */\nexport function extractQuadRange(p0: Vector2, p1: Vector2, p2: Vector2, t0: number, t1: number) {\n if (t0 === 0) return splitQuadAt(p0, p1, p2, t1).left;\n const { right } = splitQuadAt(p0, p1, p2, t0);\n const adj = (t1 - t0) / (1 - t0);\n return splitQuadAt(right.from, right.cp, right.to, adj).left;\n}\n\n// --- Extrema ---------------------------------------------------------------\n\n/** The `t` values in (0, 1) where a cubic's one-dimensional derivative is zero. */\nexport function cubicExtrema(p0: number, p1: number, p2: number, p3: number): number[] {\n // B'(t) = 3[(p1−p0)(1−t)² + 2(p2−p1)t(1−t) + (p3−p2)t²], written as at² + bt + c.\n const a = -p0 + 3 * p1 - 3 * p2 + p3;\n const b = 2 * (p0 - 2 * p1 + p2);\n const c = p1 - p0;\n const roots: number[] = [];\n const push = (t: number) => {\n if (t > 0 && t < 1) roots.push(t);\n };\n if (Math.abs(a) < 1e-12) {\n if (Math.abs(b) > 1e-12) push(-c / b);\n return roots;\n }\n const disc = b * b - 4 * a * c;\n if (disc < 0) return roots;\n const root = Math.sqrt(disc);\n push((-b + root) / (2 * a));\n push((-b - root) / (2 * a));\n return roots;\n}\n\n/** The `t` value in (0, 1) where a quadratic's one-dimensional derivative is zero. */\nexport function quadExtrema(p0: number, p1: number, p2: number): number[] {\n // B'(t) = 2[(p1−p0)(1−t) + (p2−p1)t] = 0.\n const denominator = p0 - 2 * p1 + p2;\n if (Math.abs(denominator) < 1e-12) return [];\n const t = (p0 - p1) / denominator;\n return t > 0 && t < 1 ? [t] : [];\n}\n\n// --- Arc endpoint-to-center conversion -------------------------------------\n\nfunction angleBetween(ux: number, uy: number, vx: number, vy: number): number {\n const dot = ux * vx + uy * vy;\n const len = Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);\n let angle = Math.acos(Math.max(-1, Math.min(1, dot / len)));\n if (ux * vy - uy * vx < 0) angle = -angle;\n return angle;\n}\n\n\n/**\n * The endpoint→center conversion of an SVG `A` command.\n *\n * Returned as the ellipse's own parameters rather than as a sampler, because the\n * two things that need an arc want different halves of it: flattening wants\n * points, and bounding wants the angles where each axis turns around. A sampler\n * alone forces the second to guess.\n */\nexport function arcParams(\n from: Vector2, to: Vector2,\n rxRaw: number, ryRaw: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1,\n): ArcParams {\n const phi = rotation * Math.PI / 180;\n const cosPhi = Math.cos(phi), sinPhi = Math.sin(phi);\n\n const dx = (from.x - to.x) / 2;\n const dy = (from.y - to.y) / 2;\n const x1p = cosPhi * dx + sinPhi * dy;\n const y1p = -sinPhi * dx + cosPhi * dy;\n\n let rx = Math.abs(rxRaw), ry = Math.abs(ryRaw);\n const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);\n if (lambda > 1) {\n const s = Math.sqrt(lambda);\n rx *= s;\n ry *= s;\n }\n\n const rx2 = rx * rx, ry2 = ry * ry;\n const x1p2 = x1p * x1p, y1p2 = y1p * y1p;\n const sq = Math.max(0, (rx2 * ry2 - rx2 * y1p2 - ry2 * x1p2) / (rx2 * y1p2 + ry2 * x1p2));\n const sign = (largeArc === sweep) ? -1 : 1;\n const cxp = sign * Math.sqrt(sq) * (rx * y1p / ry);\n const cyp = sign * Math.sqrt(sq) * -(ry * x1p / rx);\n\n const cx = cosPhi * cxp - sinPhi * cyp + (from.x + to.x) / 2;\n const cy = sinPhi * cxp + cosPhi * cyp + (from.y + to.y) / 2;\n\n const theta1 = angleBetween(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);\n let dtheta = angleBetween((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);\n if (sweep === 0 && dtheta > 0) dtheta -= 2 * Math.PI;\n if (sweep === 1 && dtheta < 0) dtheta += 2 * Math.PI;\n\n return { cx, cy, rx, ry, phi, theta1, dtheta };\n}\n\n/** The point on an arc at ellipse angle `theta`. */\nexport function arcPointAtAngle(arc: ArcParams, theta: number): Vector2 {\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\n return {\n x: cosPhi * arc.rx * cosT - sinPhi * arc.ry * sinT + arc.cx,\n y: sinPhi * arc.rx * cosT + cosPhi * arc.ry * sinT + arc.cy,\n };\n}\n\n/** A parametric function tracing the arc from its start (`t=0`) to its end (`t=1`). */\nexport function arcPointFunction(arc: ArcParams): (t: number) => Vector2 {\n return (t: number) => arcPointAtAngle(arc, arc.theta1 + t * arc.dtheta);\n}\n\n/** The derivative of {@link arcPointAtAngle} with respect to `theta`. */\nfunction arcDerivativeAtAngle(arc: ArcParams, theta: number): Vector2 {\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\n return {\n x: -arc.rx * cosPhi * sinT - arc.ry * sinPhi * cosT,\n y: -arc.rx * sinPhi * sinT + arc.ry * cosPhi * cosT,\n };\n}\n\n/**\n * The arc's `theta0..theta1` span as cubics — the one place an arc is\n * approximated.\n *\n * Split so no piece spans more than 90°, which is the standard bound: the\n * `(4/3)·tan(Δ/4)` construction is exact at both endpoints and at the midpoint,\n * and its worst-case radial error over a quarter turn is about 2.7e-4 of the\n * radius. There were two implementations of this before — one splitting by\n * angle, one fitting sampled points with a \"catmull-rom-like\" guess — and only\n * the first was worth keeping.\n */\nexport function arcSweepToCubics(arc: ArcParams, theta0: number, theta1: number): Cubic[] {\n const sweep = theta1 - theta0;\n if (Math.abs(sweep) < 1e-12) return [];\n const pieces = Math.max(1, Math.ceil(Math.abs(sweep) / (Math.PI / 2)));\n const step = sweep / pieces;\n const alpha = (4 / 3) * Math.tan(step / 4);\n\n const cubics: Cubic[] = [];\n for (let i = 0; i < pieces; i++) {\n const a0 = theta0 + step * i;\n const a1 = a0 + step;\n const p0 = arcPointAtAngle(arc, a0);\n const p1 = arcPointAtAngle(arc, a1);\n const d0 = arcDerivativeAtAngle(arc, a0);\n const d1 = arcDerivativeAtAngle(arc, a1);\n cubics.push({\n p0,\n c1: { x: p0.x + alpha * d0.x, y: p0.y + alpha * d0.y },\n c2: { x: p1.x - alpha * d1.x, y: p1.y - alpha * d1.y },\n p1,\n });\n }\n return cubics;\n}\n\n/**\n * The ellipse angles at which each axis turns around — the candidates an exact\n * bounding box tests against the swept range.\n */\nexport function arcAxisAngles(arc: ArcParams): { x: number[]; y: number[] } {\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\n // dx/dθ = 0 and dy/dθ = 0, each giving one angle and its antipode.\n const tx = Math.atan2(-arc.ry * sinPhi, arc.rx * cosPhi);\n const ty = Math.atan2(arc.ry * cosPhi, arc.rx * sinPhi);\n return {\n x: [tx, tx + Math.PI],\n y: [ty, ty + Math.PI],\n };\n}\n\n/**\n * Whether ellipse angle `theta` lies within the arc's swept range.\n *\n * Compared as a distance travelled in the sweep's own direction rather than as\n * an interval, because `theta1 + dtheta` routinely leaves `[-π, π]` and an\n * interval test would then reject the very angles that are inside it.\n */\nexport function arcContainsAngle(arc: ArcParams, theta: number): boolean {\n const TAU = Math.PI * 2;\n const forward = arc.dtheta >= 0;\n const delta = forward ? theta - arc.theta1 : arc.theta1 - theta;\n const travelled = ((delta % TAU) + TAU) % TAU;\n return travelled <= Math.abs(arc.dtheta) + 1e-9;\n}\n\n/** Re-exported so curve math and point lerping live behind a single import. */\nexport { lerpVector2 };\n"]}
|
|
1
|
+
{"version":3,"file":"bezier.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/bezier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAInE;;;;;;;;;;;;;;GAcG;AAEH,iGAAiG;AACjG,MAAM,kBAAkB,GAAqC,IA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E,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;KACxB,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAc,EAAE,KAAa;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACxB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC;IAChE,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC9C,OAAO,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACpD,CAAC;AAED,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand } from \"@/render/descriptors/path\";\r\nimport type { ArcParams, Cubic } from \"./types\";\r\n\r\n/**\r\n * Shared Bézier, arc and path-geometry primitives.\r\n *\r\n * Everything under `shape/path/` that evaluates, splits, measures or bounds a\r\n * curve reaches for these rather than carrying its own copy. That used to be an\r\n * aspiration this file's header stated and only three of seven callers honoured:\r\n * De Casteljau existed three times, quad→cubic and cubic evaluation twice each,\r\n * and the arc's endpoint→center conversion twice — once returning a sampler and\r\n * once returning cubics, differing in nothing else.\r\n *\r\n * Two evaluation styles are provided:\r\n * - Scalar (`cubicAxis` / `quadAxis`) — evaluate a single axis. Cheaper when you\r\n * already have loose x/y numbers and want to avoid allocating a {@link Vector2}.\r\n * - Vector (`cubicPoint` / `quadPoint`) — evaluate both axes into a {@link Vector2}.\r\n */\r\n\r\n/** SVG curve commands whose tangent feeds the reflected control point of a following S/s/T/t. */\r\nconst SMOOTH_CURVE_TYPES: ReadonlySet<PathCommand[\"type\"]> = new Set([\r\n \"C\", \"c\", \"S\", \"s\", \"Q\", \"q\", \"T\", \"t\",\r\n]);\r\n\r\n\r\n\r\n/**\r\n * True when a command's trailing control point should be remembered so the next\r\n * smooth command (S/s/T/t) can reflect it. Per the SVG spec, if the previous\r\n * command was not one of these, the implied control point is the current point.\r\n */\r\nexport function isSmoothCurveType(type: PathCommand[\"type\"]): boolean {\r\n return SMOOTH_CURVE_TYPES.has(type);\r\n}\r\n\r\n/** Reflect a control point through the current point: `2 * current - control`. */\r\nexport function reflectControlPoint(current: number, control: number): number {\r\n return 2 * current - control;\r\n}\r\n\r\n/** Euclidean distance between two points. */\r\nexport function distance(a: Vector2, b: Vector2): number {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n return Math.sqrt(dx * dx + dy * dy);\r\n}\r\n\r\n/** Evaluate one axis of a cubic Bézier at parameter `t` (0..1). */\r\nexport function cubicAxis(t: number, p0: number, p1: number, p2: number, p3: number): number {\r\n const u = 1 - t;\r\n return u * u * u * p0 + 3 * u * u * t * p1 + 3 * u * t * t * p2 + t * t * t * p3;\r\n}\r\n\r\n/** Evaluate one axis of a quadratic Bézier at parameter `t` (0..1). */\r\nexport function quadAxis(t: number, p0: number, p1: number, p2: number): number {\r\n const u = 1 - t;\r\n return u * u * p0 + 2 * u * t * p1 + t * t * p2;\r\n}\r\n\r\n/** Evaluate a cubic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\r\nexport function cubicPoint(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number): Vector2 {\r\n return {\r\n x: cubicAxis(t, p0.x, p1.x, p2.x, p3.x),\r\n y: cubicAxis(t, p0.y, p1.y, p2.y, p3.y),\r\n };\r\n}\r\n\r\n/** Evaluate a quadratic Bézier at parameter `t` (0..1) into a {@link Vector2}. */\r\nexport function quadPoint(p0: Vector2, p1: Vector2, p2: Vector2, t: number): Vector2 {\r\n return {\r\n x: quadAxis(t, p0.x, p1.x, p2.x),\r\n y: quadAxis(t, p0.y, p1.y, p2.y),\r\n };\r\n}\r\n\r\n/**\r\n * Approximate the arc length of a parametric curve by sampling it into a polyline\r\n * and summing the segment distances. More `steps` trade speed for accuracy.\r\n */\r\nexport function sampleCurveLength(pointAt: (t: number) => Vector2, steps = 32): number {\r\n let length = 0;\r\n let prev = pointAt(0);\r\n for (let i = 1; i <= steps; i++) {\r\n const next = pointAt(i / steps);\r\n length += distance(prev, next);\r\n prev = next;\r\n }\r\n return length;\r\n}\r\n\r\n/**\r\n * Binary-search the curve parameter `t` whose arc length from the start equals\r\n * `targetDist`. Used to find exactly where a curve should be cut. The curve is\r\n * re-sampled on each probe, so this is intentionally simple rather than fast;\r\n * 20 iterations give sub-pixel precision for typical path lengths.\r\n */\r\nexport function paramAtDistance(\r\n pointAt: (t: number) => Vector2,\r\n targetDist: number,\r\n totalLen: number,\r\n): number {\r\n if (totalLen === 0 || targetDist <= 0) return 0;\r\n if (targetDist >= totalLen) return 1;\r\n\r\n let lo = 0, hi = 1;\r\n for (let i = 0; i < 20; i++) {\r\n const mid = (lo + hi) / 2;\r\n let len = 0;\r\n let prev = pointAt(0);\r\n const steps = 16;\r\n for (let j = 1; j <= steps; j++) {\r\n const p = pointAt(mid * j / steps);\r\n len += distance(prev, p);\r\n prev = p;\r\n }\r\n if (len < targetDist) lo = mid;\r\n else hi = mid;\r\n }\r\n return (lo + hi) / 2;\r\n}\r\n\r\n// --- Degree conversion -----------------------------------------------------\r\n\r\n/** A straight line as a cubic: controls sit on the line at 1/3 and 2/3. */\r\nexport function lineToCubic(from: Vector2, to: Vector2): Cubic {\r\n return {\r\n p0: from,\r\n c1: lerpVector2(from, to, 1 / 3),\r\n c2: lerpVector2(from, to, 2 / 3),\r\n p1: to,\r\n };\r\n}\r\n\r\n/** Elevate a quadratic Bézier to the equivalent cubic (exact, not an approximation). */\r\nexport function quadToCubic(from: Vector2, cp: Vector2, to: Vector2): Cubic {\r\n return {\r\n p0: from,\r\n c1: { x: from.x + (2 / 3) * (cp.x - from.x), y: from.y + (2 / 3) * (cp.y - from.y) },\r\n c2: { x: to.x + (2 / 3) * (cp.x - to.x), y: to.y + (2 / 3) * (cp.y - to.y) },\r\n p1: to,\r\n };\r\n}\r\n\r\n// --- De Casteljau splitting ---\r\n// Splitting a Bézier at parameter `t` yields two sub-curves that together trace\r\n// the exact same shape, so trimming preserves curvature instead of polylining it.\r\n\r\nexport function splitCubicAt(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: number) {\r\n const a = lerpVector2(p0, p1, t);\r\n const b = lerpVector2(p1, p2, t);\r\n const c = lerpVector2(p2, p3, t);\r\n const d = lerpVector2(a, b, t);\r\n const e = lerpVector2(b, c, t);\r\n const f = lerpVector2(d, e, t);\r\n return {\r\n left: { from: p0, cp1: a, cp2: d, to: f },\r\n right: { from: f, cp1: e, cp2: c, to: p3 },\r\n };\r\n}\r\n\r\n/** The sub-cubic spanning parameters `t0..t1` of the original cubic. */\r\nexport function extractCubicRange(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t0: number, t1: number) {\r\n if (t0 === 0) return splitCubicAt(p0, p1, p2, p3, t1).left;\r\n const { right } = splitCubicAt(p0, p1, p2, p3, t0);\r\n const adj = (t1 - t0) / (1 - t0);\r\n return splitCubicAt(right.from, right.cp1, right.cp2, right.to, adj).left;\r\n}\r\n\r\nexport function splitQuadAt(p0: Vector2, p1: Vector2, p2: Vector2, t: number) {\r\n const a = lerpVector2(p0, p1, t);\r\n const b = lerpVector2(p1, p2, t);\r\n const c = lerpVector2(a, b, t);\r\n return {\r\n left: { from: p0, cp: a, to: c },\r\n right: { from: c, cp: b, to: p2 },\r\n };\r\n}\r\n\r\n/** The sub-quadratic spanning parameters `t0..t1` of the original quadratic. */\r\nexport function extractQuadRange(p0: Vector2, p1: Vector2, p2: Vector2, t0: number, t1: number) {\r\n if (t0 === 0) return splitQuadAt(p0, p1, p2, t1).left;\r\n const { right } = splitQuadAt(p0, p1, p2, t0);\r\n const adj = (t1 - t0) / (1 - t0);\r\n return splitQuadAt(right.from, right.cp, right.to, adj).left;\r\n}\r\n\r\n// --- Extrema ---------------------------------------------------------------\r\n\r\n/** The `t` values in (0, 1) where a cubic's one-dimensional derivative is zero. */\r\nexport function cubicExtrema(p0: number, p1: number, p2: number, p3: number): number[] {\r\n // B'(t) = 3[(p1−p0)(1−t)² + 2(p2−p1)t(1−t) + (p3−p2)t²], written as at² + bt + c.\r\n const a = -p0 + 3 * p1 - 3 * p2 + p3;\r\n const b = 2 * (p0 - 2 * p1 + p2);\r\n const c = p1 - p0;\r\n const roots: number[] = [];\r\n const push = (t: number) => {\r\n if (t > 0 && t < 1) roots.push(t);\r\n };\r\n if (Math.abs(a) < 1e-12) {\r\n if (Math.abs(b) > 1e-12) push(-c / b);\r\n return roots;\r\n }\r\n const disc = b * b - 4 * a * c;\r\n if (disc < 0) return roots;\r\n const root = Math.sqrt(disc);\r\n push((-b + root) / (2 * a));\r\n push((-b - root) / (2 * a));\r\n return roots;\r\n}\r\n\r\n/** The `t` value in (0, 1) where a quadratic's one-dimensional derivative is zero. */\r\nexport function quadExtrema(p0: number, p1: number, p2: number): number[] {\r\n // B'(t) = 2[(p1−p0)(1−t) + (p2−p1)t] = 0.\r\n const denominator = p0 - 2 * p1 + p2;\r\n if (Math.abs(denominator) < 1e-12) return [];\r\n const t = (p0 - p1) / denominator;\r\n return t > 0 && t < 1 ? [t] : [];\r\n}\r\n\r\n// --- Arc endpoint-to-center conversion -------------------------------------\r\n\r\nfunction angleBetween(ux: number, uy: number, vx: number, vy: number): number {\r\n const dot = ux * vx + uy * vy;\r\n const len = Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);\r\n let angle = Math.acos(Math.max(-1, Math.min(1, dot / len)));\r\n if (ux * vy - uy * vx < 0) angle = -angle;\r\n return angle;\r\n}\r\n\r\n\r\n/**\r\n * The endpoint→center conversion of an SVG `A` command.\r\n *\r\n * Returned as the ellipse's own parameters rather than as a sampler, because the\r\n * two things that need an arc want different halves of it: flattening wants\r\n * points, and bounding wants the angles where each axis turns around. A sampler\r\n * alone forces the second to guess.\r\n */\r\nexport function arcParams(\r\n from: Vector2, to: Vector2,\r\n rxRaw: number, ryRaw: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1,\r\n): ArcParams {\r\n const phi = rotation * Math.PI / 180;\r\n const cosPhi = Math.cos(phi), sinPhi = Math.sin(phi);\r\n\r\n const dx = (from.x - to.x) / 2;\r\n const dy = (from.y - to.y) / 2;\r\n const x1p = cosPhi * dx + sinPhi * dy;\r\n const y1p = -sinPhi * dx + cosPhi * dy;\r\n\r\n let rx = Math.abs(rxRaw), ry = Math.abs(ryRaw);\r\n const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);\r\n if (lambda > 1) {\r\n const s = Math.sqrt(lambda);\r\n rx *= s;\r\n ry *= s;\r\n }\r\n\r\n const rx2 = rx * rx, ry2 = ry * ry;\r\n const x1p2 = x1p * x1p, y1p2 = y1p * y1p;\r\n const sq = Math.max(0, (rx2 * ry2 - rx2 * y1p2 - ry2 * x1p2) / (rx2 * y1p2 + ry2 * x1p2));\r\n const sign = (largeArc === sweep) ? -1 : 1;\r\n const cxp = sign * Math.sqrt(sq) * (rx * y1p / ry);\r\n const cyp = sign * Math.sqrt(sq) * -(ry * x1p / rx);\r\n\r\n const cx = cosPhi * cxp - sinPhi * cyp + (from.x + to.x) / 2;\r\n const cy = sinPhi * cxp + cosPhi * cyp + (from.y + to.y) / 2;\r\n\r\n const theta1 = angleBetween(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);\r\n let dtheta = angleBetween((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);\r\n if (sweep === 0 && dtheta > 0) dtheta -= 2 * Math.PI;\r\n if (sweep === 1 && dtheta < 0) dtheta += 2 * Math.PI;\r\n\r\n return { cx, cy, rx, ry, phi, theta1, dtheta };\r\n}\r\n\r\n/** The point on an arc at ellipse angle `theta`. */\r\nexport function arcPointAtAngle(arc: ArcParams, theta: number): Vector2 {\r\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\r\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\r\n return {\r\n x: cosPhi * arc.rx * cosT - sinPhi * arc.ry * sinT + arc.cx,\r\n y: sinPhi * arc.rx * cosT + cosPhi * arc.ry * sinT + arc.cy,\r\n };\r\n}\r\n\r\n/** A parametric function tracing the arc from its start (`t=0`) to its end (`t=1`). */\r\nexport function arcPointFunction(arc: ArcParams): (t: number) => Vector2 {\r\n return (t: number) => arcPointAtAngle(arc, arc.theta1 + t * arc.dtheta);\r\n}\r\n\r\n/** The derivative of {@link arcPointAtAngle} with respect to `theta`. */\r\nfunction arcDerivativeAtAngle(arc: ArcParams, theta: number): Vector2 {\r\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\r\n const cosT = Math.cos(theta), sinT = Math.sin(theta);\r\n return {\r\n x: -arc.rx * cosPhi * sinT - arc.ry * sinPhi * cosT,\r\n y: -arc.rx * sinPhi * sinT + arc.ry * cosPhi * cosT,\r\n };\r\n}\r\n\r\n/**\r\n * The arc's `theta0..theta1` span as cubics — the one place an arc is\r\n * approximated.\r\n *\r\n * Split so no piece spans more than 90°, which is the standard bound: the\r\n * `(4/3)·tan(Δ/4)` construction is exact at both endpoints and at the midpoint,\r\n * and its worst-case radial error over a quarter turn is about 2.7e-4 of the\r\n * radius. There were two implementations of this before — one splitting by\r\n * angle, one fitting sampled points with a \"catmull-rom-like\" guess — and only\r\n * the first was worth keeping.\r\n */\r\nexport function arcSweepToCubics(arc: ArcParams, theta0: number, theta1: number): Cubic[] {\r\n const sweep = theta1 - theta0;\r\n if (Math.abs(sweep) < 1e-12) return [];\r\n const pieces = Math.max(1, Math.ceil(Math.abs(sweep) / (Math.PI / 2)));\r\n const step = sweep / pieces;\r\n const alpha = (4 / 3) * Math.tan(step / 4);\r\n\r\n const cubics: Cubic[] = [];\r\n for (let i = 0; i < pieces; i++) {\r\n const a0 = theta0 + step * i;\r\n const a1 = a0 + step;\r\n const p0 = arcPointAtAngle(arc, a0);\r\n const p1 = arcPointAtAngle(arc, a1);\r\n const d0 = arcDerivativeAtAngle(arc, a0);\r\n const d1 = arcDerivativeAtAngle(arc, a1);\r\n cubics.push({\r\n p0,\r\n c1: { x: p0.x + alpha * d0.x, y: p0.y + alpha * d0.y },\r\n c2: { x: p1.x - alpha * d1.x, y: p1.y - alpha * d1.y },\r\n p1,\r\n });\r\n }\r\n return cubics;\r\n}\r\n\r\n/**\r\n * The ellipse angles at which each axis turns around — the candidates an exact\r\n * bounding box tests against the swept range.\r\n */\r\nexport function arcAxisAngles(arc: ArcParams): { x: number[]; y: number[] } {\r\n const cosPhi = Math.cos(arc.phi), sinPhi = Math.sin(arc.phi);\r\n // dx/dθ = 0 and dy/dθ = 0, each giving one angle and its antipode.\r\n const tx = Math.atan2(-arc.ry * sinPhi, arc.rx * cosPhi);\r\n const ty = Math.atan2(arc.ry * cosPhi, arc.rx * sinPhi);\r\n return {\r\n x: [tx, tx + Math.PI],\r\n y: [ty, ty + Math.PI],\r\n };\r\n}\r\n\r\n/**\r\n * Whether ellipse angle `theta` lies within the arc's swept range.\r\n *\r\n * Compared as a distance travelled in the sweep's own direction rather than as\r\n * an interval, because `theta1 + dtheta` routinely leaves `[-π, π]` and an\r\n * interval test would then reject the very angles that are inside it.\r\n */\r\nexport function arcContainsAngle(arc: ArcParams, theta: number): boolean {\r\n const TAU = Math.PI * 2;\r\n const forward = arc.dtheta >= 0;\r\n const delta = forward ? theta - arc.theta1 : arc.theta1 - theta;\r\n const travelled = ((delta % TAU) + TAU) % TAU;\r\n return travelled <= Math.abs(arc.dtheta) + 1e-9;\r\n}\r\n\r\n/** Re-exported so curve math and point lerping live behind a single import. */\r\nexport { lerpVector2 };\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\n * Path geometry.\n *\n * One value — {@link pathOps} — carries every operation: parsing, the contour\n * normal form, bounds, length, sampling, dashing, trimming, morphing, and the\n * editable anchor model with its unit box. The free functions this used to\n * export (`calculatePathLength`, `applyDashPattern`, `extractSubpath`,\n * `createPathSampler`, `measurePathData`, `parsePathString`, `toPathCommands`,\n * `lerpPath`, `buildMorph`, `sampleMorph`, `toCubicSubpaths`) are those methods\n * now; each carried its own copy of the SVG pen walk, and the copies disagreed.\n */\nexport { pathOps } from \"./ops\";\nexport { EMPTY_PATH_DATA, PATH_UNIT_EXTENT, PATH_UNIT_HALF, UNIT_PATH_BOX } from \"./anchors\";\nexport type * from \"./types\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\r\n * Path geometry.\r\n *\r\n * One value — {@link pathOps} — carries every operation: parsing, the contour\r\n * normal form, bounds, length, sampling, dashing, trimming, morphing, and the\r\n * editable anchor model with its unit box. The free functions this used to\r\n * export (`calculatePathLength`, `applyDashPattern`, `extractSubpath`,\r\n * `createPathSampler`, `measurePathData`, `parsePathString`, `toPathCommands`,\r\n * `lerpPath`, `buildMorph`, `sampleMorph`, `toCubicSubpaths`) are those methods\r\n * now; each carried its own copy of the SVG pen walk, and the copies disagreed.\r\n */\r\nexport { pathOps } from \"./ops\";\r\nexport { EMPTY_PATH_DATA, PATH_UNIT_EXTENT, PATH_UNIT_HALF, UNIT_PATH_BOX } from \"./anchors\";\r\nexport type * from \"./types\";\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/measure.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKjF,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,SAAS,OAAO,CAAC,OAAoB;IACjC,6EAA6E;IAC7E,8DAA8D;IAC9D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAC9F,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAoB;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,UAAU,GAAa,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,K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AC,QAAQ,EAAE,CAAC;QACpC,yEAAyE;QACzE,uEAAuE;QACvE,kDAAkD;QAClD,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,KAAK,MAAM,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACxC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;YACxC,MAAM,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;YACpC,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,IAAI,SAAS,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;gBAChE,WAAW,GAAG,MAAM,CAAC;gBACrB,SAAS;YACb,CAAC;YAED,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAElF,IAAI,SAAS,EAAE,CAAC;gBACZ,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC3C,SAAS,GAAG,KAAK,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9C,WAAW,GAAG,MAAM,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Arc length, and everything measured in it: total length, the sampler, dashing\n * and trimming.\n *\n * Separate from the normal form because it is the expensive half of path\n * geometry and most callers never need it — bounding a path solves extrema in\n * closed form, and `Path.measure` / `Text.measure` run on every layout pass. So\n * flattening happens here, on demand.\n *\n * **One resolution.** There used to be three — 20 steps for\n * `length`, 32 for the trim segments, 50 for the sampler and the\n * dash walker — and `dash` combined two of them, scaling its dash\n * cycle against a length measured at 20 while walking the path at 50. Sharing\n * one number makes `length(d) === sampler(d).length` an invariant rather than a\n * coincidence.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance } from \"./bezier\";\nimport { contourSegments, contours, segmentPointAt, segmentSplit } from \"./walk\";\nimport type {\n ContourMetric, PathContour, PathFrame, PathMetric, PathSampler, PathSegment, SegmentMetric,\n} from \"./types\";\n\n/** Line segments each curve is flattened into. */\nexport const SAMPLE_STEPS = 50;\n\nfunction flatten(segment: PathSegment): Vector2[] {\n // A line is already a polyline. Skipping the loop matters: a polygon path is\n // all lines, and 50 collinear samples per edge is pure waste.\n if (segment.kind === \"line\") return [segment.from, segment.to];\n const points: Vector2[] = [segment.from];\n for (let i = 1; i < SAMPLE_STEPS; i++) points.push(segmentPointAt(segment, i / SAMPLE_STEPS));\n points.push(segment.to);\n return points;\n}\n\nexport function measureSegment(segment: PathSegment): SegmentMetric {\n const points = flatten(segment);\n const cumulative: number[] = [0];\n let total = 0;\n for (let i = 1; i < points.length; i++) {\n total += distance(points[i - 1], points[i]);\n cumulative.push(total);\n }\n return { segment, points, cumulative, length: total };\n}\n\nexport function measureContours(contours: PathContour[]): PathMetric {\n let total = 0;\n const measured = contours.map((contour) => {\n const metrics = contourSegments(contour).map(measureSegment);\n const length = metrics.reduce((sum, m) => sum + m.length, 0);\n total += length;\n return { contour, metrics, length };\n });\n return { contours: measured, length: total };\n}\n\n/**\n * The parameter `t` at arc-length distance `d` into a segment.\n *\n * Read off the flattened table rather than binary-searched: the table is already\n * built, and a search that re-samples the curve on every probe cost 320 point\n * evaluations per query to answer the same question less consistently — its\n * answer disagreed with the sampler's, which read the same curve off a polyline.\n */\nexport function paramAtDist(metric: SegmentMetric, d: number): number {\n const { cumulative, length } = metric;\n if (length <= 0) return 0;\n if (d <= 0) return 0;\n if (d >= length) return 1;\n\n let lo = 0;\n let hi = cumulative.length - 1;\n while (lo < hi - 1) {\n const mid = (lo + hi) >> 1;\n if (cumulative[mid] <= d) lo = mid;\n else hi = mid;\n }\n const span = cumulative[hi] - cumulative[lo];\n const within = span > 0 ? (d - cumulative[lo]) / span : 0;\n const steps = cumulative.length - 1;\n return (lo + within) / steps;\n}\n\nexport function length(d: PathData | null | undefined): number {\n return measureContours(contours(d)).length;\n}\n\n/**\n * Build a {@link PathSampler} from any {@link PathData}.\n *\n * The tangent is the chord of the flattened segment the distance lands in, not\n * the curve's analytic derivative. Less exact, and deliberately kept: every\n * glyph on every text-on-path is placed with it, so changing it is a visual\n * change that deserves its own commit rather than a side effect of this one.\n */\nexport function sampler(d: PathData): PathSampler {\n const metric = measureContours(contours(d));\n\n // One point list across every contour. The jump from one contour's end to the\n // next one's start carries no length — text does not flow across it, matching\n // SVG `textPath` — so it is recorded as a zero-length step rather than a gap\n // in the table.\n const points: Vector2[] = [];\n const cumulative: number[] = [];\n let total = 0;\n for (const contourMetric of metric.contours) {\n const first = contourMetric.metrics[0]?.segment.from ?? contourMetric.contour.start;\n points.push(first);\n cumulative.push(total);\n for (const segmentMetric of contourMetric.metrics) {\n for (let i = 1; i < segmentMetric.points.length; i++) {\n total += distance(segmentMetric.points[i - 1], segmentMetric.points[i]);\n points.push(segmentMetric.points[i]);\n cumulative.push(total);\n }\n }\n }\n\n let cursor = 0; // last segment index used, for the monotonic fast path.\n\n const frameAt = (d: number): PathFrame | null => {\n if (total <= 0 || points.length < 2) return null;\n const target = Math.max(0, Math.min(total, d));\n\n // Reset the cursor if the caller stepped backwards.\n if (cumulative[cursor] > target) cursor = 0;\n // Advance to the step containing `target`, skipping the zero-length steps\n // that bridge contours so we land on real geometry.\n while (\n cursor < points.length - 2 &&\n (cumulative[cursor + 1] < target || cumulative[cursor + 1] === cumulative[cursor])\n ) {\n cursor++;\n }\n\n const a = points[cursor];\n const b = points[cursor + 1];\n const segStart = cumulative[cursor];\n const segLen = cumulative[cursor + 1] - segStart;\n const t = segLen > 0 ? (target - segStart) / segLen : 0;\n\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const segDist = Math.hypot(dx, dy);\n // Degenerate step: fall back to the point with no meaningful tangent.\n const tx = segDist > 0 ? dx / segDist : 1;\n const ty = segDist > 0 ? dy / segDist : 0;\n\n return { x: a.x + dx * t, y: a.y + dy * t, tx, ty };\n };\n\n return { length: total, frameAt };\n}\n\n/** A contour's flattened polyline. */\nfunction contourPoints(metric: ContourMetric): Vector2[] {\n const first = metric.metrics[0]?.segment.from ?? metric.contour.start;\n const points: Vector2[] = [first];\n for (const segment of metric.metrics) {\n for (let i = 1; i < segment.points.length; i++) points.push(segment.points[i]);\n }\n return points;\n}\n\n/**\n * Walks a flattened subpath at constant speed, emitting `M`/`L` commands for the\n * \"on\" runs of the dash pattern. `scaledDash` alternates on/off lengths starting\n * with \"on\"; the index wraps so the pattern repeats along the whole subpath, and\n * `offset` is how far into it the subpath starts. A zero-length dash is a dot:\n * a run a sliver long along the path, so the cap drawn on it has a direction —\n * including the dots an open subpath is fit to start and end on.\n */\nfunction dashSubpath(points: Vector2[], scaledDash: number[], offset: number, closed: boolean): string {\n if (points.length < 2) return '';\n\n const cycle = scaledDash.reduce((a, b) => a + b, 0);\n const sliver = cycle * 1e-4;\n const tolerance = cycle * 1e-9;\n const into = ((offset % cycle) + cycle) % cycle;\n let dashIndex = 0;\n let passed = 0;\n while (passed + scaledDash[dashIndex] <= into) {\n if (scaledDash[dashIndex] === 0 && into - passed <= tolerance) break;\n passed += scaledDash[dashIndex];\n dashIndex = (dashIndex + 1) % scaledDash.length;\n if (dashIndex === 0) break;\n }\n\n const parts: string[] = [];\n let remaining = scaledDash[dashIndex] - (into - passed); // Distance left in the current dash segment.\n let isOn = dashIndex % 2 === 0; // Whether we're currently drawing (on) or skipping (off).\n let needMove = true; // Whether the next \"on\" run still needs an opening M.\n let last: { point: Vector2; x: number; y: number } | null = null;\n\n for (let i = 1; i < points.length; i++) {\n const p0 = points[i - 1];\n const p1 = points[i];\n const dx = p1.x - p0.x;\n const dy = p1.y - p0.y;\n const segLen = distance(p0, p1);\n\n if (segLen === 0) continue;\n last = { point: p1, x: dx / segLen, y: dy / segLen };\n\n let walked = 0;\n\n while (walked < segLen) {\n const available = segLen - walked;\n\n if (remaining >= available) {\n if (isOn) {\n if (needMove) {\n const t = walked / segLen;\n parts.push(`M ${p0.x + t * dx} ${p0.y + t * dy}`);\n needMove = false;\n }\n parts.push(`L ${p1.x} ${p1.y}`);\n }\n remaining -= available;\n walked = segLen;\n\n if (remaining <= tolerance) {\n dashIndex = (dashIndex + 1) % scaledDash.length;\n isOn = !isOn;\n remaining = scaledDash[dashIndex];\n if (isOn) needMove = true;\n }\n } else {\n const endT = (walked + remaining) / segLen;\n const endX = p0.x + endT * dx;\n const endY = p0.y + endT * dy;\n\n if (isOn) {\n if (needMove) {\n const startT = walked / segLen;\n parts.push(`M ${p0.x + startT * dx} ${p0.y + startT * dy}`);\n needMove = false;\n }\n const reach = remaining > 0 ? 0 : sliver / segLen;\n parts.push(`L ${endX + reach * dx} ${endY + reach * dy}`);\n }\n\n walked += remaining;\n dashIndex = (dashIndex + 1) % scaledDash.length;\n isOn = !isOn;\n remaining = scaledDash[dashIndex];\n if (isOn) needMove = true;\n }\n }\n }\n\n if (!closed && isOn && remaining <= tolerance && last) {\n const { point, x, y } = last;\n parts.push(`M ${point.x} ${point.y} L ${point.x - x * sliver} ${point.y - y * sliver}`);\n }\n\n return parts.join(' ');\n}\n\n/**\n * How far `pattern` is stretched to fit one contour of a path `total` long —\n * the renderer's rule as well as {@link dash}'s. A closed contour is fit with\n * the rest of the path, to whole cycles of `total`; an open one is fit alone to\n * whole cycles less the final gap, so it starts and ends on a dash. An odd\n * pattern alternates across cycles, has no final gap to drop, and fits as\n * closed. `null` when there is nothing to fit.\n */\nexport function dashScale(\n pattern: number[],\n contour: { length: number; closed: boolean },\n total: number,\n): number | null {\n const cycle = pattern.reduce((a, b) => a + b, 0);\n if (cycle <= 0 || total <= 0) return null;\n if (!contour.closed && contour.length > 0 && pattern.length % 2 === 0) {\n const lastGap = pattern[pattern.length - 1];\n const span = Math.max(1, Math.round((contour.length + lastGap) / cycle)) * cycle - lastGap;\n if (span > 0) return contour.length / span;\n }\n return total / (Math.max(1, Math.round(total / cycle)) * cycle);\n}\n\n/**\n * Converts path geometry into a dashed SVG path string, each contour fit by\n * {@link dashScale} and starting `offset` into the pattern, as the renderer\n * dashes a stroke.\n *\n * @param d The path to dash.\n * @param dash Alternating on/off lengths (e.g. `[4, 2]` = 4 on, 2 off).\n * @returns An SVG path `d` string containing only the visible dash segments,\n * or `''` when there is nothing to draw.\n */\nexport function dash(d: PathData | null | undefined, dash: number[], offset = 0): string {\n if (!dash || dash.length === 0) return '';\n\n const metric = measureContours(contours(d));\n const runs: string[] = [];\n for (const contour of metric.contours) {\n const scale = dashScale(dash, { length: contour.length, closed: contour.contour.closed }, metric.length);\n if (scale === null) return '';\n const run = dashSubpath(\n contourPoints(contour), dash.map(value => value * scale), offset * scale, contour.contour.closed,\n );\n if (run) runs.push(run);\n }\n return runs.join(' ');\n}\n\n/**\n * The portion of `d` between the normalized arc-length fractions `start` and\n * `end` (both 0..1), as a fresh command list.\n *\n * A full `0..1` range or an empty path is returned unchanged; an empty or\n * inverted range returns `[]`.\n */\nexport function trim(d: PathData, start: number, end: number): PathData {\n if (start === 0 && end === 1) return d;\n\n const s = Math.max(0, Math.min(1, start));\n const e = Math.max(s, Math.min(1, end));\n if (s === 0 && e === 1) return d;\n if (s >= e) return [];\n\n const metric = measureContours(contours(d));\n if (metric.length === 0) return d;\n\n const startDist = s * metric.length;\n const endDist = e * metric.length;\n\n const result: PathCommand[] = [];\n let accumulated = 0;\n\n for (const contour of metric.contours) {\n // Each contour opens its own `M`. Sharing one across all of them — which\n // is what a single flat segment list did — draws a line across the gap\n // between two contours that the source never had.\n let needsMove = true;\n\n for (const metricEntry of contour.metrics) {\n const { segment, length } = metricEntry;\n const segEnd = accumulated + length;\n if (length === 0 || segEnd <= startDist || accumulated >= endDist) {\n accumulated = segEnd;\n continue;\n }\n\n const t0 = accumulated < startDist ? paramAtDist(metricEntry, startDist - accumulated) : 0;\n const t1 = segEnd > endDist ? paramAtDist(metricEntry, endDist - accumulated) : 1;\n\n if (needsMove) {\n const p = segmentPointAt(segment, t0);\n result.push({ type: \"M\", x: p.x, y: p.y });\n needsMove = false;\n }\n result.push(...segmentSplit(segment, t0, t1));\n accumulated = segEnd;\n }\n }\n\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/measure.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKjF,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,SAAS,OAAO,CAAC,OAAoB;IACjC,6EAA6E;IAC7E,8DAA8D;IAC9D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAC9F,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,C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AAC,CAAC,EAAE,CAAC,CAAC;gBAC3C,SAAS,GAAG,KAAK,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9C,WAAW,GAAG,MAAM,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["/**\r\n * Arc length, and everything measured in it: total length, the sampler, dashing\r\n * and trimming.\r\n *\r\n * Separate from the normal form because it is the expensive half of path\r\n * geometry and most callers never need it — bounding a path solves extrema in\r\n * closed form, and `Path.measure` / `Text.measure` run on every layout pass. So\r\n * flattening happens here, on demand.\r\n *\r\n * **One resolution.** There used to be three — 20 steps for\r\n * `length`, 32 for the trim segments, 50 for the sampler and the\r\n * dash walker — and `dash` combined two of them, scaling its dash\r\n * cycle against a length measured at 20 while walking the path at 50. Sharing\r\n * one number makes `length(d) === sampler(d).length` an invariant rather than a\r\n * coincidence.\r\n */\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { distance } from \"./bezier\";\r\nimport { contourSegments, contours, segmentPointAt, segmentSplit } from \"./walk\";\r\nimport type {\r\n ContourMetric, PathContour, PathFrame, PathMetric, PathSampler, PathSegment, SegmentMetric,\r\n} from \"./types\";\r\n\r\n/** Line segments each curve is flattened into. */\r\nexport const SAMPLE_STEPS = 50;\r\n\r\nfunction flatten(segment: PathSegment): Vector2[] {\r\n // A line is already a polyline. Skipping the loop matters: a polygon path is\r\n // all lines, and 50 collinear samples per edge is pure waste.\r\n if (segment.kind === \"line\") return [segment.from, segment.to];\r\n const points: Vector2[] = [segment.from];\r\n for (let i = 1; i < SAMPLE_STEPS; i++) points.push(segmentPointAt(segment, i / SAMPLE_STEPS));\r\n points.push(segment.to);\r\n return points;\r\n}\r\n\r\nexport function measureSegment(segment: PathSegment): SegmentMetric {\r\n const points = flatten(segment);\r\n const cumulative: number[] = [0];\r\n let total = 0;\r\n for (let i = 1; i < points.length; i++) {\r\n total += distance(points[i - 1], points[i]);\r\n cumulative.push(total);\r\n }\r\n return { segment, points, cumulative, length: total };\r\n}\r\n\r\nexport function measureContours(contours: PathContour[]): PathMetric {\r\n let total = 0;\r\n const measured = contours.map((contour) => {\r\n const metrics = contourSegments(contour).map(measureSegment);\r\n const length = metrics.reduce((sum, m) => sum + m.length, 0);\r\n total += length;\r\n return { contour, metrics, length };\r\n });\r\n return { contours: measured, length: total };\r\n}\r\n\r\n/**\r\n * The parameter `t` at arc-length distance `d` into a segment.\r\n *\r\n * Read off the flattened table rather than binary-searched: the table is already\r\n * built, and a search that re-samples the curve on every probe cost 320 point\r\n * evaluations per query to answer the same question less consistently — its\r\n * answer disagreed with the sampler's, which read the same curve off a polyline.\r\n */\r\nexport function paramAtDist(metric: SegmentMetric, d: number): number {\r\n const { cumulative, length } = metric;\r\n if (length <= 0) return 0;\r\n if (d <= 0) return 0;\r\n if (d >= length) return 1;\r\n\r\n let lo = 0;\r\n let hi = cumulative.length - 1;\r\n while (lo < hi - 1) {\r\n const mid = (lo + hi) >> 1;\r\n if (cumulative[mid] <= d) lo = mid;\r\n else hi = mid;\r\n }\r\n const span = cumulative[hi] - cumulative[lo];\r\n const within = span > 0 ? (d - cumulative[lo]) / span : 0;\r\n const steps = cumulative.length - 1;\r\n return (lo + within) / steps;\r\n}\r\n\r\nexport function length(d: PathData | null | undefined): number {\r\n return measureContours(contours(d)).length;\r\n}\r\n\r\n/**\r\n * Build a {@link PathSampler} from any {@link PathData}.\r\n *\r\n * The tangent is the chord of the flattened segment the distance lands in, not\r\n * the curve's analytic derivative. Less exact, and deliberately kept: every\r\n * glyph on every text-on-path is placed with it, so changing it is a visual\r\n * change that deserves its own commit rather than a side effect of this one.\r\n */\r\nexport function sampler(d: PathData): PathSampler {\r\n const metric = measureContours(contours(d));\r\n\r\n // One point list across every contour. The jump from one contour's end to the\r\n // next one's start carries no length — text does not flow across it, matching\r\n // SVG `textPath` — so it is recorded as a zero-length step rather than a gap\r\n // in the table.\r\n const points: Vector2[] = [];\r\n const cumulative: number[] = [];\r\n let total = 0;\r\n for (const contourMetric of metric.contours) {\r\n const first = contourMetric.metrics[0]?.segment.from ?? contourMetric.contour.start;\r\n points.push(first);\r\n cumulative.push(total);\r\n for (const segmentMetric of contourMetric.metrics) {\r\n for (let i = 1; i < segmentMetric.points.length; i++) {\r\n total += distance(segmentMetric.points[i - 1], segmentMetric.points[i]);\r\n points.push(segmentMetric.points[i]);\r\n cumulative.push(total);\r\n }\r\n }\r\n }\r\n\r\n let cursor = 0; // last segment index used, for the monotonic fast path.\r\n\r\n const frameAt = (d: number): PathFrame | null => {\r\n if (total <= 0 || points.length < 2) return null;\r\n const target = Math.max(0, Math.min(total, d));\r\n\r\n // Reset the cursor if the caller stepped backwards.\r\n if (cumulative[cursor] > target) cursor = 0;\r\n // Advance to the step containing `target`, skipping the zero-length steps\r\n // that bridge contours so we land on real geometry.\r\n while (\r\n cursor < points.length - 2 &&\r\n (cumulative[cursor + 1] < target || cumulative[cursor + 1] === cumulative[cursor])\r\n ) {\r\n cursor++;\r\n }\r\n\r\n const a = points[cursor];\r\n const b = points[cursor + 1];\r\n const segStart = cumulative[cursor];\r\n const segLen = cumulative[cursor + 1] - segStart;\r\n const t = segLen > 0 ? (target - segStart) / segLen : 0;\r\n\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const segDist = Math.hypot(dx, dy);\r\n // Degenerate step: fall back to the point with no meaningful tangent.\r\n const tx = segDist > 0 ? dx / segDist : 1;\r\n const ty = segDist > 0 ? dy / segDist : 0;\r\n\r\n return { x: a.x + dx * t, y: a.y + dy * t, tx, ty };\r\n };\r\n\r\n return { length: total, frameAt };\r\n}\r\n\r\n/** A contour's flattened polyline. */\r\nfunction contourPoints(metric: ContourMetric): Vector2[] {\r\n const first = metric.metrics[0]?.segment.from ?? metric.contour.start;\r\n const points: Vector2[] = [first];\r\n for (const segment of metric.metrics) {\r\n for (let i = 1; i < segment.points.length; i++) points.push(segment.points[i]);\r\n }\r\n return points;\r\n}\r\n\r\n/**\r\n * Walks a flattened subpath at constant speed, emitting `M`/`L` commands for the\r\n * \"on\" runs of the dash pattern. `scaledDash` alternates on/off lengths starting\r\n * with \"on\"; the index wraps so the pattern repeats along the whole subpath, and\r\n * `offset` is how far into it the subpath starts. A zero-length dash is a dot:\r\n * a run a sliver long along the path, so the cap drawn on it has a direction —\r\n * including the dots an open subpath is fit to start and end on.\r\n */\r\nfunction dashSubpath(points: Vector2[], scaledDash: number[], offset: number, closed: boolean): string {\r\n if (points.length < 2) return '';\r\n\r\n const cycle = scaledDash.reduce((a, b) => a + b, 0);\r\n const sliver = cycle * 1e-4;\r\n const tolerance = cycle * 1e-9;\r\n const into = ((offset % cycle) + cycle) % cycle;\r\n let dashIndex = 0;\r\n let passed = 0;\r\n while (passed + scaledDash[dashIndex] <= into) {\r\n if (scaledDash[dashIndex] === 0 && into - passed <= tolerance) break;\r\n passed += scaledDash[dashIndex];\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n if (dashIndex === 0) break;\r\n }\r\n\r\n const parts: string[] = [];\r\n let remaining = scaledDash[dashIndex] - (into - passed); // Distance left in the current dash segment.\r\n let isOn = dashIndex % 2 === 0; // Whether we're currently drawing (on) or skipping (off).\r\n let needMove = true; // Whether the next \"on\" run still needs an opening M.\r\n let last: { point: Vector2; x: number; y: number } | null = null;\r\n\r\n for (let i = 1; i < points.length; i++) {\r\n const p0 = points[i - 1];\r\n const p1 = points[i];\r\n const dx = p1.x - p0.x;\r\n const dy = p1.y - p0.y;\r\n const segLen = distance(p0, p1);\r\n\r\n if (segLen === 0) continue;\r\n last = { point: p1, x: dx / segLen, y: dy / segLen };\r\n\r\n let walked = 0;\r\n\r\n while (walked < segLen) {\r\n const available = segLen - walked;\r\n\r\n if (remaining >= available) {\r\n if (isOn) {\r\n if (needMove) {\r\n const t = walked / segLen;\r\n parts.push(`M ${p0.x + t * dx} ${p0.y + t * dy}`);\r\n needMove = false;\r\n }\r\n parts.push(`L ${p1.x} ${p1.y}`);\r\n }\r\n remaining -= available;\r\n walked = segLen;\r\n\r\n if (remaining <= tolerance) {\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n isOn = !isOn;\r\n remaining = scaledDash[dashIndex];\r\n if (isOn) needMove = true;\r\n }\r\n } else {\r\n const endT = (walked + remaining) / segLen;\r\n const endX = p0.x + endT * dx;\r\n const endY = p0.y + endT * dy;\r\n\r\n if (isOn) {\r\n if (needMove) {\r\n const startT = walked / segLen;\r\n parts.push(`M ${p0.x + startT * dx} ${p0.y + startT * dy}`);\r\n needMove = false;\r\n }\r\n const reach = remaining > 0 ? 0 : sliver / segLen;\r\n parts.push(`L ${endX + reach * dx} ${endY + reach * dy}`);\r\n }\r\n\r\n walked += remaining;\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n isOn = !isOn;\r\n remaining = scaledDash[dashIndex];\r\n if (isOn) needMove = true;\r\n }\r\n }\r\n }\r\n\r\n if (!closed && isOn && remaining <= tolerance && last) {\r\n const { point, x, y } = last;\r\n parts.push(`M ${point.x} ${point.y} L ${point.x - x * sliver} ${point.y - y * sliver}`);\r\n }\r\n\r\n return parts.join(' ');\r\n}\r\n\r\n/**\r\n * How far `pattern` is stretched to fit one contour of a path `total` long —\r\n * the renderer's rule as well as {@link dash}'s. A closed contour is fit with\r\n * the rest of the path, to whole cycles of `total`; an open one is fit alone to\r\n * whole cycles less the final gap, so it starts and ends on a dash. An odd\r\n * pattern alternates across cycles, has no final gap to drop, and fits as\r\n * closed. `null` when there is nothing to fit.\r\n */\r\nexport function dashScale(\r\n pattern: number[],\r\n contour: { length: number; closed: boolean },\r\n total: number,\r\n): number | null {\r\n const cycle = pattern.reduce((a, b) => a + b, 0);\r\n if (cycle <= 0 || total <= 0) return null;\r\n if (!contour.closed && contour.length > 0 && pattern.length % 2 === 0) {\r\n const lastGap = pattern[pattern.length - 1];\r\n const span = Math.max(1, Math.round((contour.length + lastGap) / cycle)) * cycle - lastGap;\r\n if (span > 0) return contour.length / span;\r\n }\r\n return total / (Math.max(1, Math.round(total / cycle)) * cycle);\r\n}\r\n\r\n/**\r\n * Converts path geometry into a dashed SVG path string, each contour fit by\r\n * {@link dashScale} and starting `offset` into the pattern, as the renderer\r\n * dashes a stroke.\r\n *\r\n * @param d The path to dash.\r\n * @param dash Alternating on/off lengths (e.g. `[4, 2]` = 4 on, 2 off).\r\n * @returns An SVG path `d` string containing only the visible dash segments,\r\n * or `''` when there is nothing to draw.\r\n */\r\nexport function dash(d: PathData | null | undefined, dash: number[], offset = 0): string {\r\n if (!dash || dash.length === 0) return '';\r\n\r\n const metric = measureContours(contours(d));\r\n const runs: string[] = [];\r\n for (const contour of metric.contours) {\r\n const scale = dashScale(dash, { length: contour.length, closed: contour.contour.closed }, metric.length);\r\n if (scale === null) return '';\r\n const run = dashSubpath(\r\n contourPoints(contour), dash.map(value => value * scale), offset * scale, contour.contour.closed,\r\n );\r\n if (run) runs.push(run);\r\n }\r\n return runs.join(' ');\r\n}\r\n\r\n/**\r\n * The portion of `d` between the normalized arc-length fractions `start` and\r\n * `end` (both 0..1), as a fresh command list.\r\n *\r\n * A full `0..1` range or an empty path is returned unchanged; an empty or\r\n * inverted range returns `[]`.\r\n */\r\nexport function trim(d: PathData, start: number, end: number): PathData {\r\n if (start === 0 && end === 1) return d;\r\n\r\n const s = Math.max(0, Math.min(1, start));\r\n const e = Math.max(s, Math.min(1, end));\r\n if (s === 0 && e === 1) return d;\r\n if (s >= e) return [];\r\n\r\n const metric = measureContours(contours(d));\r\n if (metric.length === 0) return d;\r\n\r\n const startDist = s * metric.length;\r\n const endDist = e * metric.length;\r\n\r\n const result: PathCommand[] = [];\r\n let accumulated = 0;\r\n\r\n for (const contour of metric.contours) {\r\n // Each contour opens its own `M`. Sharing one across all of them — which\r\n // is what a single flat segment list did — draws a line across the gap\r\n // between two contours that the source never had.\r\n let needsMove = true;\r\n\r\n for (const metricEntry of contour.metrics) {\r\n const { segment, length } = metricEntry;\r\n const segEnd = accumulated + length;\r\n if (length === 0 || segEnd <= startDist || accumulated >= endDist) {\r\n accumulated = segEnd;\r\n continue;\r\n }\r\n\r\n const t0 = accumulated < startDist ? paramAtDist(metricEntry, startDist - accumulated) : 0;\r\n const t1 = segEnd > endDist ? paramAtDist(metricEntry, endDist - accumulated) : 1;\r\n\r\n if (needsMove) {\r\n const p = segmentPointAt(segment, t0);\r\n result.push({ type: \"M\", x: p.x, y: p.y });\r\n needsMove = false;\r\n }\r\n result.push(...segmentSplit(segment, t0, t1));\r\n accumulated = segEnd;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAS,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"morph.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAS,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,CAgBrE;AAkMD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,SAAS,CAuCtE;AAcD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAehE;AAuBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,QAAQ,CAItE"}
|
|
@@ -40,10 +40,22 @@ import { commands, contourSegments, contours, segmentCubics } from "./walk.js";
|
|
|
40
40
|
* where SVG says two.
|
|
41
41
|
*/
|
|
42
42
|
export function cubics(d) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const out = [];
|
|
44
|
+
for (const contour of contours(d)) {
|
|
45
|
+
// A lone `M` has nothing to interpolate: it draws nothing and has no
|
|
46
|
+
// first anchor to seed a partner from, so it is not a subpath here. It
|
|
47
|
+
// stays in `contours`, where it still occupies a point of the bounds.
|
|
48
|
+
const chain = contourSegments(contour).flatMap(segmentCubics);
|
|
49
|
+
if (chain.length === 0)
|
|
50
|
+
continue;
|
|
51
|
+
// `contours` is memoized and shared, so hand out copies of its points: a
|
|
52
|
+
// caller moving an anchor of the result must not move the cached path.
|
|
53
|
+
out.push({
|
|
54
|
+
cubics: chain.map((c) => ({ p0: { ...c.p0 }, c1: { ...c.c1 }, c2: { ...c.c2 }, p1: { ...c.p1 } })),
|
|
55
|
+
closed: contour.closed,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
47
59
|
}
|
|
48
60
|
/** First anchor of a subpath (the implicit `M` target). */
|
|
49
61
|
function startPoint(cubics) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAW,W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AI,EAAE,KAAK,EAAE,CAAC;IACvC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,IAAc,EAAE,EAAY,EAAE,CAAS;IACxD,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Path morphing — smooth interpolation between two arbitrary path shapes.\n *\n * Lerping two SVG paths command-by-command only works when they happen to share\n * the same command structure; in general one path is a triangle and the other a\n * star with a different number of points, different command types, a different\n * start point, and the opposite winding. Naively pairing commands produces\n * kinks, self-intersections, and points that fly across the canvas.\n *\n * This module reshapes both paths into a common, directly-interpolatable form —\n * the same approach GSAP's MorphSVGPlugin uses:\n *\n * 1. {@link cubics} converts each path into a list of {@link CubicSubpath}s.\n * Every drawing command (L/H/V/Q/A/Z-close) is rewritten as a cubic Bézier, so\n * a subpath becomes a uniform chain of cubics described purely by anchor and\n * control points.\n * 2. {@link plan} pairs the two paths' subpaths (padding the shorter side\n * with degenerate, collapsed subpaths so every subpath has a partner),\n * equalizes the number of cubics in each pair by subdividing the coarser\n * subpath along its perimeter, and — for closed rings — rotates and optionally\n * reverses one ring so the two start at the same place and wind the same way.\n * 3. {@link lerpPathData} samples that aligned correspondence at a given `t`,\n * interpolating every control point with {@link lerpVector2}.\n *\n * The result is a {@link PathCommand} list (one `M` + N `C`s per subpath) that the\n * existing renderer draws unchanged.\n */\nimport { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance, cubicPoint } from \"./bezier\";\nimport { commands, contourSegments, contours, segmentCubics } from \"./walk\";\nimport type { Cubic, CubicSubpath, MorphPlan } from \"./types\";\n\n/**\n * A path as cubic subpaths — one of the two boundaries where geometry is\n * deliberately flattened to a single curve type.\n *\n * A morph has to pair segments up and interpolate them, which needs both sides\n * speaking one language, so an arc becomes cubics here (and only here, and in\n * the anchor model). This used to carry the sixth copy of the pen walk; the one\n * thing it got wrong that the shared walk does not is `Z`, which it marked\n * without closing the run — so `M0 0 L10 0 Z L20 0` came back as one subpath\n * where SVG says two.\n */\nexport function cubics(d: PathData | null | undefined): CubicSubpath[] {\n return contours(d).map((contour) => ({\n cubics: contourSegments(contour).flatMap(segmentCubics),\n closed: contour.closed,\n }));\n}\n\n/** First anchor of a subpath (the implicit `M` target). */\nfunction startPoint(cubics: Cubic[]): Vector2 {\n return cubics[0].p0;\n}\n\n/** Approximate length of a cubic by flattening — cheap, used only for weighting. */\nfunction cubicLength(c: Cubic, steps = 8): number {\n let len = 0;\n let prev = c.p0;\n for (let i = 1; i <= steps; i++) {\n const p = cubicPoint(c.p0, c.c1, c.c2, c.p1, i / steps);\n len += distance(prev, p);\n prev = p;\n }\n return len;\n}\n\n/** Centroid of a subpath's anchor points — used to pair subpaths by proximity. */\nfunction centroid(cubics: Cubic[]): Vector2 {\n let x = 0, y = 0;\n for (const c of cubics) { x += c.p0.x; y += c.p0.y; }\n return { x: x / cubics.length, y: y / cubics.length };\n}\n\n// --- Subdivision: grow a subpath to a target number of cubics ---------------\n\n/** Split one cubic at parameter `t` into two cubics tracing the same curve (De Casteljau). */\nfunction splitCubic(c: Cubic, t: number): [Cubic, Cubic] {\n const a = lerpVector2(c.p0, c.c1, t);\n const b = lerpVector2(c.c1, c.c2, t);\n const d = lerpVector2(c.c2, c.p1, t);\n const e = lerpVector2(a, b, t);\n const f = lerpVector2(b, d, t);\n const g = lerpVector2(e, f, t);\n return [\n { p0: c.p0, c1: a, c2: e, p1: g },\n { p0: g, c1: f, c2: d, p1: c.p1 },\n ];\n}\n\n/**\n * Subdivide `cubics` until it has exactly `target` cubics (target ≥ current).\n * Splits are spread across the longest segments first so the added anchor points\n * land roughly evenly along the perimeter — the key to a smooth morph, since each\n * added point becomes a correspondence point with the other shape.\n */\nfunction subdivideTo(cubics: Cubic[], target: number): Cubic[] {\n let work = cubics.slice();\n while (work.length < target) {\n // Find the longest cubic and split it in half.\n let longest = 0;\n let maxLen = -1;\n for (let i = 0; i < work.length; i++) {\n const len = cubicLength(work[i]);\n if (len > maxLen) { maxLen = len; longest = i; }\n }\n const [left, right] = splitCubic(work[longest], 0.5);\n work.splice(longest, 1, left, right);\n }\n return work;\n}\n\n// --- Ring alignment: rotate + reverse a closed subpath ----------------------\n\n/** Reverse a chain of cubics so it traces the same shape in the opposite direction. */\nfunction reverseCubics(cubics: Cubic[]): Cubic[] {\n const out: Cubic[] = [];\n for (let i = cubics.length - 1; i >= 0; i--) {\n const c = cubics[i];\n out.push({ p0: c.p1, c1: c.c2, c2: c.c1, p1: c.p0 });\n }\n return out;\n}\n\n/** Rotate a closed ring so it begins at cubic index `offset` (wraps around). */\nfunction rotateCubics(cubics: Cubic[], offset: number): Cubic[] {\n if (offset === 0) return cubics.slice();\n return cubics.slice(offset).concat(cubics.slice(0, offset));\n}\n\n/** Sum of squared distances between paired anchor points — the alignment cost. */\nfunction anchorCost(a: Cubic[], b: Cubic[]): number {\n let cost = 0;\n for (let i = 0; i < a.length; i++) {\n const dx = a[i].p0.x - b[i].p0.x;\n const dy = a[i].p0.y - b[i].p0.y;\n cost += dx * dx + dy * dy;\n }\n return cost;\n}\n\n/**\n * Align a closed `to` ring against a fixed `from` ring (same cubic count). Tries\n * every rotation offset, in both winding directions, and keeps whichever pairs the\n * anchor points with the least total travel. This is what lets two shapes whose\n * points are listed in any order — or that wind in opposite directions — morph\n * without spinning or folding through themselves.\n */\nfunction alignClosedRing(from: Cubic[], to: Cubic[]): Cubic[] {\n const n = from.length;\n let best = to;\n let bestCost = Infinity;\n\n for (const candidate of [to, reverseCubics(to)]) {\n for (let offset = 0; offset < n; offset++) {\n const rotated = rotateCubics(candidate, offset);\n const cost = anchorCost(from, rotated);\n if (cost < bestCost) {\n bestCost = cost;\n best = rotated;\n }\n }\n }\n return best;\n}\n\n/**\n * For an open subpath, only the winding can be flipped (rotation would change the\n * shape). Pick the direction whose endpoints best match the `from` subpath.\n */\nfunction alignOpenSubpath(from: Cubic[], to: Cubic[]): Cubic[] {\n const reversed = reverseCubics(to);\n return anchorCost(from, to) <= anchorCost(from, reversed) ? to : reversed;\n}\n\n// --- Degenerate subpaths (for count mismatches) -----------------------------\n\n/**\n * A subpath collapsed onto a single point `at`, with `count` zero-length cubics.\n * Pairing a real subpath with one of these makes it grow out of / shrink into a\n * point, which is how added or removed subpaths animate.\n */\nfunction degenerateSubpath(at: Vector2, count: number): Cubic[] {\n const cubics: Cubic[] = [];\n for (let i = 0; i < count; i++) {\n cubics.push({ p0: { ...at }, c1: { ...at }, c2: { ...at }, p1: { ...at } });\n }\n return cubics;\n}\n\n// --- Subpath pairing --------------------------------------------------------\n\n/**\n * Greedily pair `from` subpaths with the nearest unused `to` subpath (by centroid),\n * so morphing maps each shape onto its closest counterpart rather than by list\n * order. Leftover subpaths on either side are paired with a degenerate partner\n * collapsed at their own centroid, so they grow/shrink in place.\n */\nfunction pairSubpaths(\n fromSubs: CubicSubpath[],\n toSubs: CubicSubpath[],\n): Array<{ from: CubicSubpath; to: CubicSubpath }> {\n const pairs: Array<{ from: CubicSubpath; to: CubicSubpath }> = [];\n const toUsed = new Array(toSubs.length).fill(false);\n\n for (const f of fromSubs) {\n const fc = centroid(f.cubics);\n let bestIdx = -1;\n let bestDist = Infinity;\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const d = distance(fc, centroid(toSubs[j].cubics));\n if (d < bestDist) { bestDist = d; bestIdx = j; }\n }\n if (bestIdx >= 0) {\n toUsed[bestIdx] = true;\n pairs.push({ from: f, to: toSubs[bestIdx] });\n } else {\n // No `to` subpath left → collapse to this subpath's own centroid.\n pairs.push({\n from: f,\n to: { cubics: degenerateSubpath(fc, f.cubics.length), closed: f.closed },\n });\n }\n }\n\n // Any unused `to` subpaths grow out of their own centroid.\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const t = toSubs[j];\n const tc = centroid(t.cubics);\n pairs.push({\n from: { cubics: degenerateSubpath(tc, t.cubics.length), closed: t.closed },\n to: t,\n });\n }\n\n return pairs;\n}\n\n// --- Building the morph plan ------------------------------------------------\n\n/**\n * Build a reusable {@link MorphPlan} aligning `from` to `to`. All the expensive\n * work — converting to cubics, pairing subpaths, equalizing counts, and rotating\n * rings — happens here once; {@link sample} then samples it cheaply per frame.\n */\nexport function plan(from: PathCommand[], to: PathCommand[]): MorphPlan {\n const fromSubs = cubics(from);\n const toSubs = cubics(to);\n\n // Both empty → nothing to morph.\n if (fromSubs.length === 0 && toSubs.length === 0) {\n return { pairs: [] };\n }\n\n // One side empty → collapse/grow the other against a point at its start.\n if (fromSubs.length === 0) {\n const seed = startPoint(toSubs[0].cubics);\n fromSubs.push({ cubics: degenerateSubpath(seed, 1), closed: toSubs[0].closed });\n }\n if (toSubs.length === 0) {\n const seed = startPoint(fromSubs[0].cubics);\n toSubs.push({ cubics: degenerateSubpath(seed, 1), closed: fromSubs[0].closed });\n }\n\n const subPairs = pairSubpaths(fromSubs, toSubs);\n\n const pairs = subPairs.map(({ from: f, to: t }) => {\n // Equalize cubic counts by subdividing the coarser side.\n const count = Math.max(f.cubics.length, t.cubics.length);\n const fromCubics = subdivideTo(f.cubics, count);\n let toCubics = subdivideTo(t.cubics, count);\n\n // Align the `to` side to the `from` side so points correspond and travel\n // the shortest path. Closed rings can rotate + reverse; open paths only\n // reverse (rotating an open path would tear it).\n const bothClosed = f.closed && t.closed;\n toCubics = bothClosed\n ? alignClosedRing(fromCubics, toCubics)\n : alignOpenSubpath(fromCubics, toCubics);\n\n return { from: fromCubics, to: toCubics, closed: bothClosed };\n });\n\n return { pairs };\n}\n\n// --- Sampling ---------------------------------------------------------------\n\n/** Interpolate a single cubic's four points. */\nfunction lerpCubic(from: Cubic, to: Cubic, t: number): Cubic {\n return {\n p0: lerpVector2(from.p0, to.p0, t),\n c1: lerpVector2(from.c1, to.c1, t),\n c2: lerpVector2(from.c2, to.c2, t),\n p1: lerpVector2(from.p1, to.p1, t),\n };\n}\n\n/**\n * Sample a {@link MorphPlan} at progress `t` (0 → `from`, 1 → `to`), producing a\n * fresh {@link PathCommand} list: one `M`, one `C` per cubic, and a trailing `Z`\n * for closed subpaths.\n *\n * Closed subpaths emit `Z` rather than a final line back to the start. The ring's\n * last cubic already lands on its first anchor, so `Z` adds no length; what it does\n * is tell the renderer the contour is closed, which is what makes the stroke join\n * cleanly at the seam instead of drawing two unjoined end caps there.\n */\nexport function sample(plan: MorphPlan, t: number): PathCommand[] {\n const out: PathCommand[] = [];\n for (const pair of plan.pairs) {\n const n = pair.from.length;\n if (n === 0) continue;\n const first = lerpCubic(pair.from[0], pair.to[0], t);\n out.push({ type: \"M\", x: first.p0.x, y: first.p0.y });\n out.push({ type: \"C\", x1: first.c1.x, y1: first.c1.y, x2: first.c2.x, y2: first.c2.y, x: first.p1.x, y: first.p1.y });\n for (let i = 1; i < n; i++) {\n const c = lerpCubic(pair.from[i], pair.to[i], t);\n out.push({ type: \"C\", x1: c.c1.x, y1: c.c1.y, x2: c.c2.x, y2: c.c2.y, x: c.p1.x, y: c.p1.y });\n }\n if (pair.closed) out.push({ type: \"Z\" });\n }\n return out;\n}\n\n// --- Public tween entry point ----------------------------------------------\n\n/**\n * The morph plan is built from a `(from, to)` pair, which is constant for the\n * duration of one tween while `t` sweeps 0→1. {@link lerp} is invoked once\n * per frame with that same pair, so we cache the most recent plan to avoid\n * rebuilding it (subdivision + ring alignment is the costly part) every frame.\n * A one-entry cache is enough: tweens run one at a time per property and call us\n * with monotonically advancing `t` against fixed endpoints.\n */\nlet cachedPlan: { from: PathData; to: PathData; plan: MorphPlan } | null = null;\n\nfunction planFor(from: PathData, to: PathData): MorphPlan {\n if (cachedPlan && cachedPlan.from === from && cachedPlan.to === to) {\n return cachedPlan.plan;\n }\n const built = plan(commands(from), commands(to));\n cachedPlan = { from, to, plan: built };\n return built;\n}\n\n/**\n * Smoothly interpolate between two path shapes — the {@link PathData} tween used\n * by `Path`'s animatable `d` property and usable directly as a `LerpFunction`.\n *\n * `from`/`to` may be SVG `d` strings or {@link PathCommand} arrays and need not\n * share structure, command count, subpath count, point order, or winding — the\n * shapes are reconciled into a common cubic correspondence first (see the module\n * overview). At `t = 0` and `t = 1` the endpoints are returned verbatim so the\n * start and end frames are pixel-exact; in between, a morphed command list is\n * produced.\n *\n * @param from Source path (the shape at `t = 0`).\n * @param to Target path (the shape at `t = 1`).\n * @param t Progress in `[0, 1]`.\n */\nexport function lerp(from: PathData, to: PathData, t: number): PathData {\n if (t <= 0) return from;\n if (t >= 1) return to;\n return sample(planFor(from, to), t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,CAA8B;IACjD,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,qEAAqE;QACrE,uEAAuE;QACvE,sEAAsE;QACtE,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,yEAAyE;QACzE,uEAAuE;QACvE,GAAG,CAAC,I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B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,IAAc,EAAE,EAAY,EAAE,CAAS;IACxD,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\r\n * Path morphing — smooth interpolation between two arbitrary path shapes.\r\n *\r\n * Lerping two SVG paths command-by-command only works when they happen to share\r\n * the same command structure; in general one path is a triangle and the other a\r\n * star with a different number of points, different command types, a different\r\n * start point, and the opposite winding. Naively pairing commands produces\r\n * kinks, self-intersections, and points that fly across the canvas.\r\n *\r\n * This module reshapes both paths into a common, directly-interpolatable form —\r\n * the same approach GSAP's MorphSVGPlugin uses:\r\n *\r\n * 1. {@link cubics} converts each path into a list of {@link CubicSubpath}s.\r\n * Every drawing command (L/H/V/Q/A/Z-close) is rewritten as a cubic Bézier, so\r\n * a subpath becomes a uniform chain of cubics described purely by anchor and\r\n * control points.\r\n * 2. {@link plan} pairs the two paths' subpaths (padding the shorter side\r\n * with degenerate, collapsed subpaths so every subpath has a partner),\r\n * equalizes the number of cubics in each pair by subdividing the coarser\r\n * subpath along its perimeter, and — for closed rings — rotates and optionally\r\n * reverses one ring so the two start at the same place and wind the same way.\r\n * 3. {@link lerpPathData} samples that aligned correspondence at a given `t`,\r\n * interpolating every control point with {@link lerpVector2}.\r\n *\r\n * The result is a {@link PathCommand} list (one `M` + N `C`s per subpath) that the\r\n * existing renderer draws unchanged.\r\n */\r\nimport { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { distance, cubicPoint } from \"./bezier\";\r\nimport { commands, contourSegments, contours, segmentCubics } from \"./walk\";\r\nimport type { Cubic, CubicSubpath, MorphPlan } from \"./types\";\r\n\r\n/**\r\n * A path as cubic subpaths — one of the two boundaries where geometry is\r\n * deliberately flattened to a single curve type.\r\n *\r\n * A morph has to pair segments up and interpolate them, which needs both sides\r\n * speaking one language, so an arc becomes cubics here (and only here, and in\r\n * the anchor model). This used to carry the sixth copy of the pen walk; the one\r\n * thing it got wrong that the shared walk does not is `Z`, which it marked\r\n * without closing the run — so `M0 0 L10 0 Z L20 0` came back as one subpath\r\n * where SVG says two.\r\n */\r\nexport function cubics(d: PathData | null | undefined): CubicSubpath[] {\r\n const out: CubicSubpath[] = [];\r\n for (const contour of contours(d)) {\r\n // A lone `M` has nothing to interpolate: it draws nothing and has no\r\n // first anchor to seed a partner from, so it is not a subpath here. It\r\n // stays in `contours`, where it still occupies a point of the bounds.\r\n const chain = contourSegments(contour).flatMap(segmentCubics);\r\n if (chain.length === 0) continue;\r\n // `contours` is memoized and shared, so hand out copies of its points: a\r\n // caller moving an anchor of the result must not move the cached path.\r\n out.push({\r\n cubics: chain.map((c) => ({ p0: { ...c.p0 }, c1: { ...c.c1 }, c2: { ...c.c2 }, p1: { ...c.p1 } })),\r\n closed: contour.closed,\r\n });\r\n }\r\n return out;\r\n}\r\n\r\n/** First anchor of a subpath (the implicit `M` target). */\r\nfunction startPoint(cubics: Cubic[]): Vector2 {\r\n return cubics[0].p0;\r\n}\r\n\r\n/** Approximate length of a cubic by flattening — cheap, used only for weighting. */\r\nfunction cubicLength(c: Cubic, steps = 8): number {\r\n let len = 0;\r\n let prev = c.p0;\r\n for (let i = 1; i <= steps; i++) {\r\n const p = cubicPoint(c.p0, c.c1, c.c2, c.p1, i / steps);\r\n len += distance(prev, p);\r\n prev = p;\r\n }\r\n return len;\r\n}\r\n\r\n/** Centroid of a subpath's anchor points — used to pair subpaths by proximity. */\r\nfunction centroid(cubics: Cubic[]): Vector2 {\r\n let x = 0, y = 0;\r\n for (const c of cubics) { x += c.p0.x; y += c.p0.y; }\r\n return { x: x / cubics.length, y: y / cubics.length };\r\n}\r\n\r\n// --- Subdivision: grow a subpath to a target number of cubics ---------------\r\n\r\n/** Split one cubic at parameter `t` into two cubics tracing the same curve (De Casteljau). */\r\nfunction splitCubic(c: Cubic, t: number): [Cubic, Cubic] {\r\n const a = lerpVector2(c.p0, c.c1, t);\r\n const b = lerpVector2(c.c1, c.c2, t);\r\n const d = lerpVector2(c.c2, c.p1, t);\r\n const e = lerpVector2(a, b, t);\r\n const f = lerpVector2(b, d, t);\r\n const g = lerpVector2(e, f, t);\r\n return [\r\n { p0: c.p0, c1: a, c2: e, p1: g },\r\n { p0: g, c1: f, c2: d, p1: c.p1 },\r\n ];\r\n}\r\n\r\n/**\r\n * Subdivide `cubics` until it has exactly `target` cubics (target ≥ current).\r\n * Splits are spread across the longest segments first so the added anchor points\r\n * land roughly evenly along the perimeter — the key to a smooth morph, since each\r\n * added point becomes a correspondence point with the other shape.\r\n */\r\nfunction subdivideTo(cubics: Cubic[], target: number): Cubic[] {\r\n let work = cubics.slice();\r\n while (work.length < target) {\r\n // Find the longest cubic and split it in half.\r\n let longest = 0;\r\n let maxLen = -1;\r\n for (let i = 0; i < work.length; i++) {\r\n const len = cubicLength(work[i]);\r\n if (len > maxLen) { maxLen = len; longest = i; }\r\n }\r\n const [left, right] = splitCubic(work[longest], 0.5);\r\n work.splice(longest, 1, left, right);\r\n }\r\n return work;\r\n}\r\n\r\n// --- Ring alignment: rotate + reverse a closed subpath ----------------------\r\n\r\n/** Reverse a chain of cubics so it traces the same shape in the opposite direction. */\r\nfunction reverseCubics(cubics: Cubic[]): Cubic[] {\r\n const out: Cubic[] = [];\r\n for (let i = cubics.length - 1; i >= 0; i--) {\r\n const c = cubics[i];\r\n out.push({ p0: c.p1, c1: c.c2, c2: c.c1, p1: c.p0 });\r\n }\r\n return out;\r\n}\r\n\r\n/** Rotate a closed ring so it begins at cubic index `offset` (wraps around). */\r\nfunction rotateCubics(cubics: Cubic[], offset: number): Cubic[] {\r\n if (offset === 0) return cubics.slice();\r\n return cubics.slice(offset).concat(cubics.slice(0, offset));\r\n}\r\n\r\n/** Sum of squared distances between paired anchor points — the alignment cost. */\r\nfunction anchorCost(a: Cubic[], b: Cubic[]): number {\r\n let cost = 0;\r\n for (let i = 0; i < a.length; i++) {\r\n const dx = a[i].p0.x - b[i].p0.x;\r\n const dy = a[i].p0.y - b[i].p0.y;\r\n cost += dx * dx + dy * dy;\r\n }\r\n return cost;\r\n}\r\n\r\n/**\r\n * Align a closed `to` ring against a fixed `from` ring (same cubic count). Tries\r\n * every rotation offset, in both winding directions, and keeps whichever pairs the\r\n * anchor points with the least total travel. This is what lets two shapes whose\r\n * points are listed in any order — or that wind in opposite directions — morph\r\n * without spinning or folding through themselves.\r\n */\r\nfunction alignClosedRing(from: Cubic[], to: Cubic[]): Cubic[] {\r\n const n = from.length;\r\n let best = to;\r\n let bestCost = Infinity;\r\n\r\n for (const candidate of [to, reverseCubics(to)]) {\r\n for (let offset = 0; offset < n; offset++) {\r\n const rotated = rotateCubics(candidate, offset);\r\n const cost = anchorCost(from, rotated);\r\n if (cost < bestCost) {\r\n bestCost = cost;\r\n best = rotated;\r\n }\r\n }\r\n }\r\n return best;\r\n}\r\n\r\n/**\r\n * For an open subpath, only the winding can be flipped (rotation would change the\r\n * shape). Pick the direction whose endpoints best match the `from` subpath.\r\n */\r\nfunction alignOpenSubpath(from: Cubic[], to: Cubic[]): Cubic[] {\r\n const reversed = reverseCubics(to);\r\n return anchorCost(from, to) <= anchorCost(from, reversed) ? to : reversed;\r\n}\r\n\r\n// --- Degenerate subpaths (for count mismatches) -----------------------------\r\n\r\n/**\r\n * A subpath collapsed onto a single point `at`, with `count` zero-length cubics.\r\n * Pairing a real subpath with one of these makes it grow out of / shrink into a\r\n * point, which is how added or removed subpaths animate.\r\n */\r\nfunction degenerateSubpath(at: Vector2, count: number): Cubic[] {\r\n const cubics: Cubic[] = [];\r\n for (let i = 0; i < count; i++) {\r\n cubics.push({ p0: { ...at }, c1: { ...at }, c2: { ...at }, p1: { ...at } });\r\n }\r\n return cubics;\r\n}\r\n\r\n// --- Subpath pairing --------------------------------------------------------\r\n\r\n/**\r\n * Greedily pair `from` subpaths with the nearest unused `to` subpath (by centroid),\r\n * so morphing maps each shape onto its closest counterpart rather than by list\r\n * order. Leftover subpaths on either side are paired with a degenerate partner\r\n * collapsed at their own centroid, so they grow/shrink in place.\r\n */\r\nfunction pairSubpaths(\r\n fromSubs: CubicSubpath[],\r\n toSubs: CubicSubpath[],\r\n): Array<{ from: CubicSubpath; to: CubicSubpath }> {\r\n const pairs: Array<{ from: CubicSubpath; to: CubicSubpath }> = [];\r\n const toUsed = new Array(toSubs.length).fill(false);\r\n\r\n for (const f of fromSubs) {\r\n const fc = centroid(f.cubics);\r\n let bestIdx = -1;\r\n let bestDist = Infinity;\r\n for (let j = 0; j < toSubs.length; j++) {\r\n if (toUsed[j]) continue;\r\n const d = distance(fc, centroid(toSubs[j].cubics));\r\n if (d < bestDist) { bestDist = d; bestIdx = j; }\r\n }\r\n if (bestIdx >= 0) {\r\n toUsed[bestIdx] = true;\r\n pairs.push({ from: f, to: toSubs[bestIdx] });\r\n } else {\r\n // No `to` subpath left → collapse to this subpath's own centroid.\r\n pairs.push({\r\n from: f,\r\n to: { cubics: degenerateSubpath(fc, f.cubics.length), closed: f.closed },\r\n });\r\n }\r\n }\r\n\r\n // Any unused `to` subpaths grow out of their own centroid.\r\n for (let j = 0; j < toSubs.length; j++) {\r\n if (toUsed[j]) continue;\r\n const t = toSubs[j];\r\n const tc = centroid(t.cubics);\r\n pairs.push({\r\n from: { cubics: degenerateSubpath(tc, t.cubics.length), closed: t.closed },\r\n to: t,\r\n });\r\n }\r\n\r\n return pairs;\r\n}\r\n\r\n// --- Building the morph plan ------------------------------------------------\r\n\r\n/**\r\n * Build a reusable {@link MorphPlan} aligning `from` to `to`. All the expensive\r\n * work — converting to cubics, pairing subpaths, equalizing counts, and rotating\r\n * rings — happens here once; {@link sample} then samples it cheaply per frame.\r\n */\r\nexport function plan(from: PathCommand[], to: PathCommand[]): MorphPlan {\r\n const fromSubs = cubics(from);\r\n const toSubs = cubics(to);\r\n\r\n // Both empty → nothing to morph.\r\n if (fromSubs.length === 0 && toSubs.length === 0) {\r\n return { pairs: [] };\r\n }\r\n\r\n // One side empty → collapse/grow the other against a point at its start.\r\n if (fromSubs.length === 0) {\r\n const seed = startPoint(toSubs[0].cubics);\r\n fromSubs.push({ cubics: degenerateSubpath(seed, 1), closed: toSubs[0].closed });\r\n }\r\n if (toSubs.length === 0) {\r\n const seed = startPoint(fromSubs[0].cubics);\r\n toSubs.push({ cubics: degenerateSubpath(seed, 1), closed: fromSubs[0].closed });\r\n }\r\n\r\n const subPairs = pairSubpaths(fromSubs, toSubs);\r\n\r\n const pairs = subPairs.map(({ from: f, to: t }) => {\r\n // Equalize cubic counts by subdividing the coarser side.\r\n const count = Math.max(f.cubics.length, t.cubics.length);\r\n const fromCubics = subdivideTo(f.cubics, count);\r\n let toCubics = subdivideTo(t.cubics, count);\r\n\r\n // Align the `to` side to the `from` side so points correspond and travel\r\n // the shortest path. Closed rings can rotate + reverse; open paths only\r\n // reverse (rotating an open path would tear it).\r\n const bothClosed = f.closed && t.closed;\r\n toCubics = bothClosed\r\n ? alignClosedRing(fromCubics, toCubics)\r\n : alignOpenSubpath(fromCubics, toCubics);\r\n\r\n return { from: fromCubics, to: toCubics, closed: bothClosed };\r\n });\r\n\r\n return { pairs };\r\n}\r\n\r\n// --- Sampling ---------------------------------------------------------------\r\n\r\n/** Interpolate a single cubic's four points. */\r\nfunction lerpCubic(from: Cubic, to: Cubic, t: number): Cubic {\r\n return {\r\n p0: lerpVector2(from.p0, to.p0, t),\r\n c1: lerpVector2(from.c1, to.c1, t),\r\n c2: lerpVector2(from.c2, to.c2, t),\r\n p1: lerpVector2(from.p1, to.p1, t),\r\n };\r\n}\r\n\r\n/**\r\n * Sample a {@link MorphPlan} at progress `t` (0 → `from`, 1 → `to`), producing a\r\n * fresh {@link PathCommand} list: one `M`, one `C` per cubic, and a trailing `Z`\r\n * for closed subpaths.\r\n *\r\n * Closed subpaths emit `Z` rather than a final line back to the start. The ring's\r\n * last cubic already lands on its first anchor, so `Z` adds no length; what it does\r\n * is tell the renderer the contour is closed, which is what makes the stroke join\r\n * cleanly at the seam instead of drawing two unjoined end caps there.\r\n */\r\nexport function sample(plan: MorphPlan, t: number): PathCommand[] {\r\n const out: PathCommand[] = [];\r\n for (const pair of plan.pairs) {\r\n const n = pair.from.length;\r\n if (n === 0) continue;\r\n const first = lerpCubic(pair.from[0], pair.to[0], t);\r\n out.push({ type: \"M\", x: first.p0.x, y: first.p0.y });\r\n out.push({ type: \"C\", x1: first.c1.x, y1: first.c1.y, x2: first.c2.x, y2: first.c2.y, x: first.p1.x, y: first.p1.y });\r\n for (let i = 1; i < n; i++) {\r\n const c = lerpCubic(pair.from[i], pair.to[i], t);\r\n out.push({ type: \"C\", x1: c.c1.x, y1: c.c1.y, x2: c.c2.x, y2: c.c2.y, x: c.p1.x, y: c.p1.y });\r\n }\r\n if (pair.closed) out.push({ type: \"Z\" });\r\n }\r\n return out;\r\n}\r\n\r\n// --- Public tween entry point ----------------------------------------------\r\n\r\n/**\r\n * The morph plan is built from a `(from, to)` pair, which is constant for the\r\n * duration of one tween while `t` sweeps 0→1. {@link lerp} is invoked once\r\n * per frame with that same pair, so we cache the most recent plan to avoid\r\n * rebuilding it (subdivision + ring alignment is the costly part) every frame.\r\n * A one-entry cache is enough: tweens run one at a time per property and call us\r\n * with monotonically advancing `t` against fixed endpoints.\r\n */\r\nlet cachedPlan: { from: PathData; to: PathData; plan: MorphPlan } | null = null;\r\n\r\nfunction planFor(from: PathData, to: PathData): MorphPlan {\r\n if (cachedPlan && cachedPlan.from === from && cachedPlan.to === to) {\r\n return cachedPlan.plan;\r\n }\r\n const built = plan(commands(from), commands(to));\r\n cachedPlan = { from, to, plan: built };\r\n return built;\r\n}\r\n\r\n/**\r\n * Smoothly interpolate between two path shapes — the {@link PathData} tween used\r\n * by `Path`'s animatable `d` property and usable directly as a `LerpFunction`.\r\n *\r\n * `from`/`to` may be SVG `d` strings or {@link PathCommand} arrays and need not\r\n * share structure, command count, subpath count, point order, or winding — the\r\n * shapes are reconciled into a common cubic correspondence first (see the module\r\n * overview). At `t = 0` and `t = 1` the endpoints are returned verbatim so the\r\n * start and end frames are pixel-exact; in between, a morphed command list is\r\n * produced.\r\n *\r\n * @param from Source path (the shape at `t = 0`).\r\n * @param to Target path (the shape at `t = 1`).\r\n * @param t Progress in `[0, 1]`.\r\n */\r\nexport function lerp(from: PathData, to: PathData, t: number): PathData {\r\n if (t <= 0) return from;\r\n if (t >= 1) return to;\r\n return sample(planFor(from, to), t);\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/ops.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EACpE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GACrD,MAAM,WAAW,CAAC;AAoEnB,MAAM,CAAC,MAAM,OAAO,GAA+C;IAC/D,6DAA6D;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI;IAEJ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IAEP,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IAEP,IAAI;IACJ,IAAI;IACJ,SAAS;IAET,IAAI;IACJ,MAAM;IAEN,WAAW;IACX,cAAc;IACd,YAAY;IACZ,GAAG;IACH,SAAS;IACT,MAAM;IACN,OAAO;IAEP,SAAS;IACT,QAAQ;IACR,OAAO;IACP,KAAK;CACR,CAAC","sourcesContent":["/**\n * Every path-geometry operation, on one object.\n *\n * `pathOps` was already the path attribute's `resolve`/`lerp` pair; it now\n * carries the rest, which is the repo's existing shape for an attribute whose\n * operations go past interpolation — `insetsOps` is `AttributeOps & InsetsOps`,\n * `alignmentOps` is `AttributeOps & AlignmentOps`, `cornerRadiusOps` the same.\n * `@pathProperty()` and every node declared through it are untouched by the\n * addition.\n *\n * Behind it is **one** pen walk. There were seven — one each in `bounds`,\n * `length`, `dash`, `sampler`, `subpath`, `morph` and the editor's vector model\n * — and they disagreed about where `Z` leaves the cursor, which control point an\n * `S`/`T` reflects, and what an arc is. The pipeline is now:\n *\n * PathData ── commands ──▶ PathCommand[] ── contours ──▶ PathContour[]\n * │\n * bounds · size · length · sampler · dash · trim ◀─────┤\n * cubics ── morph ◀──────────┤\n * anchors ── editing ◀────────┘\n *\n * `cubics` and `anchors` are the only two places geometry is flattened to a\n * single curve type, because a morph needs one segment kind to pair up and\n * nobody can drag an arc's handles. Everything that measures keeps the arc.\n *\n * Each method is the module function of the same name, so a call site and its\n * implementation are one grep apart.\n */\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\n\nimport { bounds, commands, contours, size } from \"./walk\";\nimport { dash, dashScale, length, sampler, trim } from \"./measure\";\nimport { cubics, lerp, plan, sample } from \"./morph\";\nimport {\n anchorBounds, anchorCommands, anchors, endFit, fitToBox, fromAnchors,\n isEmpty, map, normalize, pointOn, split, translate,\n} from \"./anchors\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { Extents } from \"@/layout/bounds\";\nimport { PathContour, CubicSubpath, VectorPath, PathSampler, MorphPlan, PathNormalization, PathAnchor } from \"./types\";\n\n\n/** The path attribute's operations beyond `resolve`/`lerp`. */\nexport interface PathOps {\n // ── Reading ────────────────────────────────────────────────────────────\n /** Parse. A `PathCommand[]` passes through by reference; nullish gives `[]`. */\n commands(d: PathData | null | undefined): PathCommand[];\n /** The normal form: absolute, shorthands expanded, grouped into contours. */\n contours(d: PathData | null | undefined): PathContour[];\n /** All-cubic form. Lossy for arcs — one of the two flattening boundaries. */\n cubics(d: PathData | null | undefined): CubicSubpath[];\n /** The editable anchor model. Lossy for arcs — the other boundary. */\n anchors(d: PathData | null | undefined): VectorPath;\n\n // ── Measuring ──────────────────────────────────────────────────────────\n /** Tight box: each segment's own extrema, not its control hull. */\n bounds(d: PathData | null | undefined): Extents | null;\n /** {@link bounds} as a size; `0 x 0` for an empty path. */\n size(d: PathData | null | undefined): { width: number; height: number };\n /** Total arc length. An arc is measured along the arc, not across its chord. */\n length(d: PathData | null | undefined): number;\n /** Point and unit tangent at a distance along the path. */\n sampler(d: PathData): PathSampler;\n\n // ── Rewriting ──────────────────────────────────────────────────────────\n /** The portion between two arc-length fractions. Works on strings. */\n trim(d: PathData, start: number, end: number): PathData;\n /** Only the \"on\" runs of a dash pattern, fit as the renderer fits it, as a `d` string. */\n dash(d: PathData | null | undefined, pattern: number[], offset?: number): string;\n /** How far a pattern is stretched to fit one contour of a path — see `dash`. */\n dashScale(pattern: number[], contour: { length: number; closed: boolean }, total: number): number | null;\n\n // ── Morphing ───────────────────────────────────────────────────────────\n /** A reusable correspondence between two paths. Expensive; `lerp` caches one. */\n plan(from: PathCommand[], to: PathCommand[]): MorphPlan;\n /** Sample a plan at `t`. Cheap. */\n sample(plan: MorphPlan, t: number): PathCommand[];\n\n // ── The anchor model ───────────────────────────────────────────────────\n /** Anchors back to a `d` string. Emits only `M`/`L`/`C`/`Z`. */\n fromAnchors(path: VectorPath): string;\n /** Anchors to commands, with a transform folded into the same pass. */\n anchorCommands(path: VectorPath, transform?: (p: Vector2) => Vector2): PathCommand[];\n /** Tight box of an anchor path. */\n anchorBounds(path: VectorPath): Extents | null;\n /** Every point and handle mapped. */\n map(path: VectorPath, fn: (p: Vector2) => Vector2): VectorPath;\n translate(path: VectorPath, delta: Vector2): VectorPath;\n /** The turn-and-scale about `start` carrying `end` onto `to` — a `map` fn. */\n endFit(start: Vector2, end: Vector2, to: Vector2): (p: Vector2) => Vector2;\n isEmpty(path: VectorPath): boolean;\n\n // ── The unit box ───────────────────────────────────────────────────────\n /** Re-quote against the geometry's own bounds. */\n normalize(path: VectorPath): PathNormalization;\n /** Re-quote against a stated box — the general form of {@link PathOps.normalize}. */\n fitToBox(path: VectorPath, box: Extents): PathNormalization;\n /** A point on the segment between two anchors, for hit-testing an insert. */\n pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2;\n /** De Casteljau split, so inserting an anchor does not move the curve. */\n split(from: PathAnchor, to: PathAnchor, t: number): { from: PathAnchor; middle: PathAnchor; to: PathAnchor };\n}\n\n\nexport const pathOps: AttributeOps<PathData, PathData> & PathOps = {\n // An SVG path string or command list needs no normalization.\n resolve: (value) => value,\n lerp,\n\n commands,\n contours,\n cubics,\n anchors,\n\n bounds,\n size,\n length,\n sampler,\n\n trim,\n dash,\n dashScale,\n\n plan,\n sample,\n\n fromAnchors,\n anchorCommands,\n anchorBounds,\n map,\n translate,\n endFit,\n isEmpty,\n\n normalize,\n fitToBox,\n pointOn,\n split,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/ops.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EACpE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GACrD,MAAM,WAAW,CAAC;AAoEnB,MAAM,CAAC,MAAM,OAAO,GAA+C;IAC/D,6DAA6D;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI;IAEJ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IAEP,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IAEP,IAAI;IACJ,IAAI;IACJ,SAAS;IAET,IAAI;IACJ,MAAM;IAEN,WAAW;IACX,cAAc;IACd,YAAY;IACZ,GAAG;IACH,SAAS;IACT,MAAM;IACN,OAAO;IAEP,SAAS;IACT,QAAQ;IACR,OAAO;IACP,KAAK;CACR,CAAC","sourcesContent":["/**\r\n * Every path-geometry operation, on one object.\r\n *\r\n * `pathOps` was already the path attribute's `resolve`/`lerp` pair; it now\r\n * carries the rest, which is the repo's existing shape for an attribute whose\r\n * operations go past interpolation — `insetsOps` is `AttributeOps & InsetsOps`,\r\n * `alignmentOps` is `AttributeOps & AlignmentOps`, `cornerRadiusOps` the same.\r\n * `@pathProperty()` and every node declared through it are untouched by the\r\n * addition.\r\n *\r\n * Behind it is **one** pen walk. There were seven — one each in `bounds`,\r\n * `length`, `dash`, `sampler`, `subpath`, `morph` and the editor's vector model\r\n * — and they disagreed about where `Z` leaves the cursor, which control point an\r\n * `S`/`T` reflects, and what an arc is. The pipeline is now:\r\n *\r\n * PathData ── commands ──▶ PathCommand[] ── contours ──▶ PathContour[]\r\n * │\r\n * bounds · size · length · sampler · dash · trim ◀─────┤\r\n * cubics ── morph ◀──────────┤\r\n * anchors ── editing ◀────────┘\r\n *\r\n * `cubics` and `anchors` are the only two places geometry is flattened to a\r\n * single curve type, because a morph needs one segment kind to pair up and\r\n * nobody can drag an arc's handles. Everything that measures keeps the arc.\r\n *\r\n * Each method is the module function of the same name, so a call site and its\r\n * implementation are one grep apart.\r\n */\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\nimport { bounds, commands, contours, size } from \"./walk\";\r\nimport { dash, dashScale, length, sampler, trim } from \"./measure\";\r\nimport { cubics, lerp, plan, sample } from \"./morph\";\r\nimport {\r\n anchorBounds, anchorCommands, anchors, endFit, fitToBox, fromAnchors,\r\n isEmpty, map, normalize, pointOn, split, translate,\r\n} from \"./anchors\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { Extents } from \"@/layout/bounds\";\r\nimport { PathContour, CubicSubpath, VectorPath, PathSampler, MorphPlan, PathNormalization, PathAnchor } from \"./types\";\r\n\r\n\r\n/** The path attribute's operations beyond `resolve`/`lerp`. */\r\nexport interface PathOps {\r\n // ── Reading ────────────────────────────────────────────────────────────\r\n /** Parse. A `PathCommand[]` passes through by reference; nullish gives `[]`. */\r\n commands(d: PathData | null | undefined): PathCommand[];\r\n /** The normal form: absolute, shorthands expanded, grouped into contours. */\r\n contours(d: PathData | null | undefined): PathContour[];\r\n /** All-cubic form. Lossy for arcs — one of the two flattening boundaries. */\r\n cubics(d: PathData | null | undefined): CubicSubpath[];\r\n /** The editable anchor model. Lossy for arcs — the other boundary. */\r\n anchors(d: PathData | null | undefined): VectorPath;\r\n\r\n // ── Measuring ──────────────────────────────────────────────────────────\r\n /** Tight box: each segment's own extrema, not its control hull. */\r\n bounds(d: PathData | null | undefined): Extents | null;\r\n /** {@link bounds} as a size; `0 x 0` for an empty path. */\r\n size(d: PathData | null | undefined): { width: number; height: number };\r\n /** Total arc length. An arc is measured along the arc, not across its chord. */\r\n length(d: PathData | null | undefined): number;\r\n /** Point and unit tangent at a distance along the path. */\r\n sampler(d: PathData): PathSampler;\r\n\r\n // ── Rewriting ──────────────────────────────────────────────────────────\r\n /** The portion between two arc-length fractions. Works on strings. */\r\n trim(d: PathData, start: number, end: number): PathData;\r\n /** Only the \"on\" runs of a dash pattern, fit as the renderer fits it, as a `d` string. */\r\n dash(d: PathData | null | undefined, pattern: number[], offset?: number): string;\r\n /** How far a pattern is stretched to fit one contour of a path — see `dash`. */\r\n dashScale(pattern: number[], contour: { length: number; closed: boolean }, total: number): number | null;\r\n\r\n // ── Morphing ───────────────────────────────────────────────────────────\r\n /** A reusable correspondence between two paths. Expensive; `lerp` caches one. */\r\n plan(from: PathCommand[], to: PathCommand[]): MorphPlan;\r\n /** Sample a plan at `t`. Cheap. */\r\n sample(plan: MorphPlan, t: number): PathCommand[];\r\n\r\n // ── The anchor model ───────────────────────────────────────────────────\r\n /** Anchors back to a `d` string. Emits only `M`/`L`/`C`/`Z`. */\r\n fromAnchors(path: VectorPath): string;\r\n /** Anchors to commands, with a transform folded into the same pass. */\r\n anchorCommands(path: VectorPath, transform?: (p: Vector2) => Vector2): PathCommand[];\r\n /** Tight box of an anchor path. */\r\n anchorBounds(path: VectorPath): Extents | null;\r\n /** Every point and handle mapped. */\r\n map(path: VectorPath, fn: (p: Vector2) => Vector2): VectorPath;\r\n translate(path: VectorPath, delta: Vector2): VectorPath;\r\n /** The turn-and-scale about `start` carrying `end` onto `to` — a `map` fn. */\r\n endFit(start: Vector2, end: Vector2, to: Vector2): (p: Vector2) => Vector2;\r\n isEmpty(path: VectorPath): boolean;\r\n\r\n // ── The unit box ───────────────────────────────────────────────────────\r\n /** Re-quote against the geometry's own bounds. */\r\n normalize(path: VectorPath): PathNormalization;\r\n /** Re-quote against a stated box — the general form of {@link PathOps.normalize}. */\r\n fitToBox(path: VectorPath, box: Extents): PathNormalization;\r\n /** A point on the segment between two anchors, for hit-testing an insert. */\r\n pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2;\r\n /** De Casteljau split, so inserting an anchor does not move the curve. */\r\n split(from: PathAnchor, to: PathAnchor, t: number): { from: PathAnchor; middle: PathAnchor; to: PathAnchor };\r\n}\r\n\r\n\r\nexport const pathOps: AttributeOps<PathData, PathData> & PathOps = {\r\n // An SVG path string or command list needs no normalization.\r\n resolve: (value) => value,\r\n lerp,\r\n\r\n commands,\r\n contours,\r\n cubics,\r\n anchors,\r\n\r\n bounds,\r\n size,\r\n length,\r\n sampler,\r\n\r\n trim,\r\n dash,\r\n dashScale,\r\n\r\n plan,\r\n sample,\r\n\r\n fromAnchors,\r\n anchorCommands,\r\n anchorBounds,\r\n map,\r\n translate,\r\n endFit,\r\n isEmpty,\r\n\r\n normalize,\r\n fitToBox,\r\n pointOn,\r\n split,\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/types.ts"],"names":[],"mappings":";AA0MA,8EAA8E","sourcesContent":["/**\n * Every type the path module names, in one place.\n *\n * The vocabulary is small and it is worth seeing all of it at once, because the\n * whole module is four representations and the conversions between them:\n *\n * PathData ─▶ PathCommand[] ─▶ PathContour[] ─┬─▶ CubicSubpath[] (morph)\n * a string as written the normal └─▶ VectorPath (editing)\n * or commands form\n */\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\n\n// ── Geometry ───────────────────────────────────────────────────────────────\n\n// `Extents` — the `{ minX, minY, maxX, maxY }` box — is `@/layout/bounds`'s,\n// not a second copy. A path's bounding box and a node's are the same idea, and\n// the two were already the same four fields under two names.\n\n/**\n * A single cubic Bézier: start anchor `p0`, controls `c1`/`c2`, end anchor `p1`.\n * The end anchor of one cubic is the start of the next within a subpath.\n */\nexport interface Cubic {\n p0: Vector2;\n c1: Vector2;\n c2: Vector2;\n p1: Vector2;\n}\n\n/** An SVG `A` command re-expressed as the ellipse arc it names. */\nexport interface ArcParams {\n cx: number;\n cy: number;\n /** Radii after the spec's \"scale up until the endpoints are reachable\" correction. */\n rx: number;\n ry: number;\n /** x-axis rotation, in **radians** (the command carries degrees). */\n phi: number;\n /** Start angle, and the signed sweep from it — `sweep`/`largeArc` already folded in. */\n theta1: number;\n dtheta: number;\n}\n\n// ── The normal form ────────────────────────────────────────────────────────\n\n/**\n * One piece of a contour, keeping its own kind.\n *\n * Normalizing everything to cubics would be simpler by one dimension and wrong\n * in a way that shows on screen: an arc is not a cubic, so `length`, `sampler`,\n * `dash` and `trim` would all inherit an approximation only *morph* and the\n * anchor model actually need.\n *\n * Plain data, not a bundle of closures: `contours` runs inside `measure()` on\n * every layout pass, and arc-length parameterization is the expensive part of\n * path geometry. Nothing here samples a curve — `Extents` come from\n * closed-form extrema, and arc length is a separate, lazy table.\n */\nexport type PathSegment =\n | { kind: \"line\"; from: Vector2; to: Vector2 }\n | { kind: \"quad\"; from: Vector2; c: Vector2; to: Vector2 }\n | { kind: \"cubic\"; from: Vector2; c1: Vector2; c2: Vector2; to: Vector2 }\n | {\n kind: \"arc\"; from: Vector2; to: Vector2;\n rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1;\n };\n\n/**\n * One connected run — everything between an `M` and the next one.\n *\n * `start` is carried separately because a contour can legitimately have no\n * segments: a lone `M` is a real thing to write, it occupies a point that bounds\n * must account for, and the anchor model round-trips it as a single anchor.\n *\n * The closing edge of a `closed` contour is **not** in `segments` — `closed`\n * carries it. Storing it would mean a zero-length segment whenever the geometry\n * already ends where it started, which is most of the time.\n */\nexport interface PathContour {\n start: Vector2;\n segments: PathSegment[];\n /** Whether the run ended with a `Z`. */\n closed: boolean;\n}\n\n// ── Arc-length measurement ─────────────────────────────────────────────────\n\nexport interface SegmentMetric {\n segment: PathSegment;\n /** The flattened polyline, `from` first and `to` last. */\n points: Vector2[];\n /** Length along the polyline at each point; the last entry is `length`. */\n cumulative: number[];\n length: number;\n}\n\nexport interface ContourMetric {\n contour: PathContour;\n /** Every segment, the closed contour's implied join included. */\n metrics: SegmentMetric[];\n length: number;\n}\n\nexport interface PathMetric {\n contours: ContourMetric[];\n length: number;\n}\n\n/** A point on the path with the unit tangent direction there. */\nexport interface PathFrame {\n x: number;\n y: number;\n /** Unit tangent (direction of travel along the path). */\n tx: number;\n ty: number;\n}\n\nexport interface PathSampler {\n /** Total arc length across all contours. */\n readonly length: number;\n /**\n * Point and unit tangent at arc-length distance `d` from the path start.\n * `d` is clamped to `[0, length]`. Returns `null` only for a degenerate\n * (zero-length) path. Keeps an internal cursor so repeated calls with\n * non-decreasing `d` are amortized O(1).\n */\n frameAt(d: number): PathFrame | null;\n}\n\n// ── Morphing ───────────────────────────────────────────────────────────────\n\n/** A connected run of cubics (one `M` followed by curves), optionally closed. */\nexport interface CubicSubpath {\n cubics: Cubic[];\n /** True for subpaths that ended with a `Z` — eligible for rotation/reversal. */\n closed: boolean;\n}\n\n/** A correspondence between two paths, pre-aligned so it can be sampled at any `t`. */\nexport interface MorphPlan {\n /** Subpath pairs; each pair has the same number of cubics on both sides. */\n pairs: Array<{\n from: Cubic[];\n to: Cubic[];\n /**\n * Whether the sampled subpath should be closed with a `Z`. A pair is\n * closed when both sides were closed rings — a closed shape morphing to\n * another closed shape stays closed, so the stroke forms a proper join\n * at the seam instead of leaving two unconnected free ends.\n */\n closed: boolean;\n }>;\n}\n\n// ── The editable anchor model ──────────────────────────────────────────────\n\n/**\n * One anchor on a subpath, with the two control points that shape the segments\n * meeting at it.\n *\n * Handles are **absolute** points in the same space as {@link PathAnchor.point},\n * not offsets from it. That is what an SVG cubic stores, so serializing is a\n * copy rather than an addition, and it is the space a canvas editor drags them\n * in — an offset model would convert twice per pointer event for no gain.\n *\n * `null` means \"no handle on this side\", which draws as a straight segment. A\n * corner point has both null; a smooth point has both, mirrored through the\n * anchor; an asymmetric point has both, pointing opposite ways at different\n * lengths. The model does not record which of the three a point *is* — that is\n * derived from the handles, so a file cannot claim to be smooth while holding\n * handles that aren't.\n */\nexport interface PathAnchor {\n point: Vector2;\n /** Control point for the segment **arriving** at this anchor. */\n inHandle: Vector2 | null;\n /** Control point for the segment **leaving** it. */\n outHandle: Vector2 | null;\n}\n\n/** A single contiguous run of anchors — one `M …` in the `d` string. */\nexport interface PathSubpath {\n anchors: PathAnchor[];\n /** Whether the last anchor joins back to the first (`Z`). */\n closed: boolean;\n}\n\n/** A whole path: zero or more subpaths. */\nexport type VectorPath = PathSubpath[];\n\n/** Scale and offset applied on each axis, as `pathOps.normalize` reports it. */\nexport interface PathNormalization {\n /** The path, remapped so its bounds are exactly the unit box. */\n path: VectorPath;\n /** How much wider the geometry became, as a multiple of the old box. */\n scaleX: number;\n scaleY: number;\n /** Where the old geometry's centre sat, in the *old* unit space. */\n centerX: number;\n centerY: number;\n}\n\n// ── The operation surface ──────────────────────────────────────────────────\n\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/types.ts"],"names":[],"mappings":";AA0MA,8EAA8E","sourcesContent":["/**\r\n * Every type the path module names, in one place.\r\n *\r\n * The vocabulary is small and it is worth seeing all of it at once, because the\r\n * whole module is four representations and the conversions between them:\r\n *\r\n * PathData ─▶ PathCommand[] ─▶ PathContour[] ─┬─▶ CubicSubpath[] (morph)\r\n * a string as written the normal └─▶ VectorPath (editing)\r\n * or commands form\r\n */\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\n\r\n// ── Geometry ───────────────────────────────────────────────────────────────\r\n\r\n// `Extents` — the `{ minX, minY, maxX, maxY }` box — is `@/layout/bounds`'s,\r\n// not a second copy. A path's bounding box and a node's are the same idea, and\r\n// the two were already the same four fields under two names.\r\n\r\n/**\r\n * A single cubic Bézier: start anchor `p0`, controls `c1`/`c2`, end anchor `p1`.\r\n * The end anchor of one cubic is the start of the next within a subpath.\r\n */\r\nexport interface Cubic {\r\n p0: Vector2;\r\n c1: Vector2;\r\n c2: Vector2;\r\n p1: Vector2;\r\n}\r\n\r\n/** An SVG `A` command re-expressed as the ellipse arc it names. */\r\nexport interface ArcParams {\r\n cx: number;\r\n cy: number;\r\n /** Radii after the spec's \"scale up until the endpoints are reachable\" correction. */\r\n rx: number;\r\n ry: number;\r\n /** x-axis rotation, in **radians** (the command carries degrees). */\r\n phi: number;\r\n /** Start angle, and the signed sweep from it — `sweep`/`largeArc` already folded in. */\r\n theta1: number;\r\n dtheta: number;\r\n}\r\n\r\n// ── The normal form ────────────────────────────────────────────────────────\r\n\r\n/**\r\n * One piece of a contour, keeping its own kind.\r\n *\r\n * Normalizing everything to cubics would be simpler by one dimension and wrong\r\n * in a way that shows on screen: an arc is not a cubic, so `length`, `sampler`,\r\n * `dash` and `trim` would all inherit an approximation only *morph* and the\r\n * anchor model actually need.\r\n *\r\n * Plain data, not a bundle of closures: `contours` runs inside `measure()` on\r\n * every layout pass, and arc-length parameterization is the expensive part of\r\n * path geometry. Nothing here samples a curve — `Extents` come from\r\n * closed-form extrema, and arc length is a separate, lazy table.\r\n */\r\nexport type PathSegment =\r\n | { kind: \"line\"; from: Vector2; to: Vector2 }\r\n | { kind: \"quad\"; from: Vector2; c: Vector2; to: Vector2 }\r\n | { kind: \"cubic\"; from: Vector2; c1: Vector2; c2: Vector2; to: Vector2 }\r\n | {\r\n kind: \"arc\"; from: Vector2; to: Vector2;\r\n rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1;\r\n };\r\n\r\n/**\r\n * One connected run — everything between an `M` and the next one.\r\n *\r\n * `start` is carried separately because a contour can legitimately have no\r\n * segments: a lone `M` is a real thing to write, it occupies a point that bounds\r\n * must account for, and the anchor model round-trips it as a single anchor.\r\n *\r\n * The closing edge of a `closed` contour is **not** in `segments` — `closed`\r\n * carries it. Storing it would mean a zero-length segment whenever the geometry\r\n * already ends where it started, which is most of the time.\r\n */\r\nexport interface PathContour {\r\n start: Vector2;\r\n segments: PathSegment[];\r\n /** Whether the run ended with a `Z`. */\r\n closed: boolean;\r\n}\r\n\r\n// ── Arc-length measurement ─────────────────────────────────────────────────\r\n\r\nexport interface SegmentMetric {\r\n segment: PathSegment;\r\n /** The flattened polyline, `from` first and `to` last. */\r\n points: Vector2[];\r\n /** Length along the polyline at each point; the last entry is `length`. */\r\n cumulative: number[];\r\n length: number;\r\n}\r\n\r\nexport interface ContourMetric {\r\n contour: PathContour;\r\n /** Every segment, the closed contour's implied join included. */\r\n metrics: SegmentMetric[];\r\n length: number;\r\n}\r\n\r\nexport interface PathMetric {\r\n contours: ContourMetric[];\r\n length: number;\r\n}\r\n\r\n/** A point on the path with the unit tangent direction there. */\r\nexport interface PathFrame {\r\n x: number;\r\n y: number;\r\n /** Unit tangent (direction of travel along the path). */\r\n tx: number;\r\n ty: number;\r\n}\r\n\r\nexport interface PathSampler {\r\n /** Total arc length across all contours. */\r\n readonly length: number;\r\n /**\r\n * Point and unit tangent at arc-length distance `d` from the path start.\r\n * `d` is clamped to `[0, length]`. Returns `null` only for a degenerate\r\n * (zero-length) path. Keeps an internal cursor so repeated calls with\r\n * non-decreasing `d` are amortized O(1).\r\n */\r\n frameAt(d: number): PathFrame | null;\r\n}\r\n\r\n// ── Morphing ───────────────────────────────────────────────────────────────\r\n\r\n/** A connected run of cubics (one `M` followed by curves), optionally closed. */\r\nexport interface CubicSubpath {\r\n cubics: Cubic[];\r\n /** True for subpaths that ended with a `Z` — eligible for rotation/reversal. */\r\n closed: boolean;\r\n}\r\n\r\n/** A correspondence between two paths, pre-aligned so it can be sampled at any `t`. */\r\nexport interface MorphPlan {\r\n /** Subpath pairs; each pair has the same number of cubics on both sides. */\r\n pairs: Array<{\r\n from: Cubic[];\r\n to: Cubic[];\r\n /**\r\n * Whether the sampled subpath should be closed with a `Z`. A pair is\r\n * closed when both sides were closed rings — a closed shape morphing to\r\n * another closed shape stays closed, so the stroke forms a proper join\r\n * at the seam instead of leaving two unconnected free ends.\r\n */\r\n closed: boolean;\r\n }>;\r\n}\r\n\r\n// ── The editable anchor model ──────────────────────────────────────────────\r\n\r\n/**\r\n * One anchor on a subpath, with the two control points that shape the segments\r\n * meeting at it.\r\n *\r\n * Handles are **absolute** points in the same space as {@link PathAnchor.point},\r\n * not offsets from it. That is what an SVG cubic stores, so serializing is a\r\n * copy rather than an addition, and it is the space a canvas editor drags them\r\n * in — an offset model would convert twice per pointer event for no gain.\r\n *\r\n * `null` means \"no handle on this side\", which draws as a straight segment. A\r\n * corner point has both null; a smooth point has both, mirrored through the\r\n * anchor; an asymmetric point has both, pointing opposite ways at different\r\n * lengths. The model does not record which of the three a point *is* — that is\r\n * derived from the handles, so a file cannot claim to be smooth while holding\r\n * handles that aren't.\r\n */\r\nexport interface PathAnchor {\r\n point: Vector2;\r\n /** Control point for the segment **arriving** at this anchor. */\r\n inHandle: Vector2 | null;\r\n /** Control point for the segment **leaving** it. */\r\n outHandle: Vector2 | null;\r\n}\r\n\r\n/** A single contiguous run of anchors — one `M …` in the `d` string. */\r\nexport interface PathSubpath {\r\n anchors: PathAnchor[];\r\n /** Whether the last anchor joins back to the first (`Z`). */\r\n closed: boolean;\r\n}\r\n\r\n/** A whole path: zero or more subpaths. */\r\nexport type VectorPath = PathSubpath[];\r\n\r\n/** Scale and offset applied on each axis, as `pathOps.normalize` reports it. */\r\nexport interface PathNormalization {\r\n /** The path, remapped so its bounds are exactly the unit box. */\r\n path: VectorPath;\r\n /** How much wider the geometry became, as a multiple of the old box. */\r\n scaleX: number;\r\n scaleY: number;\r\n /** Where the old geometry's centre sat, in the *old* unit space. */\r\n centerX: number;\r\n centerY: number;\r\n}\r\n\r\n// ── The operation surface ──────────────────────────────────────────────────\r\n\r\n"]}
|