@motionscript/core 0.1.0-alpha.0 → 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 +282 -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 +93 -11
- 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 +32 -4
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +9 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +11 -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.d.ts +1 -0
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +1 -0
- 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 +17 -6
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +26 -14
- 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.d.ts +9 -1
- package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
- package/dist/attributes/shape/fill/lerp.js +12 -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 +3 -3
- 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.d.ts.map +1 -1
- package/dist/document/command-traits.js +17 -3
- 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 +34 -16
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +51 -12
- 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 +188 -32
- 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.d.ts +3 -2
- package/dist/nodes/audio/node-audio.d.ts.map +1 -1
- package/dist/nodes/audio/node-audio.js +8 -5
- 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 +2 -2
- 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 +5 -3
- 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 +10 -3
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- 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 +5 -5
- 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.d.ts +2 -2
- package/dist/render3d/resources.js +2 -2
- 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.d.ts +2 -2
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +8 -2
- 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 +33 -3
- 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 +27 -22
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +23 -9
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +12 -4
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +10 -22
- 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 +12 -1
- package/dist/tween/seekable.d.ts.map +1 -1
- package/dist/tween/seekable.js +15 -0
- 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-P3XQCHDW.js +0 -16
- package/dist/browser/chunks/chunk-P3XQCHDW.js.map +0 -7
- package/dist/browser/chunks/chunk-VJQMKHGQ.js +0 -3
- package/dist/browser/chunks/chunk-VJQMKHGQ.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
|
@@ -111,5 +111,32 @@ export declare abstract class PaintNode<P extends PaintProps = PaintProps> exten
|
|
|
111
111
|
shadowTo(args: CommandArgs<Shadow, ShadowResolved[]> & {
|
|
112
112
|
duration: number;
|
|
113
113
|
}): Command<P>;
|
|
114
|
+
/**
|
|
115
|
+
* Animate how much of the outline is drawn: `start` and `end`, each a
|
|
116
|
+
* fraction of its length in `[0, 1]`, whichever are given.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* path.progressTo({ data: { end: 1 }, duration: 0.8 });
|
|
120
|
+
*/
|
|
121
|
+
progressTo(args: CommandArgs<{
|
|
122
|
+
start?: number;
|
|
123
|
+
end?: number;
|
|
124
|
+
}> & {
|
|
125
|
+
duration: number;
|
|
126
|
+
}): Command<P>;
|
|
127
|
+
/**
|
|
128
|
+
* Send a stretch of the outline along it, `portion` of its length long,
|
|
129
|
+
* from its beginning off its end. Before and after, the node draws as much
|
|
130
|
+
* of its outline as it did: one that rests with `end: 0` is only ever seen
|
|
131
|
+
* as the stretch passing.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* outline.flash({ data: { portion: 0.2 }, duration: 0.8 });
|
|
135
|
+
*/
|
|
136
|
+
flash(args: CommandArgs<{
|
|
137
|
+
portion?: number;
|
|
138
|
+
}> & {
|
|
139
|
+
duration: number;
|
|
140
|
+
}): Command<P>;
|
|
114
141
|
}
|
|
115
142
|
//# sourceMappingURL=paint-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paint-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/2d/paint-node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,KAAK,MAAM,EAAa,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,KAAK,MAAM,EAAa,MAAM,kCAAkC,CAAC;AAE1F,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAA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;OAMG;IAOH,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAMlG;;;;;;;;OAQG;IAEH,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;CAapF"}
|
|
@@ -162,6 +162,37 @@ export class PaintNode extends Node2D {
|
|
|
162
162
|
const lerp = args.lerp ?? shadowOps.lerp;
|
|
163
163
|
return this.command(t => ({ shadow: lerp(from, target, t) }), args.duration, args.easing);
|
|
164
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Animate how much of the outline is drawn: `start` and `end`, each a
|
|
167
|
+
* fraction of its length in `[0, 1]`, whichever are given.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* path.progressTo({ data: { end: 1 }, duration: 0.8 });
|
|
171
|
+
*/
|
|
172
|
+
progressTo(args) {
|
|
173
|
+
const { start, end } = args.data ?? {};
|
|
174
|
+
const data = { ...(start === undefined ? {} : { start }), ...(end === undefined ? {} : { end }) };
|
|
175
|
+
return this.to({ data: data, duration: args.duration, easing: args.easing });
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Send a stretch of the outline along it, `portion` of its length long,
|
|
179
|
+
* from its beginning off its end. Before and after, the node draws as much
|
|
180
|
+
* of its outline as it did: one that rests with `end: 0` is only ever seen
|
|
181
|
+
* as the stretch passing.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* outline.flash({ data: { portion: 0.2 }, duration: 0.8 });
|
|
185
|
+
*/
|
|
186
|
+
flash(args) {
|
|
187
|
+
const rest = { start: this.start, end: this.end };
|
|
188
|
+
const portion = Math.min(1, Math.max(0.01, args.data?.portion ?? 0.25));
|
|
189
|
+
return this.command((t) => {
|
|
190
|
+
if (t <= 0 || t >= 1)
|
|
191
|
+
return rest;
|
|
192
|
+
const head = t * (1 + portion);
|
|
193
|
+
return { start: Math.max(0, head - portion), end: Math.min(1, head) };
|
|
194
|
+
}, args.duration, args.easing);
|
|
195
|
+
}
|
|
165
196
|
}
|
|
166
197
|
__decorate([
|
|
167
198
|
fillProperty()
|
|
@@ -187,4 +218,15 @@ __decorate([
|
|
|
187
218
|
__decorate([
|
|
188
219
|
command()
|
|
189
220
|
], PaintNode.prototype, "shadowTo", null);
|
|
221
|
+
__decorate([
|
|
222
|
+
command({
|
|
223
|
+
args: [
|
|
224
|
+
{ key: "start", kind: "number", min: 0, max: 1, step: 0.01, scale: 100, unit: "%" },
|
|
225
|
+
{ key: "end", kind: "number", min: 0, max: 1, step: 0.01, scale: 100, unit: "%" },
|
|
226
|
+
],
|
|
227
|
+
})
|
|
228
|
+
], PaintNode.prototype, "progressTo", null);
|
|
229
|
+
__decorate([
|
|
230
|
+
command({ args: [{ key: "portion", kind: "number", min: 0.01, max: 1, step: 0.01, scale: 100, unit: "%", default: 0.25 }] })
|
|
231
|
+
], PaintNode.prototype, "flash", null);
|
|
190
232
|
//# sourceMappingURL=paint-node.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paint-node.js","sourceRoot":"","sources":["../../../src/nodes/2d/paint-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAG3D,OAAO,EAA+B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAA+B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAM7F,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;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QACzC,OAAO,IAAI,CAAC,OAAO,CAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAe,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/G,CAAC;CACJ;AA3JW;IADP,YAAY,EAAE;uCACI;AAGX;IADP,cAAc,EAAE;yCACM;AAGf;IADP,cAAc,EAAE;yCACM;AAGf;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;wCACH;AAGd;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;sCACL;AAyHpB;IADC,OAAO,EAAE;uCAMT;AAGD;IADC,OAAO,EAAE;yCAMT;AAGD;IADC,OAAO,EAAE;yCAMT","sourcesContent":["import { fillOps } from \"@/attributes/shape/fill/registry\";\nimport type { AssetScope } from \"@/assets/scope\";\n\nimport { StrokeResolved, type Stroke, strokeOps } from \"@/attributes/shape/stroke/stroke\";\nimport { ShadowResolved, type Shadow, shadowOps } from \"@/attributes/shape/shadow/shadow\";\nimport { fillProperty, shadowProperty, strokeProperty } from \"@/attributes/properties/typed\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\n\nimport { RenderContext2D } from \"@/render/render-context2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { containsClip } from \"@/render/clip-contains\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { Node2D, Node2DProps } from \"@/nodes/2d/node2d\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\n\nexport interface PaintProps extends Node2DProps {\n /**\n * Fill layer(s). Each item can be:\n * - A plain CSS color string → treated as a solid fill\n * - A fill prop object (SolidFillProp, LinearGradientFillProp, …)\n * - An already-resolved fill object\n * - A {@link FillChain} from the `Fills` builder (e.g. `Fills.color('red')`)\n */\n fill?: Fill;\n /**\n * Stroke layer(s): a single {@link StrokeProp}, an array of them, or an\n * already-resolved stroke. `fill` inside each stroke accepts the same loose\n * values as the top-level fill prop.\n */\n stroke?: Stroke;\n /**\n * Shadow layer(s): a single {@link ShadowProp}, an array of them, or an\n * already-resolved shadow. `fill` inside each shadow accepts the same loose\n * values as the top-level fill prop.\n */\n shadow?: Shadow;\n start?: number;\n end?: number;\n}\n\n\n/**\n * A {@link Node2D} with **paint slots**: fill, stroke, shadow and an outline\n * trim, the commands that tween them, and the asset declaration they imply.\n *\n * Nothing about *shape* and nothing about *children* — the silhouette-shaped\n * paint (`overlay`) and the flex/freeform/grid pass both live one level down, on\n * {@link ShapeNode}, because both are facts about a box with an outline and a\n * subtree inside it. What is left here is what a `Rect`, a `Text` and an\n * out-of-tree node like `Tex` genuinely share, and it is why none of them\n * declares a paint prop, a `*To` command or an asset walk of its own.\n *\n * A subclass supplies the geometry (see {@link shapeGraphics}) or overrides the\n * paint hooks outright, which is what the text nodes do — glyphs are not a\n * silhouette that can be filled once.\n */\nexport abstract class PaintNode<P extends PaintProps = PaintProps> extends Node2D<P> {\n\n // Author-facing paint props. The declared type is the loose `Fill`/`Stroke`/\n // `Shadow` so assignment (`this.fill = 'red'`) and reads share one simple\n // type. At runtime the @property accessor stores the *resolved* value (via\n // the mapper), and consumers that need the resolved shape cast at the read\n // site — see `tick`/`prepare`/`*To` and the `Graphics2D` paint calls.\n // Stroke weight feeds Rect.effectivePadding(), which insets children.\n @fillProperty()\n declare fill: Fill;\n\n @strokeProperty()\n declare stroke: Stroke;\n\n @shadowProperty()\n declare shadow: Shadow;\n\n @property({ default: 0 })\n declare start: number;\n\n @property({ default: 1 })\n declare end: number;\n\n // No per-frame fill bookkeeping: a time-dependent fill (video) resolves its\n // own timestamp as it paints, from the node's clock — see\n // `resolveVideoTimestamp`. That is what lets one live anywhere paint is\n // accepted (stroke, shadow, a custom node's raw `Graphics2D`) rather than only\n // on the nodes that remembered to advance it from tick().\n\n // No longer abstract: `renderSelf` below paints the silhouette that\n // `shapeGraphics` describes, which is what every geometry subclass did\n // identically. A subclass with no single fillable silhouette returns `null`\n // from `shapeGraphics` and simply draws nothing here — the fallback that\n // method already documents — while `Text` and `Video` override the\n // paint themselves.\n\n /**\n * The node's bare silhouette as a {@link Graphics2D} with **no** paint ops.\n * `renderSelf` appends shadow + fill and {@link renderStroke} appends the\n * stroke; on a {@link ShapeNode} its `renderOverlay` appends the overlay too.\n * Sharing one builder keeps each shape's geometry defined in a single place.\n *\n * Returns `null` for nodes that have no single fillable silhouette (text,\n * boolean groups, grids) — those override the paint hooks themselves or opt\n * out of the generic overlay/stroke passes.\n */\n protected shapeGraphics(): Graphics2D | null {\n return null;\n }\n\n /**\n * Shadow + fill of the node's own silhouette.\n *\n * Hoisted here from the eight geometry subclasses that each had this exact\n * body. A subclass whose paint differs (`Path`, `Video`) still\n * overrides it.\n *\n * Each hook composes its own `Graphics2D` rather than sharing one built once:\n * `.fill()`, `.stroke()` and `.shadow()` push onto `_ops` and return `this`,\n * so a single silhouette handed to all three would accumulate paint ops\n * across passes.\n */\n protected override renderSelf(ctx: RenderContext2D): void {\n const base = this.shapeGraphics();\n if (base) ctx.draw(base.shadow(this.shadow).fill(this.fill));\n }\n\n // Deferred stroke, painted last so it frames the children and anything laid\n // over them.\n //\n // It carries the node's `shadow` when — and only when — there is no fill to\n // have cast it already. A shadow is cast by the silhouette a node actually\n // paints, and `renderSelf` casts it from the fill; on a fill-less shape that\n // pass paints nothing, so the shadow op it stored is dropped by the empty\n // fill and a stroked outline with a shadow on it drew no shadow at all.\n // The stroke *is* the silhouette there, and the renderer has always known\n // how to cast from one (`applyDropShadow`'s `hasStrokes` branch strokes the\n // shadow layer) — nothing but the op was missing.\n //\n // Guarded on the fill rather than emitted unconditionally, because with a\n // fill present the shadow has already been cast once, from a path the\n // stroke sits directly on top of: casting it again here would double its\n // opacity along the outline and lay a second, band-shaped shadow over the\n // first.\n protected override renderStroke(ctx: RenderContext2D): void {\n const stroke = this.stroke as StrokeResolved[];\n if (stroke.length === 0) return;\n const base = this.shapeGraphics();\n if (!base) return;\n ctx.draw(this.castsShadowFromStroke() ? base.shadow(this.shadow).stroke(stroke) : base.stroke(stroke));\n }\n\n /**\n * Whether the stroke pass is the one that has to cast the node's shadow.\n *\n * True when nothing in the fill list can paint — an empty list, or one whose\n * every layer is fully transparent, which is the same test\n * `StrokeHandler.applyShadows` uses to decide there is no filled silhouette\n * to sit the shadow under.\n */\n private castsShadowFromStroke(): boolean {\n const shadow = this.shadow as ShadowResolved[];\n if (shadow.length === 0) return false;\n const fill = this.fill as FillResolved[];\n return !fill.some(layer => (layer.opacity ?? 1) > 0);\n }\n\n /**\n * Every paint slot is already resolved on `this`, so what it references is read\n * off the node rather than discovered by drawing it. A subclass painting outside\n * these slots — `Video`, `Path`, the grids — overrides this and calls `super`.\n */\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets);\n assets.fill(this.fill as FillResolved[]);\n for (const stroke of this.stroke as StrokeResolved[]) assets.fill(stroke.fill);\n for (const shadow of this.shadow as ShadowResolved[]) assets.fill(shadow.fill);\n }\n\n /**\n * Shapes hit on their outline, not their box: a click in the empty corner of\n * a star's bounding box should fall through to whatever is behind it. The\n * outline is the very one this node already declares for clipping\n * ({@link Node2D.clipSelf}), so what is grabbable and what is drawn can never\n * drift. Nodes that declare no outline (Text, RichText, Path) keep the base\n * box test, which is what selection should do for them anyway.\n */\n protected override hitTestSelf(local: Vector2, tolerance: number): boolean {\n const clip = this.clipSelf();\n if (!clip || clip.isEmpty()) return super.hitTestSelf(local, tolerance);\n return containsClip(clip, local, tolerance);\n }\n\n // ---- Paint commands ---------------------------------------------------\n //\n // These are the shape a `Command` exists for: a paint has no in-between a\n // numeric tween could find, so each is a `t → props` function the node\n // supplies. They used to be generators over `tween(...)`, which ran fine and\n // could not be asked what they looked like at a time. Same body, returned as\n // a value.\n\n @command()\n fillTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<P> {\n const from = this.fill as FillResolved[];\n const target = fillOps.resolve(args.data as Fill);\n const lerp = args.lerp ?? fillOps.lerp;\n return this.command<P>(t => ({ fill: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\n }\n\n @command()\n strokeTo(args: CommandArgs<Stroke, StrokeResolved[]> & { duration: number }): Command<P> {\n const from = this.stroke as StrokeResolved[];\n const target = strokeOps.resolve(args.data as Stroke, from);\n const lerp = args.lerp ?? strokeOps.lerp;\n return this.command<P>(t => ({ stroke: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\n }\n\n @command()\n shadowTo(args: CommandArgs<Shadow, ShadowResolved[]> & { duration: number }): Command<P> {\n const from = this.shadow as ShadowResolved[];\n const target = shadowOps.resolve(args.data as Shadow, from);\n const lerp = args.lerp ?? shadowOps.lerp;\n return this.command<P>(t => ({ shadow: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"paint-node.js","sourceRoot":"","sources":["../../../src/nodes/2d/paint-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAG3D,OAAO,EAA+B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAA+B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAM7F,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAe,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA6BpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,SAA6C,SAAQ,MAAS;IAuBhF,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I,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,CACd,CAAC;IACN,CAAC;CACJ;AAtMW;IADP,YAAY,EAAE;uCACI;AAGX;IADP,cAAc,EAAE;yCACM;AAGf;IADP,cAAc,EAAE;yCACM;AAGf;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;wCACH;AAGd;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;sCACL;AAyHpB;IADC,OAAO,EAAE;uCAMT;AAGD;IADC,OAAO,EAAE;yCAMT;AAGD;IADC,OAAO,EAAE;yCAMT;AAeD;IANC,OAAO,CAAC;QACL,IAAI,EAAE;YACF,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE;YACnF,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE;SACpF;KACJ,CAAC;2CAKD;AAYD;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;sCAa5H","sourcesContent":["import { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\n\r\nimport { StrokeResolved, type Stroke, strokeOps } from \"@/attributes/shape/stroke/stroke\";\r\nimport { ShadowResolved, type Shadow, shadowOps } from \"@/attributes/shape/shadow/shadow\";\r\nimport { fillProperty, shadowProperty, strokeProperty } from \"@/attributes/properties/typed\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\n\r\nimport { RenderContext2D } from \"@/render/render-context2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { containsClip } from \"@/render/clip-contains\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { Node2D, Node2DProps } from \"@/nodes/2d/node2d\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\n\r\nexport interface PaintProps extends Node2DProps {\r\n /**\r\n * Fill layer(s). Each item can be:\r\n * - A plain CSS color string → treated as a solid fill\r\n * - A fill prop object (SolidFillProp, LinearGradientFillProp, …)\r\n * - An already-resolved fill object\r\n * - A {@link FillChain} from the `Fills` builder (e.g. `Fills.color('red')`)\r\n */\r\n fill?: Fill;\r\n /**\r\n * Stroke layer(s): a single {@link StrokeProp}, an array of them, or an\r\n * already-resolved stroke. `fill` inside each stroke accepts the same loose\r\n * values as the top-level fill prop.\r\n */\r\n stroke?: Stroke;\r\n /**\r\n * Shadow layer(s): a single {@link ShadowProp}, an array of them, or an\r\n * already-resolved shadow. `fill` inside each shadow accepts the same loose\r\n * values as the top-level fill prop.\r\n */\r\n shadow?: Shadow;\r\n start?: number;\r\n end?: number;\r\n}\r\n\r\n\r\n/**\r\n * A {@link Node2D} with **paint slots**: fill, stroke, shadow and an outline\r\n * trim, the commands that tween them, and the asset declaration they imply.\r\n *\r\n * Nothing about *shape* and nothing about *children* — the silhouette-shaped\r\n * paint (`overlay`) and the flex/freeform/grid pass both live one level down, on\r\n * {@link ShapeNode}, because both are facts about a box with an outline and a\r\n * subtree inside it. What is left here is what a `Rect`, a `Text` and an\r\n * out-of-tree node like `Tex` genuinely share, and it is why none of them\r\n * declares a paint prop, a `*To` command or an asset walk of its own.\r\n *\r\n * A subclass supplies the geometry (see {@link shapeGraphics}) or overrides the\r\n * paint hooks outright, which is what the text nodes do — glyphs are not a\r\n * silhouette that can be filled once.\r\n */\r\nexport abstract class PaintNode<P extends PaintProps = PaintProps> extends Node2D<P> {\r\n\r\n // Author-facing paint props. The declared type is the loose `Fill`/`Stroke`/\r\n // `Shadow` so assignment (`this.fill = 'red'`) and reads share one simple\r\n // type. At runtime the @property accessor stores the *resolved* value (via\r\n // the mapper), and consumers that need the resolved shape cast at the read\r\n // site — see `tick`/`prepare`/`*To` and the `Graphics2D` paint calls.\r\n // Stroke weight feeds Rect.effectivePadding(), which insets children.\r\n @fillProperty()\r\n declare fill: Fill;\r\n\r\n @strokeProperty()\r\n declare stroke: Stroke;\r\n\r\n @shadowProperty()\r\n declare shadow: Shadow;\r\n\r\n @property({ default: 0 })\r\n declare start: number;\r\n\r\n @property({ default: 1 })\r\n declare end: number;\r\n\r\n // No per-frame fill bookkeeping: a time-dependent fill (video) resolves its\r\n // own timestamp as it paints, from the node's clock — see\r\n // `resolveVideoTimestamp`. That is what lets one live anywhere paint is\r\n // accepted (stroke, shadow, a custom node's raw `Graphics2D`) rather than only\r\n // on the nodes that remembered to advance it from tick().\r\n\r\n // No longer abstract: `renderSelf` below paints the silhouette that\r\n // `shapeGraphics` describes, which is what every geometry subclass did\r\n // identically. A subclass with no single fillable silhouette returns `null`\r\n // from `shapeGraphics` and simply draws nothing here — the fallback that\r\n // method already documents — while `Text` and `Video` override the\r\n // paint themselves.\r\n\r\n /**\r\n * The node's bare silhouette as a {@link Graphics2D} with **no** paint ops.\r\n * `renderSelf` appends shadow + fill and {@link renderStroke} appends the\r\n * stroke; on a {@link ShapeNode} its `renderOverlay` appends the overlay too.\r\n * Sharing one builder keeps each shape's geometry defined in a single place.\r\n *\r\n * Returns `null` for nodes that have no single fillable silhouette (text,\r\n * boolean groups, grids) — those override the paint hooks themselves or opt\r\n * out of the generic overlay/stroke passes.\r\n */\r\n protected shapeGraphics(): Graphics2D | null {\r\n return null;\r\n }\r\n\r\n /**\r\n * Shadow + fill of the node's own silhouette.\r\n *\r\n * Hoisted here from the eight geometry subclasses that each had this exact\r\n * body. A subclass whose paint differs (`Path`, `Video`) still\r\n * overrides it.\r\n *\r\n * Each hook composes its own `Graphics2D` rather than sharing one built once:\r\n * `.fill()`, `.stroke()` and `.shadow()` push onto `_ops` and return `this`,\r\n * so a single silhouette handed to all three would accumulate paint ops\r\n * across passes.\r\n */\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n const base = this.shapeGraphics();\r\n if (base) ctx.draw(base.shadow(this.shadow).fill(this.fill));\r\n }\r\n\r\n // Deferred stroke, painted last so it frames the children and anything laid\r\n // over them.\r\n //\r\n // It carries the node's `shadow` when — and only when — there is no fill to\r\n // have cast it already. A shadow is cast by the silhouette a node actually\r\n // paints, and `renderSelf` casts it from the fill; on a fill-less shape that\r\n // pass paints nothing, so the shadow op it stored is dropped by the empty\r\n // fill and a stroked outline with a shadow on it drew no shadow at all.\r\n // The stroke *is* the silhouette there, and the renderer has always known\r\n // how to cast from one (`applyDropShadow`'s `hasStrokes` branch strokes the\r\n // shadow layer) — nothing but the op was missing.\r\n //\r\n // Guarded on the fill rather than emitted unconditionally, because with a\r\n // fill present the shadow has already been cast once, from a path the\r\n // stroke sits directly on top of: casting it again here would double its\r\n // opacity along the outline and lay a second, band-shaped shadow over the\r\n // first.\r\n protected override renderStroke(ctx: RenderContext2D): void {\r\n const stroke = this.stroke as StrokeResolved[];\r\n if (stroke.length === 0) return;\r\n const base = this.shapeGraphics();\r\n if (!base) return;\r\n ctx.draw(this.castsShadowFromStroke() ? base.shadow(this.shadow).stroke(stroke) : base.stroke(stroke));\r\n }\r\n\r\n /**\r\n * Whether the stroke pass is the one that has to cast the node's shadow.\r\n *\r\n * True when nothing in the fill list can paint — an empty list, or one whose\r\n * every layer is fully transparent, which is the same test\r\n * `StrokeHandler.applyShadows` uses to decide there is no filled silhouette\r\n * to sit the shadow under.\r\n */\r\n private castsShadowFromStroke(): boolean {\r\n const shadow = this.shadow as ShadowResolved[];\r\n if (shadow.length === 0) return false;\r\n const fill = this.fill as FillResolved[];\r\n return !fill.some(layer => (layer.opacity ?? 1) > 0);\r\n }\r\n\r\n /**\r\n * Every paint slot is already resolved on `this`, so what it references is read\r\n * off the node rather than discovered by drawing it. A subclass painting outside\r\n * these slots — `Video`, `Path`, the grids — overrides this and calls `super`.\r\n */\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n assets.fill(this.fill as FillResolved[]);\r\n for (const stroke of this.stroke as StrokeResolved[]) assets.fill(stroke.fill);\r\n for (const shadow of this.shadow as ShadowResolved[]) assets.fill(shadow.fill);\r\n }\r\n\r\n /**\r\n * Shapes hit on their outline, not their box: a click in the empty corner of\r\n * a star's bounding box should fall through to whatever is behind it. The\r\n * outline is the very one this node already declares for clipping\r\n * ({@link Node2D.clipSelf}), so what is grabbable and what is drawn can never\r\n * drift. Nodes that declare no outline (Text, RichText, Path) keep the base\r\n * box test, which is what selection should do for them anyway.\r\n */\r\n protected override hitTestSelf(local: Vector2, tolerance: number): boolean {\r\n const clip = this.clipSelf();\r\n if (!clip || clip.isEmpty()) return super.hitTestSelf(local, tolerance);\r\n return containsClip(clip, local, tolerance);\r\n }\r\n\r\n // ---- Paint commands ---------------------------------------------------\r\n //\r\n // These are the shape a `Command` exists for: a paint has no in-between a\r\n // numeric tween could find, so each is a `t → props` function the node\r\n // supplies. They used to be generators over `tween(...)`, which ran fine and\r\n // could not be asked what they looked like at a time. Same body, returned as\r\n // a value.\r\n\r\n @command()\r\n fillTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<P> {\r\n const from = this.fill as FillResolved[];\r\n const target = fillOps.resolve(args.data as Fill);\r\n const lerp = args.lerp ?? fillOps.lerp;\r\n return this.command<P>(t => ({ fill: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\r\n }\r\n\r\n @command()\r\n strokeTo(args: CommandArgs<Stroke, StrokeResolved[]> & { duration: number }): Command<P> {\r\n const from = this.stroke as StrokeResolved[];\r\n const target = strokeOps.resolve(args.data as Stroke, from);\r\n const lerp = args.lerp ?? strokeOps.lerp;\r\n return this.command<P>(t => ({ stroke: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\r\n }\r\n\r\n @command()\r\n shadowTo(args: CommandArgs<Shadow, ShadowResolved[]> & { duration: number }): Command<P> {\r\n const from = this.shadow as ShadowResolved[];\r\n const target = shadowOps.resolve(args.data as Shadow, from);\r\n const lerp = args.lerp ?? shadowOps.lerp;\r\n return this.command<P>(t => ({ shadow: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Animate how much of the outline is drawn: `start` and `end`, each a\r\n * fraction of its length in `[0, 1]`, whichever are given.\r\n *\r\n * @example\r\n * path.progressTo({ data: { end: 1 }, duration: 0.8 });\r\n */\r\n @command({\r\n args: [\r\n { key: \"start\", kind: \"number\", min: 0, max: 1, step: 0.01, scale: 100, unit: \"%\" },\r\n { key: \"end\", kind: \"number\", min: 0, max: 1, step: 0.01, scale: 100, unit: \"%\" },\r\n ],\r\n })\r\n progressTo(args: CommandArgs<{ start?: number; end?: number }> & { duration: number }): Command<P> {\r\n const { start, end } = args.data ?? {};\r\n const data = { ...(start === undefined ? {} : { start }), ...(end === undefined ? {} : { end }) };\r\n return this.to({ data: data as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * Send a stretch of the outline along it, `portion` of its length long,\r\n * from its beginning off its end. Before and after, the node draws as much\r\n * of its outline as it did: one that rests with `end: 0` is only ever seen\r\n * as the stretch passing.\r\n *\r\n * @example\r\n * outline.flash({ data: { portion: 0.2 }, duration: 0.8 });\r\n */\r\n @command({ args: [{ key: \"portion\", kind: \"number\", min: 0.01, max: 1, step: 0.01, scale: 100, unit: \"%\", default: 0.25 }] })\r\n flash(args: CommandArgs<{ portion?: number }> & { duration: number }): Command<P> {\r\n const rest = { start: this.start, end: this.end };\r\n const portion = Math.min(1, Math.max(0.01, args.data?.portion ?? 0.25));\r\n return this.command<P>(\r\n (t) => {\r\n if (t <= 0 || t >= 1) return rest as Partial<P>;\r\n const head = t * (1 + portion);\r\n return { start: Math.max(0, head - portion), end: Math.min(1, head) } as Partial<P>;\r\n },\r\n args.duration,\r\n args.easing,\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-bus.js","sourceRoot":"","sources":["../../../src/nodes/audio/audio-bus.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAO9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAwB;CAErD;AADyC;IAArC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;sCAAuB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { NodeAudio, type NodeAudioProps } from \"./node-audio\";\n\nexport interface AudioBusProps extends NodeAudioProps {\n /** Silence every other bus that is not itself soloed. */\n solo: boolean;\n}\n\n/**\n * A group in the audio tree: everything beneath it feeds through its level and\n * its filters.\n *\n * The counterpart to a `Rect` holding children, and it earns its place the same\n * way — one edit reaching many things. Ducking six sound effects under a\n * voiceover is one bus with one gain curve, not six clips whose curves have to\n * be kept identical by hand.\n *\n * It is a real signal path, not an authoring convenience: the platform builds\n * one live chain per bus and every clip under it feeds that same chain, so a\n * reverb here is a single tail the whole group shares. Flattening it into\n * per-clip processing would be a different sound.\n *\n * **One bus node is one bus.** Containment is the only thing that puts a clip on\n * it — being under it, or naming its id in `Video.bus`. Two bus nodes sharing a\n * `key` no longer merge into one; a chain is keyed by {@link NodeAudio._busId},\n * so what two clips have to share to share a chain is that identity.\n */\nexport class AudioBus extends NodeAudio<AudioBusProps> {\n @property({ default: false }) declare solo: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"audio-bus.js","sourceRoot":"","sources":["../../../src/nodes/audio/audio-bus.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAO9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAwB;CAErD;AADyC;IAArC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;sCAAuB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { NodeAudio, type NodeAudioProps } from \"./node-audio\";\r\n\r\nexport interface AudioBusProps extends NodeAudioProps {\r\n /** Silence every other bus that is not itself soloed. */\r\n solo: boolean;\r\n}\r\n\r\n/**\r\n * A group in the audio tree: everything beneath it feeds through its level and\r\n * its filters.\r\n *\r\n * The counterpart to a `Rect` holding children, and it earns its place the same\r\n * way — one edit reaching many things. Ducking six sound effects under a\r\n * voiceover is one bus with one gain curve, not six clips whose curves have to\r\n * be kept identical by hand.\r\n *\r\n * It is a real signal path, not an authoring convenience: the platform builds\r\n * one live chain per bus and every clip under it feeds that same chain, so a\r\n * reverb here is a single tail the whole group shares. Flattening it into\r\n * per-clip processing would be a different sound.\r\n *\r\n * **One bus node is one bus.** Containment is the only thing that puts a clip on\r\n * it — being under it, or naming its id in `Video.bus`. Two bus nodes sharing a\r\n * `key` no longer merge into one; a chain is keyed by {@link NodeAudio._busId},\r\n * so what two clips have to share to share a chain is that identity.\r\n */\r\nexport class AudioBus extends NodeAudio<AudioBusProps> {\r\n @property({ default: false }) declare solo: boolean;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nodes/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC","sourcesContent":["export { NodeAudio, busPathOf, busPathTo, findBusById, structuralPathOf, type NodeAudioProps } from \"./node-audio\";\nexport { AudioBus, type AudioBusProps } from \"./audio-bus\";\nexport { SoundNode, type SoundNodeProps } from \"./sound-node\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nodes/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC","sourcesContent":["export { NodeAudio, busPathOf, busPathTo, findBusById, structuralPathOf, type NodeAudioProps } from \"./node-audio\";\r\nexport { AudioBus, type AudioBusProps } from \"./audio-bus\";\r\nexport { SoundNode, type SoundNodeProps } from \"./sound-node\";\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AudioFilter } from "../../attributes/audio/filters/chain.js";
|
|
2
2
|
import type { Param } from "../../attributes/audio/filters/curve.js";
|
|
3
3
|
import type { AudioBusStop } from "../../attributes/audio/request.js";
|
|
4
|
+
import type { AudioScope } from "../../attributes/audio/schedule.js";
|
|
4
5
|
import { Node, type NodeConfig, type NodeDimension, type NodeProps } from "../../nodes/node/node.js";
|
|
5
6
|
import type { EasingFunction } from "../../tween/ease/type.js";
|
|
6
7
|
import type { TweenStepper } from "../../tween/stepper.js";
|
|
@@ -81,9 +82,9 @@ export declare class NodeAudio<P extends NodeAudioProps = NodeAudioProps> extend
|
|
|
81
82
|
* parent, which is the `Canvas2D` scene root, because a scene root is not a bus
|
|
82
83
|
* — it has no level of its own and nothing to mix.
|
|
83
84
|
*/
|
|
84
|
-
export declare function busPathOf(node: NodeAudio): AudioBusStop[] | undefined;
|
|
85
|
+
export declare function busPathOf(node: NodeAudio, audio: AudioScope): AudioBusStop[] | undefined;
|
|
85
86
|
/** {@link busPathOf}, with `bus` itself as the first stop. */
|
|
86
|
-
export declare function busPathTo(bus: NodeAudio): AudioBusStop[];
|
|
87
|
+
export declare function busPathTo(bus: NodeAudio, audio: AudioScope): AudioBusStop[];
|
|
87
88
|
/**
|
|
88
89
|
* The bus in `from`'s scene with node id `id`, or `null`.
|
|
89
90
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-audio.d.ts","sourceRoot":"","sources":["../../../src/nodes/audio/node-audio.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC7C,6DAA6D;IAC7D,MAAM,EAAE,KAAK,CAAC;IACd,8DAA8D;IAC9D,GAAG,EAAE,KAAK,CAAC;IACX,4DAA4D;IAC5D,IAAI,EAAE,OAAO,CAAC;IACd,qEAAqE;IACrE,OAAO,EAAE,WAAW,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CAAE,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ED = ["volume", "pan"];
|
|
|
104
104
|
* parent, which is the `Canvas2D` scene root, because a scene root is not a bus
|
|
105
105
|
* — it has no level of its own and nothing to mix.
|
|
106
106
|
*/
|
|
107
|
-
export function busPathOf(node) {
|
|
107
|
+
export function busPathOf(node, audio) {
|
|
108
108
|
const stops = [];
|
|
109
109
|
let parent = node.parent;
|
|
110
110
|
while (parent instanceof NodeAudio) {
|
|
111
|
-
stops.push(stopOf(parent));
|
|
111
|
+
stops.push(stopOf(parent, audio));
|
|
112
112
|
parent = parent.parent;
|
|
113
113
|
}
|
|
114
114
|
return stops.length > 0 ? stops : undefined;
|
|
115
115
|
}
|
|
116
116
|
/** {@link busPathOf}, with `bus` itself as the first stop. */
|
|
117
|
-
export function busPathTo(bus) {
|
|
118
|
-
return [stopOf(bus), ...(busPathOf(bus) ?? [])];
|
|
117
|
+
export function busPathTo(bus, audio) {
|
|
118
|
+
return [stopOf(bus, audio), ...(busPathOf(bus, audio) ?? [])];
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* The bus in `from`'s scene with node id `id`, or `null`.
|
|
@@ -143,14 +143,17 @@ function searchBus(node, id) {
|
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
145
|
/** One bus, flattened to the plain data a platform builds its chain from. */
|
|
146
|
-
function stopOf(bus) {
|
|
146
|
+
function stopOf(bus, audio) {
|
|
147
147
|
const filters = bus.filters;
|
|
148
|
+
const span = audio._spanOf(bus);
|
|
148
149
|
return {
|
|
149
150
|
id: bus._busId,
|
|
150
151
|
volume: bus.volume,
|
|
151
152
|
pan: bus.pan,
|
|
152
153
|
mute: bus.mute,
|
|
153
154
|
...(filters.length > 0 ? { filters } : {}),
|
|
155
|
+
startAt: span.start,
|
|
156
|
+
endAt: span.end,
|
|
154
157
|
};
|
|
155
158
|
}
|
|
156
159
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-audio.js","sourceRoot":"","sources":["../../../src/nodes/audio/node-audio.ts"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,CAAC;AACrC,CAAC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { audioFiltersProperty, audioParamProperty } from \"@/attributes/properties/typed\";\nimport { type AudioFilter } from \"@/attributes/audio/filters/chain\";\nimport type { AudioFilterItem } from \"@/attributes/audio/filters/union\";\nimport type { Param } from \"@/attributes/audio/filters/curve\";\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/nodes/node/node\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { TweenStepper } from \"@/tween/stepper\";\n\nexport interface NodeAudioProps extends NodeProps {\n /** Linear gain. 1 leaves the signal alone, 0 silences it. */\n volume: Param;\n /** Stereo position: -1 hard left, 0 centre, +1 hard right. */\n pan: Param;\n /** Silence this node and, on a bus, everything under it. */\n mute: boolean;\n /** Filters applied in array order, index 0 closest to the source. */\n filters: AudioFilter;\n}\n\n/**\n * The third scene graph: things that make sound.\n *\n * Sibling to `Node2D` and `Node3D`, and thin for the same reason they are thick\n * — a node that makes sound has no box and no place in space, so it inherits the\n * tree, identity, props, commands, context and clock from {@link Node} and adds\n * only what every audible thing has: a level, a position in the stereo field, a\n * mute, and a filter chain.\n *\n * Two concrete kinds, and no more: `SoundNode` is a leaf that plays a file, and\n * `AudioBus` is a group that everything beneath it feeds. That is the whole\n * vocabulary of a mixer, and it is deliberately the same shape as the visual\n * trees — a group node and a drawing node — because the thing being described is\n * the same: what exists, and what is under what.\n *\n * ### Levels are curves, not tweens\n *\n * `volume` and `pan` are {@link Param}, so a fade is `AudioFilters`-style\n * automation (`fadeOut(1)`, `ramp(...)`) rather than a `to()`. That is not a\n * limitation being worked around, it is what the two mechanisms mean: a tween\n * writes a prop once per *frame*, while sound is scheduled once, ahead of\n * time, and then runs at 48 kHz. A per-frame write reaches the graph on the one\n * frame that built the request and never again — so a `to({ volume })` would\n * read as animated on the timeline and render flat. `_prepareStep` refuses it\n * instead.\n */\nexport class NodeAudio<P extends NodeAudioProps = NodeAudioProps> extends Node<P> {\n get dimension(): NodeDimension { return \"audio\"; }\n\n @audioParamProperty({ default: 1 }) declare volume: Param;\n @audioParamProperty({ default: 0 }) declare pan: Param;\n @property({ default: false }) declare mute: boolean;\n @audioFiltersProperty() declare filters: AudioFilter;\n\n constructor(props?: NodeConfig<any, P>) {\n super(props);\n // Deferred to here rather than run by `super()`: a subclass's field\n // initializers only run once `super()` has returned, so applying props\n // any earlier would write into cells that do not exist yet.\n this.initProps(props);\n this.adoptChildrenProp(props);\n }\n\n /** This node's children in the audio tree. */\n get childrenAudio(): NodeAudio[] {\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\n }\n\n /**\n * This bus's identity in the platform's graph: one chain, which everything\n * under it feeds.\n *\n * The authored id, and the structural path for a bus built in code rather\n * than from a document row. Neither answer alone works, and being wrong is\n * silent either way — the string reaches `AssetManager.stableKey`, so one\n * that changes re-fetches and re-schedules every clip on the bus. A document\n * row's id is fixed for the document's life, while its child index moves as\n * `syncPresence` adds and removes siblings; a code-built bus has no authored\n * id, but its parent builds it in the same slot every time.\n *\n * @internal\n */\n get _busId(): string {\n const authored = this._props?.id;\n return `bus:${typeof authored === \"string\" ? authored : structuralPathOf(this)}`;\n }\n\n /**\n * Refuse a tween on a level, naming the curve that does work.\n *\n * Loud rather than silent because the failure is otherwise invisible: the\n * command runs its full duration, the timeline draws a bar, and the render\n * is at one flat level. See the class docblock for why the two mechanisms\n * cannot agree.\n */\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n for (const key of TWEEN_REFUSED) {\n if (!(key in to)) continue;\n throw new TypeError(\n `${this.className}: \"${key}\" cannot be tweened — an audio level is scheduled once, ` +\n `not written per frame, so a tween on it would render flat. Automate it with a ` +\n `curve instead: ${key}: fadeOut(1), or filters: AudioFilters.gain(ramp(1, 0, 1)).`,\n );\n }\n return super._prepareStep(to, duration, easing);\n }\n}\n\nconst TWEEN_REFUSED = [\"volume\", \"pan\"] as const;\n\n/**\n * The buses a node feeds, **source-adjacent first**.\n *\n * Walks up the audio ancestors only: the walk stops at the first non-audio\n * parent, which is the `Canvas2D` scene root, because a scene root is not a bus\n * — it has no level of its own and nothing to mix.\n */\nexport function busPathOf(node: NodeAudio): AudioBusStop[] | undefined {\n const stops: AudioBusStop[] = [];\n let parent = node.parent;\n while (parent instanceof NodeAudio) {\n stops.push(stopOf(parent));\n parent = parent.parent;\n }\n return stops.length > 0 ? stops : undefined;\n}\n\n/** {@link busPathOf}, with `bus` itself as the first stop. */\nexport function busPathTo(bus: NodeAudio): AudioBusStop[] {\n return [stopOf(bus), ...(busPathOf(bus) ?? [])];\n}\n\n/**\n * The bus in `from`'s scene with node id `id`, or `null`.\n *\n * What lets something outside the audio tree feed a bus — a `Video`, whose audio\n * is welded to its picture and so cannot be parented under one. It names the bus\n * by the same id a `SoundNode` under that bus writes in its `parentId`, because\n * it is asking the same question: which bus. A `key` would be a second\n * vocabulary for it, and an optional one.\n */\nexport function findBusById(from: Node, id: string): NodeAudio | null {\n let root: Node = from;\n while (root.parent) root = root.parent;\n return searchBus(root, id);\n}\n\nfunction searchBus(node: Node, id: string): NodeAudio | null {\n if (node instanceof NodeAudio && node.id === id) return node;\n for (const child of node._allChildren) {\n const found = searchBus(child, id);\n if (found) return found;\n }\n return null;\n}\n\n/** One bus, flattened to the plain data a platform builds its chain from. */\nfunction stopOf(bus: NodeAudio): AudioBusStop {\n const filters = bus.filters as unknown as AudioFilterItem[];\n return {\n id: bus._busId,\n volume: bus.volume,\n pan: bus.pan,\n mute: bus.mute,\n ...(filters.length > 0 ? { filters } : {}),\n };\n}\n\n/**\n * A node's child-index path from the root of its tree, joined with \".\".\n *\n * The same identity `nodePath` gives the runtime, computed bottom-up because a\n * node declaring its audio knows its parents and not its index in a\n * walk. Stable across a rebuild for an unchanged tree, which is the property\n * both a bus id and a clip's request id need.\n */\nexport function structuralPathOf(node: Node): string {\n const parts: string[] = [];\n let current: Node | null = node;\n while (current) {\n const parent: Node | null = current.parent;\n if (!parent) break;\n parts.push(String(parent._allChildren.indexOf(current)));\n current = parent;\n }\n return parts.reverse().join(\".\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-audio.js","sourceRoot":"","sources":["../../../src/nodes/audio/node-audio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMzF,OAAO,EAAE,IAAI,EAAuD,MAAM,mBAAmB,CAAC;AAe9F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,SAAqD,SAAQ,IAAO;IAC7E,IAAI,SAAS,KAAoB,OAAO,OAAO,CAAC,CAAC,CAAC;IAOlD,YAAY,KAA0B;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,oEAAoE;QACpE,uEAAuE;QACvE,4DAA4D;QAC5D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,8CAA8C;IAC9C,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAkB,EAAE,CAAC,CAAC,YAAY,SAAS,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,MAAM;QACN,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,OAAO,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACrF,CAAC;IAED;;;;;;;OAOG;IACM,YAAY,CAAC,EAAc,EAAE,QAAgB,EAAE,MAAuB;QAC3E,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;YAC9B,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GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAgB,IAAI,CAAC;IAChC,OAAO,OAAO,EAAE,CAAC;QACb,MAAM,MAAM,GAAgB,OAAO,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,MAAM;YAAE,MAAM;QACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { audioFiltersProperty, audioParamProperty } from \"@/attributes/properties/typed\";\r\nimport { type AudioFilter } from \"@/attributes/audio/filters/chain\";\r\nimport type { AudioFilterItem } from \"@/attributes/audio/filters/union\";\r\nimport type { Param } from \"@/attributes/audio/filters/curve\";\r\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\r\nimport type { AudioScope } from \"@/attributes/audio/schedule\";\r\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/nodes/node/node\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TweenStepper } from \"@/tween/stepper\";\r\n\r\nexport interface NodeAudioProps extends NodeProps {\r\n /** Linear gain. 1 leaves the signal alone, 0 silences it. */\r\n volume: Param;\r\n /** Stereo position: -1 hard left, 0 centre, +1 hard right. */\r\n pan: Param;\r\n /** Silence this node and, on a bus, everything under it. */\r\n mute: boolean;\r\n /** Filters applied in array order, index 0 closest to the source. */\r\n filters: AudioFilter;\r\n}\r\n\r\n/**\r\n * The third scene graph: things that make sound.\r\n *\r\n * Sibling to `Node2D` and `Node3D`, and thin for the same reason they are thick\r\n * — a node that makes sound has no box and no place in space, so it inherits the\r\n * tree, identity, props, commands, context and clock from {@link Node} and adds\r\n * only what every audible thing has: a level, a position in the stereo field, a\r\n * mute, and a filter chain.\r\n *\r\n * Two concrete kinds, and no more: `SoundNode` is a leaf that plays a file, and\r\n * `AudioBus` is a group that everything beneath it feeds. That is the whole\r\n * vocabulary of a mixer, and it is deliberately the same shape as the visual\r\n * trees — a group node and a drawing node — because the thing being described is\r\n * the same: what exists, and what is under what.\r\n *\r\n * ### Levels are curves, not tweens\r\n *\r\n * `volume` and `pan` are {@link Param}, so a fade is `AudioFilters`-style\r\n * automation (`fadeOut(1)`, `ramp(...)`) rather than a `to()`. That is not a\r\n * limitation being worked around, it is what the two mechanisms mean: a tween\r\n * writes a prop once per *frame*, while sound is scheduled once, ahead of\r\n * time, and then runs at 48 kHz. A per-frame write reaches the graph on the one\r\n * frame that built the request and never again — so a `to({ volume })` would\r\n * read as animated on the timeline and render flat. `_prepareStep` refuses it\r\n * instead.\r\n */\r\nexport class NodeAudio<P extends NodeAudioProps = NodeAudioProps> extends Node<P> {\r\n get dimension(): NodeDimension { return \"audio\"; }\r\n\r\n @audioParamProperty({ default: 1 }) declare volume: Param;\r\n @audioParamProperty({ default: 0 }) declare pan: Param;\r\n @property({ default: false }) declare mute: boolean;\r\n @audioFiltersProperty() declare filters: AudioFilter;\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n super(props);\r\n // Deferred to here rather than run by `super()`: a subclass's field\r\n // initializers only run once `super()` has returned, so applying props\r\n // any earlier would write into cells that do not exist yet.\r\n this.initProps(props);\r\n this.adoptChildrenProp(props);\r\n }\r\n\r\n /** This node's children in the audio tree. */\r\n get childrenAudio(): NodeAudio[] {\r\n return this._allChildren.filter((c): c is NodeAudio => c instanceof NodeAudio);\r\n }\r\n\r\n /**\r\n * This bus's identity in the platform's graph: one chain, which everything\r\n * under it feeds.\r\n *\r\n * The authored id, and the structural path for a bus built in code rather\r\n * than from a document row. Neither answer alone works, and being wrong is\r\n * silent either way — the string reaches `AssetManager.stableKey`, so one\r\n * that changes re-fetches and re-schedules every clip on the bus. A document\r\n * row's id is fixed for the document's life, while its child index moves as\r\n * `syncPresence` adds and removes siblings; a code-built bus has no authored\r\n * id, but its parent builds it in the same slot every time.\r\n *\r\n * @internal\r\n */\r\n get _busId(): string {\r\n const authored = this._props?.id;\r\n return `bus:${typeof authored === \"string\" ? authored : structuralPathOf(this)}`;\r\n }\r\n\r\n /**\r\n * Refuse a tween on a level, naming the curve that does work.\r\n *\r\n * Loud rather than silent because the failure is otherwise invisible: the\r\n * command runs its full duration, the timeline draws a bar, and the render\r\n * is at one flat level. See the class docblock for why the two mechanisms\r\n * cannot agree.\r\n */\r\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n for (const key of TWEEN_REFUSED) {\r\n if (!(key in to)) continue;\r\n throw new TypeError(\r\n `${this.className}: \"${key}\" cannot be tweened — an audio level is scheduled once, ` +\r\n `not written per frame, so a tween on it would render flat. Automate it with a ` +\r\n `curve instead: ${key}: fadeOut(1), or filters: AudioFilters.gain(ramp(1, 0, 1)).`,\r\n );\r\n }\r\n return super._prepareStep(to, duration, easing);\r\n }\r\n}\r\n\r\nconst TWEEN_REFUSED = [\"volume\", \"pan\"] as const;\r\n\r\n/**\r\n * The buses a node feeds, **source-adjacent first**.\r\n *\r\n * Walks up the audio ancestors only: the walk stops at the first non-audio\r\n * parent, which is the `Canvas2D` scene root, because a scene root is not a bus\r\n * — it has no level of its own and nothing to mix.\r\n */\r\nexport function busPathOf(node: NodeAudio, audio: AudioScope): AudioBusStop[] | undefined {\r\n const stops: AudioBusStop[] = [];\r\n let parent = node.parent;\r\n while (parent instanceof NodeAudio) {\r\n stops.push(stopOf(parent, audio));\r\n parent = parent.parent;\r\n }\r\n return stops.length > 0 ? stops : undefined;\r\n}\r\n\r\n/** {@link busPathOf}, with `bus` itself as the first stop. */\r\nexport function busPathTo(bus: NodeAudio, audio: AudioScope): AudioBusStop[] {\r\n return [stopOf(bus, audio), ...(busPathOf(bus, audio) ?? [])];\r\n}\r\n\r\n/**\r\n * The bus in `from`'s scene with node id `id`, or `null`.\r\n *\r\n * What lets something outside the audio tree feed a bus — a `Video`, whose audio\r\n * is welded to its picture and so cannot be parented under one. It names the bus\r\n * by the same id a `SoundNode` under that bus writes in its `parentId`, because\r\n * it is asking the same question: which bus. A `key` would be a second\r\n * vocabulary for it, and an optional one.\r\n */\r\nexport function findBusById(from: Node, id: string): NodeAudio | null {\r\n let root: Node = from;\r\n while (root.parent) root = root.parent;\r\n return searchBus(root, id);\r\n}\r\n\r\nfunction searchBus(node: Node, id: string): NodeAudio | null {\r\n if (node instanceof NodeAudio && node.id === id) return node;\r\n for (const child of node._allChildren) {\r\n const found = searchBus(child, id);\r\n if (found) return found;\r\n }\r\n return null;\r\n}\r\n\r\n/** One bus, flattened to the plain data a platform builds its chain from. */\r\nfunction stopOf(bus: NodeAudio, audio: AudioScope): AudioBusStop {\r\n const filters = bus.filters as unknown as AudioFilterItem[];\r\n const span = audio._spanOf(bus);\r\n return {\r\n id: bus._busId,\r\n volume: bus.volume,\r\n pan: bus.pan,\r\n mute: bus.mute,\r\n ...(filters.length > 0 ? { filters } : {}),\r\n startAt: span.start,\r\n endAt: span.end,\r\n };\r\n}\r\n\r\n/**\r\n * A node's child-index path from the root of its tree, joined with \".\".\r\n *\r\n * The same identity `nodePath` gives the runtime, computed bottom-up because a\r\n * node declaring its audio knows its parents and not its index in a\r\n * walk. Stable across a rebuild for an unchanged tree, which is the property\r\n * both a bus id and a clip's request id need.\r\n */\r\nexport function structuralPathOf(node: Node): string {\r\n const parts: string[] = [];\r\n let current: Node | null = node;\r\n while (current) {\r\n const parent: Node | null = current.parent;\r\n if (!parent) break;\r\n parts.push(String(parent._allChildren.indexOf(current)));\r\n current = parent;\r\n }\r\n return parts.reverse().join(\".\");\r\n}\r\n"]}
|
|
@@ -10,7 +10,7 @@ export interface SoundNodeProps extends NodeAudioProps {
|
|
|
10
10
|
trimEnd: number | undefined;
|
|
11
11
|
/** Repeat the trimmed clip until it is removed. */
|
|
12
12
|
loop: boolean;
|
|
13
|
-
/** Playback-rate multiplier. 2 plays twice as fast and occupies half the
|
|
13
|
+
/** Playback-rate multiplier. 2 plays twice as fast and occupies half the clip time. */
|
|
14
14
|
speed: number;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -33,7 +33,7 @@ export declare class SoundNode extends NodeAudio<SoundNodeProps> {
|
|
|
33
33
|
/**
|
|
34
34
|
* This clip's own filters, with its level and speed folded in: a `Curve`
|
|
35
35
|
* level has nowhere else to go, since `AudioRequest.volume` is a scalar, and a
|
|
36
|
-
* speed filter is what `
|
|
36
|
+
* speed filter is what `clipDurationFor` integrates to find the clip's length.
|
|
37
37
|
*/
|
|
38
38
|
private _filterChain;
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sound-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/audio/sound-node.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAa,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,WAAW,cAAe,SAAQ,cAAc;IAClD,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,mDAAmD;IACnD,IAAI,EAAE,OAAO,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"sound-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/audio/sound-node.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAa,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,WAAW,cAAe,SAAQ,cAAc;IAClD,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,mDAAmD;IACnD,IAAI,EAAE,OAAO,CAAC;IACd,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACE,SAAS,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IAEvC,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAY9C,0CAA0C;cACvB,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO;IAItD;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAUvB"}
|
|
@@ -26,7 +26,7 @@ export class SoundNode extends NodeAudio {
|
|
|
26
26
|
trimEnd: this.trimEnd,
|
|
27
27
|
loop: this.loop,
|
|
28
28
|
filters: this._filterChain(),
|
|
29
|
-
bus: busPathOf(this),
|
|
29
|
+
bus: busPathOf(this, audio),
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
/** A leaf: nothing routes into a clip. */
|
|
@@ -36,7 +36,7 @@ export class SoundNode extends NodeAudio {
|
|
|
36
36
|
/**
|
|
37
37
|
* This clip's own filters, with its level and speed folded in: a `Curve`
|
|
38
38
|
* level has nowhere else to go, since `AudioRequest.volume` is a scalar, and a
|
|
39
|
-
* speed filter is what `
|
|
39
|
+
* speed filter is what `clipDurationFor` integrates to find the clip's length.
|
|
40
40
|
*/
|
|
41
41
|
_filterChain() {
|
|
42
42
|
const own = this.filters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sound-node.js","sourceRoot":"","sources":["../../../src/nodes/audio/sound-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAc,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAezE;;;;;;;GAOG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAyB;IAO3C,YAAY,CAAC,KAAiB;QACnC,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,OAAO;QACtB,KAAK,CAAC,IAAI,CAAC;YACP,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE;YAC5B,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"sound-node.js","sourceRoot":"","sources":["../../../src/nodes/audio/sound-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAc,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAezE;;;;;;;GAOG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAyB;IAO3C,YAAY,CAAC,KAAiB;QACnC,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,OAAO;QACtB,KAAK,CAAC,IAAI,CAAC;YACP,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE;YAC5B,GAAG,EAAE,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC;SAC9B,CAAC,CAAC;IACP,CAAC;IAED,0CAA0C;IACvB,YAAY,CAAC,MAAY;QACxC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACK,YAAY;QAChB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAuC,CAAC;QACzD,MAAM,KAAK,GAAsB,CAAC,GAAG,GAAG,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAe,CAAC;QACpC,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC7D,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACpE,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAtCuB;IAAnB,QAAQ,EAAE;sCAAqB;AACE;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;4CAA2B;AACV;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;0CAAqC;AAChC;IAArC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;uCAAuB;AAClB;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;wCAAuB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { AudioFilters } from \"@/attributes/audio/filters/chain\";\r\nimport type { AudioFilterItem } from \"@/attributes/audio/filters/union\";\r\nimport { staticValue, type Param } from \"@/attributes/audio/filters/curve\";\r\nimport type { AudioScope } from \"@/attributes/audio/schedule\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport { busPathOf, NodeAudio, type NodeAudioProps } from \"./node-audio\";\r\n\r\nexport interface SoundNodeProps extends NodeAudioProps {\r\n /** Path/URL of the audio (or video) asset. Must exist in the asset manifest. */\r\n src: string;\r\n /** In-point inside the source file, in seconds. Defaults to 0. */\r\n trimStart: number;\r\n /** Out-point inside the source file. Defaults to the source's full length. */\r\n trimEnd: number | undefined;\r\n /** Repeat the trimmed clip until it is removed. */\r\n loop: boolean;\r\n /** Playback-rate multiplier. 2 plays twice as fast and occupies half the clip time. */\r\n speed: number;\r\n}\r\n\r\n/**\r\n * A leaf in the audio tree: one clip of one file.\r\n *\r\n * **When it plays is its presence span.** Its row's `startAt` starts it and its\r\n * `endAt` cuts it — no `startAt` prop, no `play` command, nothing to keep in sync\r\n * with the row a timeline draws. `trimStart`/`trimEnd` are the other half:\r\n * presence says *when on the timeline*, the trim says *what part of the file*.\r\n */\r\nexport class SoundNode extends NodeAudio<SoundNodeProps> {\r\n @property() declare src: string;\r\n @property({ default: 0 }) declare trimStart: number;\r\n @property({ default: undefined }) declare trimEnd: number | undefined;\r\n @property({ default: false }) declare loop: boolean;\r\n @property({ default: 1 }) declare speed: number;\r\n\r\n override declareAudio(audio: AudioScope): void {\r\n if (!this.src) return;\r\n audio.clip({\r\n src: this.src,\r\n trimStart: this.trimStart,\r\n trimEnd: this.trimEnd,\r\n loop: this.loop,\r\n filters: this._filterChain(),\r\n bus: busPathOf(this, audio),\r\n });\r\n }\r\n\r\n /** A leaf: nothing routes into a clip. */\r\n protected override acceptsChild(_child: Node): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * This clip's own filters, with its level and speed folded in: a `Curve`\r\n * level has nowhere else to go, since `AudioRequest.volume` is a scalar, and a\r\n * speed filter is what `clipDurationFor` integrates to find the clip's length.\r\n */\r\n private _filterChain(): AudioFilterItem[] {\r\n const own = this.filters as unknown as AudioFilterItem[];\r\n const chain: AudioFilterItem[] = [...own];\r\n const volume = this.volume as Param;\r\n if (staticValue(volume, 1) !== 1 || typeof volume !== \"number\") {\r\n chain.push(...AudioFilters.gain(volume));\r\n }\r\n if (this.speed !== 1) chain.push(...AudioFilters.speed(this.speed));\r\n return chain;\r\n }\r\n}\r\n"]}
|
|
@@ -7,7 +7,7 @@ import { type PathCommand } from "../../render/descriptors/path.js";
|
|
|
7
7
|
import { type ShapeOutlineKind, type ShapeOutlineOptions } from "./shape-outline.js";
|
|
8
8
|
/**
|
|
9
9
|
* The named shapes — a triangle, a right triangle, a pentagon, a hexagon, an
|
|
10
|
-
* octagon, a star — as
|
|
10
|
+
* octagon, a star — as engine nodes.
|
|
11
11
|
*
|
|
12
12
|
* ## Why they aren't just a Polygon with `sides` set
|
|
13
13
|
*
|
|
@@ -22,7 +22,7 @@ import { type ShapeOutlineKind, type ShapeOutlineOptions } from "./shape-outline
|
|
|
22
22
|
* ## Why they're paths rather than polygons
|
|
23
23
|
*
|
|
24
24
|
* The silhouette is handed to the renderer as a `path` op rather than a
|
|
25
|
-
* `polygon` one, which is what lets corner rounding be *ours*:
|
|
25
|
+
* `polygon` one, which is what lets corner rounding be *ours*: the engine's
|
|
26
26
|
* polygon geometry rounds the inscribed figure, and rounding a stretched one is
|
|
27
27
|
* a different arc at every vertex. Drawing the outline ourselves also means the
|
|
28
28
|
* shape a user is looking at and the shape they get when they start editing its
|
|
@@ -73,7 +73,7 @@ export declare abstract class BoundsShape<P extends BoundsShapeProps = BoundsSha
|
|
|
73
73
|
/**
|
|
74
74
|
* The node's **box**, not its silhouette.
|
|
75
75
|
*
|
|
76
|
-
* `clipSelf` answers two questions at once in
|
|
76
|
+
* `clipSelf` answers two questions at once in the engine: what `clip: true`
|
|
77
77
|
* confines children to, and — through `ShapeNode.hitTestSelf` — what a click
|
|
78
78
|
* has to land inside to pick this node. Answering both with the box is a
|
|
79
79
|
* deliberate choice, and it goes against what a shape node normally does.
|
|
@@ -87,7 +87,7 @@ export declare abstract class BoundsShape<P extends BoundsShapeProps = BoundsSha
|
|
|
87
87
|
* empty is a fact about the drawing, not about what you meant.
|
|
88
88
|
*
|
|
89
89
|
* It is also the only answer that *works*. A `path` clip op has no winding
|
|
90
|
-
* test in
|
|
90
|
+
* test in the engine — `containsShape` falls back to the op's declared
|
|
91
91
|
* `width`/`height`, which a path state doesn't carry — so declaring the
|
|
92
92
|
* silhouette here would make these nodes impossible to click at all.
|
|
93
93
|
*/
|
|
@@ -60,7 +60,7 @@ export class BoundsShape extends ShapeNode {
|
|
|
60
60
|
/**
|
|
61
61
|
* The node's **box**, not its silhouette.
|
|
62
62
|
*
|
|
63
|
-
* `clipSelf` answers two questions at once in
|
|
63
|
+
* `clipSelf` answers two questions at once in the engine: what `clip: true`
|
|
64
64
|
* confines children to, and — through `ShapeNode.hitTestSelf` — what a click
|
|
65
65
|
* has to land inside to pick this node. Answering both with the box is a
|
|
66
66
|
* deliberate choice, and it goes against what a shape node normally does.
|
|
@@ -74,7 +74,7 @@ export class BoundsShape extends ShapeNode {
|
|
|
74
74
|
* empty is a fact about the drawing, not about what you meant.
|
|
75
75
|
*
|
|
76
76
|
* It is also the only answer that *works*. A `path` clip op has no winding
|
|
77
|
-
* test in
|
|
77
|
+
* test in the engine — `containsShape` falls back to the op's declared
|
|
78
78
|
* `width`/`height`, which a path state doesn't carry — so declaring the
|
|
79
79
|
* silhouette here would make these nodes impossible to click at all.
|
|
80
80
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounds-shape-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/bounds-shape-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE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C;CACF;AAED,2FAA2F;AAC3F,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC,YAAY,KAA4C;QACtD,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;IACS,IAAI;QACZ,OAAO,SAAS,CAAA;IAClB,CAAC;CACF;AASD;;;;;;;GAOG;AACH,MAAM,OAAO,IAAK,SAAQ,WAAsB;IAO9C,YAAY,KAAkC;QAC5C,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;IAES,IAAI;QACZ,OAAO,MAAM,CAAA;IACf,CAAC;IAEkB,cAAc;QAC/B,OAAO;YACL,GAAG,KAAK,CAAC,cAAc,EAAE;YACzB,yEAAyE;YACzE,qEAAqE;YACrE,sEAAsE;YACtE,uCAAuC;YACvC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3C,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAA;IACH,CAAC;CACF;AAxBS;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;oCACrB;AAGd;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;mCACrB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { ShapeNode, type ShapeProps } from \"./shape-node\";\nimport { type NodeConfig } from \"@/nodes/2d/node2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\nimport { type CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { lerpCornerScalarStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { type PathBounds, type PathCommand } from \"@/render/descriptors/path\";\n\nimport {\n shapeOutlinePixels,\n STAR_DEFAULT_POINTS,\n STAR_DEFAULT_RATIO,\n type ShapeOutlineKind,\n type ShapeOutlineOptions,\n} from \"./shape-outline\";\nimport { pathOps } from \"@/attributes/shape/path/ops\";\n\n/**\n * The named shapes — a triangle, a right triangle, a pentagon, a hexagon, an\n * octagon, a star — as motion-script nodes.\n *\n * ## Why they aren't just a Polygon with `sides` set\n *\n * A `Polygon` inscribes its n-gon in the node's box, so a three-sided one leaves\n * a visible gap under its base (see `./shape-outline` for the full reason,\n * which is a good one: it's what makes a `sides` tween smooth). These fill the\n * box instead. The two behaviours can't be one node with a switch, because\n * \"which shape is this\" is the sort of thing a scene's author picks once and a\n * reader of the layers panel needs to see at a glance — so each is a type of its\n * own, named for what it draws.\n *\n * ## Why they're paths rather than polygons\n *\n * The silhouette is handed to the renderer as a `path` op rather than a\n * `polygon` one, which is what lets corner rounding be *ours*: motion-script's\n * polygon geometry rounds the inscribed figure, and rounding a stretched one is\n * a different arc at every vertex. Drawing the outline ourselves also means the\n * shape a user is looking at and the shape they get when they start editing its\n * points are built by the same function, so converting to a Path node changes\n * nothing on screen.\n *\n * The outline is rebuilt per draw rather than cached against the box. It is a\n * handful of trig per vertex on a shape with at most ten of them, and the\n * alternative — a cache keyed on width, height, radius, style and the two\n * parametric fields — costs more to keep honest than it saves.\n */\nexport interface BoundsShapeProps extends ShapeProps {\n /** Vertex rounding radius in pixels. */\n cornerRadius: number\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle\n}\n\nexport abstract class BoundsShape<\n P extends BoundsShapeProps = BoundsShapeProps,\n> extends ShapeNode<P> {\n @property({ default: 0 })\n declare cornerRadius: number\n\n @property({ default: \"rounded\", tween: lerpCornerScalarStyle })\n declare cornerStyle: CornerStyle\n\n /** Which outline this class draws — the one thing each subclass declares. */\n protected abstract kind(): ShapeOutlineKind\n\n /**\n * The parametric fields this shape's outline reads, beyond the box and the\n * corner treatment every one of them has. Only the star overrides it.\n */\n protected outlineOptions(): ShapeOutlineOptions {\n return {\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n }\n }\n\n /**\n * The silhouette, in the renderer's local space.\n *\n * `shapeOutlinePixels` works y-**down** (the convention a stored `d` string\n * uses, so that the editor and the file agree), and a node's own space is\n * y-up — hence the flip, which is the whole of the difference between the two.\n */\n protected outline(): PathCommand[] {\n return pathOps.anchorCommands(\n shapeOutlinePixels(this.kind(), this.outlineOptions()),\n (p: { x: number; y: number }) => ({ x: p.x, y: -p.y })\n )\n }\n\n /**\n * The frame the path is centred against: the node's own box.\n *\n * Stated rather than left to the descriptor's default, which centres a path on\n * *its own* bounding box. That default is right for a path whose coordinates\n * mean nothing in particular and wrong here: a shape that has been trimmed\n * (`start`/`end`) or whose corners have eaten into its extent would shift\n * inside its box as those values change, which reads as the node sliding\n * around while you drag a radius handle.\n */\n private centerBounds(): PathBounds {\n const w = this.layoutBounds.width / 2\n const h = this.layoutBounds.height / 2\n return [-w, -h, w, h]\n }\n\n protected override shapeGraphics(): Graphics2D {\n return new Graphics2D().path({\n data: this.outline(),\n centerBounds: this.centerBounds(),\n start: this.start,\n end: this.end,\n })\n }\n\n /**\n * The node's **box**, not its silhouette.\n *\n * `clipSelf` answers two questions at once in motion-script: what `clip: true`\n * confines children to, and — through `ShapeNode.hitTestSelf` — what a click\n * has to land inside to pick this node. Answering both with the box is a\n * deliberate choice, and it goes against what a shape node normally does.\n *\n * The reason is that outline-precise picking is *worse* on these shapes than\n * on a rect. A star's bounding box is mostly not star, so a click a few pixels\n * off a point selects whatever is behind it and the node you were aiming at\n * stays untouched — which reads as the app ignoring you rather than as a\n * near-miss. The selection box is the thing on screen that says \"this is the\n * node\", so it is what you should be able to click; that a corner of it is\n * empty is a fact about the drawing, not about what you meant.\n *\n * It is also the only answer that *works*. A `path` clip op has no winding\n * test in motion-script — `containsShape` falls back to the op's declared\n * `width`/`height`, which a path state doesn't carry — so declaring the\n * silhouette here would make these nodes impossible to click at all.\n */\n protected override clipSelf(): Clip {\n return new Clip().rect({\n x: 0,\n y: 0,\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n })\n }\n}\n\n/** An isosceles triangle: apex centred on the top edge, base on the bottom one. */\nexport class Triangle extends BoundsShape {\n constructor(props: NodeConfig<Triangle, BoundsShapeProps>) {\n super(props)\n }\n protected kind(): ShapeOutlineKind {\n return \"triangle\"\n }\n}\n\n/**\n * A right triangle with its square corner at the bottom left.\n *\n * One orientation rather than a `corner` prop, because the other three are a\n * rotation or a flip away and the node already has both — a `scale` of −1 and a\n * `rotation` of 90° are how every editor produces the other three, and a fourth\n * control that duplicates them is a control that can disagree with them.\n */\nexport class RightTriangle extends BoundsShape {\n constructor(props: NodeConfig<RightTriangle, BoundsShapeProps>) {\n super(props)\n }\n protected kind(): ShapeOutlineKind {\n return \"rightTriangle\"\n }\n}\n\n/** A regular pentagon, point up, stretched to its box. */\nexport class Pentagon extends BoundsShape {\n constructor(props: NodeConfig<Pentagon, BoundsShapeProps>) {\n super(props)\n }\n protected kind(): ShapeOutlineKind {\n return \"pentagon\"\n }\n}\n\n/** A regular hexagon, point up, stretched to its box. */\nexport class Hexagon extends BoundsShape {\n constructor(props: NodeConfig<Hexagon, BoundsShapeProps>) {\n super(props)\n }\n protected kind(): ShapeOutlineKind {\n return \"hexagon\"\n }\n}\n\n/** A regular octagon, flat top — the stop sign, which is the only one anybody pictures. */\nexport class Octagon extends BoundsShape {\n constructor(props: NodeConfig<Octagon, BoundsShapeProps>) {\n super(props)\n }\n protected kind(): ShapeOutlineKind {\n return \"octagon\"\n }\n}\n\nexport interface StarProps extends BoundsShapeProps {\n /** How many points the star has. */\n points: number\n /** Inner radius as a fraction of the outer one — how deep the points cut. */\n ratio: number\n}\n\n/**\n * A star, stretched to its box.\n *\n * `points` rather than `sides`, which is the polygram's word for the same\n * number and means something different to a reader: a five-pointed star has ten\n * sides, and an inspector row reading \"Sides 5\" over a shape with ten of them is\n * the sort of small lie that costs somebody ten minutes.\n */\nexport class Star extends BoundsShape<StarProps> {\n @property({ default: STAR_DEFAULT_POINTS })\n declare points: number\n\n @property({ default: STAR_DEFAULT_RATIO })\n declare ratio: number\n\n constructor(props: NodeConfig<Star, StarProps>) {\n super(props)\n }\n\n protected kind(): ShapeOutlineKind {\n return \"star\"\n }\n\n protected override outlineOptions(): ShapeOutlineOptions {\n return {\n ...super.outlineOptions(),\n // A `to` command lerps the count like any other number, so it is rounded\n // (and floored at three) on the way to the geometry — the same thing\n // `appearanceToMotion` does for a polygon's `sides`, and for the same\n // reason: half a point is not a shape.\n sides: Math.max(3, Math.round(this.points)),\n ratio: this.ratio,\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bounds-shape-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/bounds-shape-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAGhF,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,GAGnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAsCtD,MAAM,OAAgB,WAEpB,SAAQ,SAAY;IAUpB;;;OAGG;IACO,cAAc;QACtB,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACO,OAAO;QACf,OAAO,OAAO,CAAC,cAAc,CAC3B,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,EACtD,CAAC,CAA2B,E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B,EAAE,CAAC;oCACrB;AAGd;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;mCACrB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { ShapeNode, type ShapeProps } from \"./shape-node\";\r\nimport { type NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\nimport { type CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { lerpCornerScalarStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { type PathBounds, type PathCommand } from \"@/render/descriptors/path\";\r\n\r\nimport {\r\n shapeOutlinePixels,\r\n STAR_DEFAULT_POINTS,\r\n STAR_DEFAULT_RATIO,\r\n type ShapeOutlineKind,\r\n type ShapeOutlineOptions,\r\n} from \"./shape-outline\";\r\nimport { pathOps } from \"@/attributes/shape/path/ops\";\r\n\r\n/**\r\n * The named shapes — a triangle, a right triangle, a pentagon, a hexagon, an\r\n * octagon, a star — as engine nodes.\r\n *\r\n * ## Why they aren't just a Polygon with `sides` set\r\n *\r\n * A `Polygon` inscribes its n-gon in the node's box, so a three-sided one leaves\r\n * a visible gap under its base (see `./shape-outline` for the full reason,\r\n * which is a good one: it's what makes a `sides` tween smooth). These fill the\r\n * box instead. The two behaviours can't be one node with a switch, because\r\n * \"which shape is this\" is the sort of thing a scene's author picks once and a\r\n * reader of the layers panel needs to see at a glance — so each is a type of its\r\n * own, named for what it draws.\r\n *\r\n * ## Why they're paths rather than polygons\r\n *\r\n * The silhouette is handed to the renderer as a `path` op rather than a\r\n * `polygon` one, which is what lets corner rounding be *ours*: the engine's\r\n * polygon geometry rounds the inscribed figure, and rounding a stretched one is\r\n * a different arc at every vertex. Drawing the outline ourselves also means the\r\n * shape a user is looking at and the shape they get when they start editing its\r\n * points are built by the same function, so converting to a Path node changes\r\n * nothing on screen.\r\n *\r\n * The outline is rebuilt per draw rather than cached against the box. It is a\r\n * handful of trig per vertex on a shape with at most ten of them, and the\r\n * alternative — a cache keyed on width, height, radius, style and the two\r\n * parametric fields — costs more to keep honest than it saves.\r\n */\r\nexport interface BoundsShapeProps extends ShapeProps {\r\n /** Vertex rounding radius in pixels. */\r\n cornerRadius: number\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle\r\n}\r\n\r\nexport abstract class BoundsShape<\r\n P extends BoundsShapeProps = BoundsShapeProps,\r\n> extends ShapeNode<P> {\r\n @property({ default: 0 })\r\n declare cornerRadius: number\r\n\r\n @property({ default: \"rounded\", tween: lerpCornerScalarStyle })\r\n declare cornerStyle: CornerStyle\r\n\r\n /** Which outline this class draws — the one thing each subclass declares. */\r\n protected abstract kind(): ShapeOutlineKind\r\n\r\n /**\r\n * The parametric fields this shape's outline reads, beyond the box and the\r\n * corner treatment every one of them has. Only the star overrides it.\r\n */\r\n protected outlineOptions(): ShapeOutlineOptions {\r\n return {\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n }\r\n }\r\n\r\n /**\r\n * The silhouette, in the renderer's local space.\r\n *\r\n * `shapeOutlinePixels` works y-**down** (the convention a stored `d` string\r\n * uses, so that the editor and the file agree), and a node's own space is\r\n * y-up — hence the flip, which is the whole of the difference between the two.\r\n */\r\n protected outline(): PathCommand[] {\r\n return pathOps.anchorCommands(\r\n shapeOutlinePixels(this.kind(), this.outlineOptions()),\r\n (p: { x: number; y: number }) => ({ x: p.x, y: -p.y })\r\n )\r\n }\r\n\r\n /**\r\n * The frame the path is centred against: the node's own box.\r\n *\r\n * Stated rather than left to the descriptor's default, which centres a path on\r\n * *its own* bounding box. That default is right for a path whose coordinates\r\n * mean nothing in particular and wrong here: a shape that has been trimmed\r\n * (`start`/`end`) or whose corners have eaten into its extent would shift\r\n * inside its box as those values change, which reads as the node sliding\r\n * around while you drag a radius handle.\r\n */\r\n private centerBounds(): PathBounds {\r\n const w = this.layoutBounds.width / 2\r\n const h = this.layoutBounds.height / 2\r\n return [-w, -h, w, h]\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n return new Graphics2D().path({\r\n data: this.outline(),\r\n centerBounds: this.centerBounds(),\r\n start: this.start,\r\n end: this.end,\r\n })\r\n }\r\n\r\n /**\r\n * The node's **box**, not its silhouette.\r\n *\r\n * `clipSelf` answers two questions at once in the engine: what `clip: true`\r\n * confines children to, and — through `ShapeNode.hitTestSelf` — what a click\r\n * has to land inside to pick this node. Answering both with the box is a\r\n * deliberate choice, and it goes against what a shape node normally does.\r\n *\r\n * The reason is that outline-precise picking is *worse* on these shapes than\r\n * on a rect. A star's bounding box is mostly not star, so a click a few pixels\r\n * off a point selects whatever is behind it and the node you were aiming at\r\n * stays untouched — which reads as the app ignoring you rather than as a\r\n * near-miss. The selection box is the thing on screen that says \"this is the\r\n * node\", so it is what you should be able to click; that a corner of it is\r\n * empty is a fact about the drawing, not about what you meant.\r\n *\r\n * It is also the only answer that *works*. A `path` clip op has no winding\r\n * test in the engine — `containsShape` falls back to the op's declared\r\n * `width`/`height`, which a path state doesn't carry — so declaring the\r\n * silhouette here would make these nodes impossible to click at all.\r\n */\r\n protected override clipSelf(): Clip {\r\n return new Clip().rect({\r\n x: 0,\r\n y: 0,\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n })\r\n }\r\n}\r\n\r\n/** An isosceles triangle: apex centred on the top edge, base on the bottom one. */\r\nexport class Triangle extends BoundsShape {\r\n constructor(props: NodeConfig<Triangle, BoundsShapeProps>) {\r\n super(props)\r\n }\r\n protected kind(): ShapeOutlineKind {\r\n return \"triangle\"\r\n }\r\n}\r\n\r\n/**\r\n * A right triangle with its square corner at the bottom left.\r\n *\r\n * One orientation rather than a `corner` prop, because the other three are a\r\n * rotation or a flip away and the node already has both — a `scale` of −1 and a\r\n * `rotation` of 90° are how every editor produces the other three, and a fourth\r\n * control that duplicates them is a control that can disagree with them.\r\n */\r\nexport class RightTriangle extends BoundsShape {\r\n constructor(props: NodeConfig<RightTriangle, BoundsShapeProps>) {\r\n super(props)\r\n }\r\n protected kind(): ShapeOutlineKind {\r\n return \"rightTriangle\"\r\n }\r\n}\r\n\r\n/** A regular pentagon, point up, stretched to its box. */\r\nexport class Pentagon extends BoundsShape {\r\n constructor(props: NodeConfig<Pentagon, BoundsShapeProps>) {\r\n super(props)\r\n }\r\n protected kind(): ShapeOutlineKind {\r\n return \"pentagon\"\r\n }\r\n}\r\n\r\n/** A regular hexagon, point up, stretched to its box. */\r\nexport class Hexagon extends BoundsShape {\r\n constructor(props: NodeConfig<Hexagon, BoundsShapeProps>) {\r\n super(props)\r\n }\r\n protected kind(): ShapeOutlineKind {\r\n return \"hexagon\"\r\n }\r\n}\r\n\r\n/** A regular octagon, flat top — the stop sign, which is the only one anybody pictures. */\r\nexport class Octagon extends BoundsShape {\r\n constructor(props: NodeConfig<Octagon, BoundsShapeProps>) {\r\n super(props)\r\n }\r\n protected kind(): ShapeOutlineKind {\r\n return \"octagon\"\r\n }\r\n}\r\n\r\nexport interface StarProps extends BoundsShapeProps {\r\n /** How many points the star has. */\r\n points: number\r\n /** Inner radius as a fraction of the outer one — how deep the points cut. */\r\n ratio: number\r\n}\r\n\r\n/**\r\n * A star, stretched to its box.\r\n *\r\n * `points` rather than `sides`, which is the polygram's word for the same\r\n * number and means something different to a reader: a five-pointed star has ten\r\n * sides, and an inspector row reading \"Sides 5\" over a shape with ten of them is\r\n * the sort of small lie that costs somebody ten minutes.\r\n */\r\nexport class Star extends BoundsShape<StarProps> {\r\n @property({ default: STAR_DEFAULT_POINTS })\r\n declare points: number\r\n\r\n @property({ default: STAR_DEFAULT_RATIO })\r\n declare ratio: number\r\n\r\n constructor(props: NodeConfig<Star, StarProps>) {\r\n super(props)\r\n }\r\n\r\n protected kind(): ShapeOutlineKind {\r\n return \"star\"\r\n }\r\n\r\n protected override outlineOptions(): ShapeOutlineOptions {\r\n return {\r\n ...super.outlineOptions(),\r\n // A `to` command lerps the count like any other number, so it is rounded\r\n // (and floored at three) on the way to the geometry — the same thing\r\n // `appearanceToMotion` does for a polygon's `sides`, and for the same\r\n // reason: half a point is not a shape.\r\n sides: Math.max(3, Math.round(this.points)),\r\n ratio: this.ratio,\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -6,7 +6,7 @@ import { type PathData } from "../../render/descriptors/path.js";
|
|
|
6
6
|
export interface PathShapeProps extends ShapeProps {
|
|
7
7
|
/**
|
|
8
8
|
* The geometry, as an SVG `d` string in the node's **unit box** — see
|
|
9
|
-
*
|
|
9
|
+
* {@link PathData}.
|
|
10
10
|
*/
|
|
11
11
|
data: PathData;
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ export interface PathShapeProps extends ShapeProps {
|
|
|
14
14
|
* The editable Path node: arbitrary vector geometry, drawn as a fraction of the
|
|
15
15
|
* node's own box.
|
|
16
16
|
*
|
|
17
|
-
* ## Why not
|
|
17
|
+
* ## Why not `Path`
|
|
18
18
|
*
|
|
19
19
|
* That class draws its `data` at face value and hugs the result, which is
|
|
20
20
|
* exactly right for a path somebody wrote in code and wrong for one somebody
|
|
@@ -79,7 +79,7 @@ export declare class PathShape extends ShapeNode<PathShapeProps> {
|
|
|
79
79
|
* A path is arbitrary: it can be a thin stroke, a scatter of subpaths, or
|
|
80
80
|
* geometry that has been dragged clean outside its own frame. There is no
|
|
81
81
|
* version of outline-precise picking that makes a shape like that reliably
|
|
82
|
-
* clickable, and
|
|
82
|
+
* clickable, and the engine has no winding test for a `path` clip anyway,
|
|
83
83
|
* so declaring one would leave the node unclickable rather than merely fussy.
|
|
84
84
|
* The selection box is what says "this node is here", so it is what a click
|
|
85
85
|
* lands on and what `clip: true` confines children to.
|
|
@@ -13,7 +13,7 @@ import { pathOps } from "../../attributes/shape/path/ops.js";
|
|
|
13
13
|
* The editable Path node: arbitrary vector geometry, drawn as a fraction of the
|
|
14
14
|
* node's own box.
|
|
15
15
|
*
|
|
16
|
-
* ## Why not
|
|
16
|
+
* ## Why not `Path`
|
|
17
17
|
*
|
|
18
18
|
* That class draws its `data` at face value and hugs the result, which is
|
|
19
19
|
* exactly right for a path somebody wrote in code and wrong for one somebody
|
|
@@ -96,7 +96,7 @@ export class PathShape extends ShapeNode {
|
|
|
96
96
|
* A path is arbitrary: it can be a thin stroke, a scatter of subpaths, or
|
|
97
97
|
* geometry that has been dragged clean outside its own frame. There is no
|
|
98
98
|
* version of outline-precise picking that makes a shape like that reliably
|
|
99
|
-
* clickable, and
|
|
99
|
+
* clickable, and the engine has no winding test for a `path` clip anyway,
|
|
100
100
|
* so declaring one would leave the node unclickable rather than merely fussy.
|
|
101
101
|
* The selection box is what says "this node is here", so it is what a click
|
|
102
102
|
* lands on and what `clip: true` confines children to.
|