af-motion 0.0.0-stage → 1.0.0
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 +33 -0
- package/LICENSE +201 -0
- package/README.md +203 -3
- package/RELEASE_NOTES.md +115 -0
- package/bin/af-motion.js +16 -0
- package/bin/mcp-server.js +21 -0
- package/dist/3d/adapter.d.ts +29 -0
- package/dist/3d/assets/cache.d.ts +71 -0
- package/dist/3d/assets/index.d.ts +10 -0
- package/dist/3d/assets/inspection.d.ts +19 -0
- package/dist/3d/assets/loaders.d.ts +30 -0
- package/dist/3d/assets/manager.d.ts +69 -0
- package/dist/3d/assets/scene-integration.d.ts +23 -0
- package/dist/3d/assets/types.d.ts +80 -0
- package/dist/3d/assets/validation.d.ts +12 -0
- package/dist/3d/camera/index.d.ts +7 -0
- package/dist/3d/camera/presets.d.ts +8 -0
- package/dist/3d/camera/transitions.d.ts +19 -0
- package/dist/3d/camera/types.d.ts +37 -0
- package/dist/3d/camera/validation.d.ts +9 -0
- package/dist/3d/capabilities.d.ts +11 -0
- package/dist/3d/composition/fallback.d.ts +20 -0
- package/dist/3d/composition/generation.d.ts +24 -0
- package/dist/3d/composition/index.d.ts +12 -0
- package/dist/3d/composition/quality.d.ts +35 -0
- package/dist/3d/composition/recipes.d.ts +34 -0
- package/dist/3d/composition/types.d.ts +88 -0
- package/dist/3d/composition/unified.d.ts +18 -0
- package/dist/3d/environment/index.d.ts +6 -0
- package/dist/3d/environment/presets.d.ts +8 -0
- package/dist/3d/environment/types.d.ts +36 -0
- package/dist/3d/environment/validation.d.ts +9 -0
- package/dist/3d/geometry/cache.d.ts +37 -0
- package/dist/3d/geometry/generators.d.ts +24 -0
- package/dist/3d/geometry/hash.d.ts +10 -0
- package/dist/3d/geometry/index.d.ts +9 -0
- package/dist/3d/geometry/three-adapter.d.ts +15 -0
- package/dist/3d/geometry/types.d.ts +120 -0
- package/dist/3d/geometry/validation.d.ts +6 -0
- package/dist/3d/index.d.ts +32 -0
- package/dist/3d/interaction/camera-controls.d.ts +58 -0
- package/dist/3d/interaction/index.d.ts +8 -0
- package/dist/3d/interaction/manager.d.ts +61 -0
- package/dist/3d/interaction/presets.d.ts +9 -0
- package/dist/3d/interaction/raycaster.d.ts +20 -0
- package/dist/3d/interaction/types.d.ts +78 -0
- package/dist/3d/lighting/index.d.ts +6 -0
- package/dist/3d/lighting/presets.d.ts +8 -0
- package/dist/3d/lighting/types.d.ts +31 -0
- package/dist/3d/lighting/validation.d.ts +17 -0
- package/dist/3d/materials/bridge.d.ts +11 -0
- package/dist/3d/materials/index.d.ts +7 -0
- package/dist/3d/materials/presets.d.ts +9 -0
- package/dist/3d/materials/types.d.ts +43 -0
- package/dist/3d/materials/validation.d.ts +9 -0
- package/dist/3d/morphing/animator.d.ts +19 -0
- package/dist/3d/morphing/correspondence.d.ts +32 -0
- package/dist/3d/morphing/geometry.d.ts +28 -0
- package/dist/3d/morphing/index.d.ts +16 -0
- package/dist/3d/morphing/interpolation.d.ts +45 -0
- package/dist/3d/morphing/morph.d.ts +18 -0
- package/dist/3d/morphing/presets.d.ts +31 -0
- package/dist/3d/morphing/react.d.ts +29 -0
- package/dist/3d/morphing/topology.d.ts +34 -0
- package/dist/3d/morphing/types.d.ts +138 -0
- package/dist/3d/morphing/validation.d.ts +19 -0
- package/dist/3d/optimization/analysis.d.ts +14 -0
- package/dist/3d/optimization/colliders.d.ts +16 -0
- package/dist/3d/optimization/geometry.d.ts +22 -0
- package/dist/3d/optimization/hierarchy.d.ts +14 -0
- package/dist/3d/optimization/index.d.ts +33 -0
- package/dist/3d/optimization/lod.d.ts +13 -0
- package/dist/3d/optimization/materials.d.ts +12 -0
- package/dist/3d/optimization/recommendations.d.ts +13 -0
- package/dist/3d/optimization/skeleton.d.ts +20 -0
- package/dist/3d/optimization/types.d.ts +252 -0
- package/dist/3d/physics/benchmark.d.ts +76 -0
- package/dist/3d/physics/body/inertia.d.ts +61 -0
- package/dist/3d/physics/collision/ccd.d.ts +26 -0
- package/dist/3d/physics/collision/narrowphase.d.ts +15 -0
- package/dist/3d/physics/collision/shapes.d.ts +45 -0
- package/dist/3d/physics/constraints/advanced.d.ts +40 -0
- package/dist/3d/physics/constraints/solver.d.ts +34 -0
- package/dist/3d/physics/constraints/types.d.ts +106 -0
- package/dist/3d/physics/events.d.ts +34 -0
- package/dist/3d/physics/index.d.ts +29 -0
- package/dist/3d/physics/material.d.ts +27 -0
- package/dist/3d/physics/math.d.ts +79 -0
- package/dist/3d/physics/soft/cloth.d.ts +12 -0
- package/dist/3d/physics/soft/collision.d.ts +12 -0
- package/dist/3d/physics/soft/gpu.d.ts +19 -0
- package/dist/3d/physics/soft/pbd.d.ts +20 -0
- package/dist/3d/physics/soft/rope.d.ts +16 -0
- package/dist/3d/physics/soft/soft-body.d.ts +12 -0
- package/dist/3d/physics/soft/types.d.ts +212 -0
- package/dist/3d/physics/solver/integrators.d.ts +25 -0
- package/dist/3d/physics/solver/types.d.ts +28 -0
- package/dist/3d/physics/spatial/spatial-hash.d.ts +51 -0
- package/dist/3d/physics/types.d.ts +579 -0
- package/dist/3d/physics/world.d.ts +106 -0
- package/dist/3d/r3f.d.ts +34 -0
- package/dist/3d/scene.d.ts +8 -0
- package/dist/3d/schema.d.ts +739 -0
- package/dist/3d/schemas/ai-integration.d.ts +201 -0
- package/dist/3d/schemas/correction.d.ts +11 -0
- package/dist/3d/schemas/index.d.ts +12 -0
- package/dist/3d/schemas/schemas.d.ts +361 -0
- package/dist/3d/schemas/serialization.d.ts +22 -0
- package/dist/3d/schemas/types.d.ts +199 -0
- package/dist/3d/schemas/validation.d.ts +33 -0
- package/dist/3d/scroll/controller.d.ts +32 -0
- package/dist/3d/scroll/index.d.ts +6 -0
- package/dist/3d/scroll/presets.d.ts +9 -0
- package/dist/3d/scroll/types.d.ts +53 -0
- package/dist/3d/terrain/biomes.d.ts +18 -0
- package/dist/3d/terrain/chunks.d.ts +20 -0
- package/dist/3d/terrain/erosion.d.ts +15 -0
- package/dist/3d/terrain/heightmap.d.ts +27 -0
- package/dist/3d/terrain/index.d.ts +18 -0
- package/dist/3d/terrain/materials.d.ts +20 -0
- package/dist/3d/terrain/noise.d.ts +25 -0
- package/dist/3d/terrain/physics.d.ts +34 -0
- package/dist/3d/terrain/terrain.d.ts +12 -0
- package/dist/3d/terrain/types.d.ts +235 -0
- package/dist/3d/terrain/vegetation.d.ts +14 -0
- package/dist/3d/types.d.ts +176 -0
- package/dist/3d/world/hydrology.d.ts +12 -0
- package/dist/3d/world/index.d.ts +15 -0
- package/dist/3d/world/lighting.d.ts +16 -0
- package/dist/3d/world/pipeline.d.ts +20 -0
- package/dist/3d/world/population.d.ts +12 -0
- package/dist/3d/world/presets.d.ts +11 -0
- package/dist/3d/world/streaming.d.ts +13 -0
- package/dist/3d/world/types.d.ts +272 -0
- package/dist/3d/world/world.d.ts +64 -0
- package/dist/backgrounds/advanced-gradient.d.ts +32 -0
- package/dist/backgrounds/atmospheric-backgrounds.d.ts +79 -0
- package/dist/backgrounds/aurora.d.ts +24 -0
- package/dist/backgrounds/cosmic-background.d.ts +31 -0
- package/dist/backgrounds/energy-effects.d.ts +78 -0
- package/dist/backgrounds/floating-orbs.d.ts +26 -0
- package/dist/backgrounds/fluid-backgrounds.d.ts +72 -0
- package/dist/backgrounds/geometric-backgrounds.d.ts +78 -0
- package/dist/backgrounds/gradient.d.ts +20 -0
- package/dist/backgrounds/grid.d.ts +22 -0
- package/dist/backgrounds/internal/canvas-lifecycle.d.ts +29 -0
- package/dist/backgrounds/noise.d.ts +20 -0
- package/dist/backgrounds/particle-background.d.ts +37 -0
- package/dist/backgrounds/particle-field.d.ts +22 -0
- package/dist/backgrounds/spotlight.d.ts +20 -0
- package/dist/backgrounds/wave.d.ts +22 -0
- package/dist/catalogue.d.ts +227 -0
- package/dist/catalogue.js +4 -0
- package/dist/chunks/catalogue-ZmbeEdRo.js +59850 -0
- package/dist/chunks/core-animation-CeiI_TEe.js +1394 -0
- package/dist/chunks/motion-choreography-DC6LWvDk.js +4089 -0
- package/dist/chunks/pointer-capture-lrnKAl2I.js +158 -0
- package/dist/chunks/safe-json-D5j34GEB.js +62 -0
- package/dist/chunks/scroll-velocity-BNUHaS0-.js +904 -0
- package/dist/cli/commands/doctor.d.ts +9 -0
- package/dist/cli/commands/example.d.ts +9 -0
- package/dist/cli/commands/info.d.ts +8 -0
- package/dist/cli/commands/init.d.ts +9 -0
- package/dist/cli/commands/presets.d.ts +10 -0
- package/dist/cli/commands/validate.d.ts +9 -0
- package/dist/cli/index.d.ts +22 -0
- package/dist/cli/types.d.ts +115 -0
- package/dist/cli/utils/safety.d.ts +11 -0
- package/dist/cli/utils/templates.d.ts +16 -0
- package/dist/cli/utils/terminal.d.ts +29 -0
- package/dist/cli.js +825 -0
- package/dist/core/adaptive-motion.d.ts +100 -0
- package/dist/core/adaptive-quality/controller.d.ts +61 -0
- package/dist/core/adaptive-quality/index.d.ts +13 -0
- package/dist/core/adaptive-quality/metrics.d.ts +33 -0
- package/dist/core/adaptive-quality/policies.d.ts +40 -0
- package/dist/core/adaptive-quality/profile.d.ts +58 -0
- package/dist/core/adaptive-quality/react.d.ts +57 -0
- package/dist/core/adaptive-quality/recommendation.d.ts +12 -0
- package/dist/core/adaptive-quality/resolution.d.ts +22 -0
- package/dist/core/adaptive-quality/types.d.ts +362 -0
- package/dist/core/advanced-motion/adapters.d.ts +20 -0
- package/dist/core/advanced-motion/controller.d.ts +52 -0
- package/dist/core/advanced-motion/index.d.ts +12 -0
- package/dist/core/advanced-motion/recipes.d.ts +16 -0
- package/dist/core/advanced-motion/timeline.d.ts +35 -0
- package/dist/core/advanced-motion/types.d.ts +174 -0
- package/dist/core/advanced-motion/validation.d.ts +11 -0
- package/dist/core/agent-workflows/agent-registry.d.ts +21 -0
- package/dist/core/agent-workflows/agents/accessibility-agent.d.ts +9 -0
- package/dist/core/agent-workflows/agents/composition-agent.d.ts +9 -0
- package/dist/core/agent-workflows/agents/design-to-motion-agent.d.ts +9 -0
- package/dist/core/agent-workflows/agents/index.d.ts +13 -0
- package/dist/core/agent-workflows/agents/motion-intelligence-agent.d.ts +9 -0
- package/dist/core/agent-workflows/agents/performance-agent.d.ts +9 -0
- package/dist/core/agent-workflows/agents/scene-generation-agent.d.ts +9 -0
- package/dist/core/agent-workflows/collaboration-planner.d.ts +38 -0
- package/dist/core/agent-workflows/collaboration-workflows.d.ts +83 -0
- package/dist/core/agent-workflows/communication.d.ts +29 -0
- package/dist/core/agent-workflows/conflict-resolver.d.ts +25 -0
- package/dist/core/agent-workflows/context.d.ts +36 -0
- package/dist/core/agent-workflows/execution-engine.d.ts +30 -0
- package/dist/core/agent-workflows/index.d.ts +20 -0
- package/dist/core/agent-workflows/orchestration-types.d.ts +144 -0
- package/dist/core/agent-workflows/orchestrator.d.ts +29 -0
- package/dist/core/agent-workflows/react.d.ts +71 -0
- package/dist/core/agent-workflows/shared-context.d.ts +36 -0
- package/dist/core/agent-workflows/task-planner.d.ts +42 -0
- package/dist/core/agent-workflows/templates.d.ts +14 -0
- package/dist/core/agent-workflows/tool-registry.d.ts +24 -0
- package/dist/core/agent-workflows/types.d.ts +167 -0
- package/dist/core/ai-ecosystem/capability-registry.d.ts +23 -0
- package/dist/core/ai-ecosystem/index.d.ts +13 -0
- package/dist/core/ai-ecosystem/pipeline.d.ts +19 -0
- package/dist/core/ai-ecosystem/provider.d.ts +19 -0
- package/dist/core/ai-ecosystem/types.d.ts +69 -0
- package/dist/core/ai-motion-intelligence/engine.d.ts +51 -0
- package/dist/core/ai-motion-intelligence/explanation-engine.d.ts +8 -0
- package/dist/core/ai-motion-intelligence/index.d.ts +15 -0
- package/dist/core/ai-motion-intelligence/intent-classifier.d.ts +14 -0
- package/dist/core/ai-motion-intelligence/knowledge-base.d.ts +12 -0
- package/dist/core/ai-motion-intelligence/provider.d.ts +31 -0
- package/dist/core/ai-motion-intelligence/quality-evaluator.d.ts +9 -0
- package/dist/core/ai-motion-intelligence/react.d.ts +14 -0
- package/dist/core/ai-motion-intelligence/recommendation-engine.d.ts +16 -0
- package/dist/core/ai-motion-intelligence/types.d.ts +134 -0
- package/dist/core/ai-motion-registry.d.ts +201 -0
- package/dist/core/animate.d.ts +57 -0
- package/dist/core/animation-intelligence/engine.d.ts +42 -0
- package/dist/core/animation-intelligence/index.d.ts +11 -0
- package/dist/core/animation-intelligence/intent.d.ts +15 -0
- package/dist/core/animation-intelligence/schema.d.ts +42 -0
- package/dist/core/animation-intelligence/scoring.d.ts +15 -0
- package/dist/core/animation-intelligence/types.d.ts +91 -0
- package/dist/core/animation-parallel.d.ts +37 -0
- package/dist/core/animation-presets.d.ts +56 -0
- package/dist/core/animation-sequence.d.ts +37 -0
- package/dist/core/animation-timeline.d.ts +46 -0
- package/dist/core/animation.d.ts +48 -0
- package/dist/core/built-in-palettes.d.ts +331 -0
- package/dist/core/choreography-intelligence/bridge.d.ts +43 -0
- package/dist/core/choreography-intelligence/generator.d.ts +11 -0
- package/dist/core/choreography-intelligence/index.d.ts +11 -0
- package/dist/core/choreography-intelligence/intent.d.ts +11 -0
- package/dist/core/choreography-intelligence/schema.d.ts +76 -0
- package/dist/core/choreography-intelligence/types.d.ts +87 -0
- package/dist/core/composition.d.ts +170 -0
- package/dist/core/configuration-corrector.d.ts +85 -0
- package/dist/core/design-intelligence.d.ts +199 -0
- package/dist/core/design-system.d.ts +206 -0
- package/dist/core/design-to-motion/design-analyzer.d.ts +13 -0
- package/dist/core/design-to-motion/engine.d.ts +34 -0
- package/dist/core/design-to-motion/generator.d.ts +16 -0
- package/dist/core/design-to-motion/index.d.ts +15 -0
- package/dist/core/design-to-motion/input-parser.d.ts +17 -0
- package/dist/core/design-to-motion/motion-planner.d.ts +11 -0
- package/dist/core/design-to-motion/presets.d.ts +11 -0
- package/dist/core/design-to-motion/react.d.ts +13 -0
- package/dist/core/design-to-motion/types.d.ts +221 -0
- package/dist/core/design-to-motion/validator.d.ts +13 -0
- package/dist/core/device-capabilities/classification.d.ts +25 -0
- package/dist/core/device-capabilities/detection.d.ts +27 -0
- package/dist/core/device-capabilities/graphics.d.ts +22 -0
- package/dist/core/device-capabilities/hardware.d.ts +27 -0
- package/dist/core/device-capabilities/index.d.ts +14 -0
- package/dist/core/device-capabilities/monitor.d.ts +19 -0
- package/dist/core/device-capabilities/react.d.ts +24 -0
- package/dist/core/device-capabilities/runtime.d.ts +11 -0
- package/dist/core/device-capabilities/scoring.d.ts +18 -0
- package/dist/core/device-capabilities/types.d.ts +171 -0
- package/dist/core/effect-composer.d.ts +41 -0
- package/dist/core/generation-pipeline.d.ts +135 -0
- package/dist/core/inertia.d.ts +30 -0
- package/dist/core/interactions/cursor-controller.d.ts +9 -0
- package/dist/core/interactions/custom-gestures.d.ts +28 -0
- package/dist/core/interactions/device-capabilities.d.ts +12 -0
- package/dist/core/interactions/drag-controller.d.ts +60 -0
- package/dist/core/interactions/errors.d.ts +13 -0
- package/dist/core/interactions/gesture-classifier.d.ts +43 -0
- package/dist/core/interactions/gesture-intelligence-controller.d.ts +9 -0
- package/dist/core/interactions/gesture-recognizers.d.ts +160 -0
- package/dist/core/interactions/gesture-sequence.d.ts +9 -0
- package/dist/core/interactions/index.d.ts +27 -0
- package/dist/core/interactions/input-normalizer.d.ts +8 -0
- package/dist/core/interactions/interaction-manager.d.ts +43 -0
- package/dist/core/interactions/keyboard-manager.d.ts +16 -0
- package/dist/core/interactions/magnetic-controller.d.ts +9 -0
- package/dist/core/interactions/magnetic-group.d.ts +11 -0
- package/dist/core/interactions/multitouch-controller.d.ts +62 -0
- package/dist/core/interactions/pointer-controller.d.ts +34 -0
- package/dist/core/interactions/pointer-tracker.d.ts +32 -0
- package/dist/core/interactions/prioritizer.d.ts +17 -0
- package/dist/core/interactions/touch-controller.d.ts +35 -0
- package/dist/core/interactions/types.d.ts +710 -0
- package/dist/core/layout/controller.d.ts +56 -0
- package/dist/core/layout/flip.d.ts +21 -0
- package/dist/core/layout/group.d.ts +46 -0
- package/dist/core/layout/index.d.ts +12 -0
- package/dist/core/layout/measure.d.ts +30 -0
- package/dist/core/layout/presets.d.ts +24 -0
- package/dist/core/layout/types.d.ts +189 -0
- package/dist/core/microinteractions/generator.d.ts +11 -0
- package/dist/core/microinteractions/index.d.ts +11 -0
- package/dist/core/microinteractions/intent.d.ts +11 -0
- package/dist/core/microinteractions/runtime.d.ts +25 -0
- package/dist/core/microinteractions/schema.d.ts +82 -0
- package/dist/core/microinteractions/types.d.ts +79 -0
- package/dist/core/motion-choreography.d.ts +163 -0
- package/dist/core/motion-dna.d.ts +129 -0
- package/dist/core/motion-path/animator.d.ts +13 -0
- package/dist/core/motion-path/engine.d.ts +27 -0
- package/dist/core/motion-path/follower.d.ts +8 -0
- package/dist/core/motion-path/index.d.ts +15 -0
- package/dist/core/motion-path/lut.d.ts +33 -0
- package/dist/core/motion-path/parser.d.ts +26 -0
- package/dist/core/motion-path/segments.d.ts +16 -0
- package/dist/core/motion-path/types.d.ts +178 -0
- package/dist/core/motion-path/vector3.d.ts +49 -0
- package/dist/core/motion-recipe.d.ts +171 -0
- package/dist/core/motion-states.d.ts +43 -0
- package/dist/core/motion-validation/consistency.d.ts +11 -0
- package/dist/core/motion-validation/index.d.ts +11 -0
- package/dist/core/motion-validation/optimizer.d.ts +11 -0
- package/dist/core/motion-validation/schema.d.ts +81 -0
- package/dist/core/motion-validation/types.d.ts +53 -0
- package/dist/core/motion-validation/validator.d.ts +11 -0
- package/dist/core/motion.d.ts +7 -0
- package/dist/core/natural-motion.d.ts +110 -0
- package/dist/core/palette-colors.d.ts +16 -0
- package/dist/core/palette-styles.d.ts +12 -0
- package/dist/core/palettes.d.ts +59 -0
- package/dist/core/performance-intelligence/conflicts.d.ts +21 -0
- package/dist/core/performance-intelligence/context.d.ts +48 -0
- package/dist/core/performance-intelligence/coordinator.d.ts +84 -0
- package/dist/core/performance-intelligence/decisions.d.ts +17 -0
- package/dist/core/performance-intelligence/history.d.ts +44 -0
- package/dist/core/performance-intelligence/index.d.ts +15 -0
- package/dist/core/performance-intelligence/policies.d.ts +59 -0
- package/dist/core/performance-intelligence/react.d.ts +78 -0
- package/dist/core/performance-intelligence/report.d.ts +16 -0
- package/dist/core/performance-intelligence/scoring.d.ts +16 -0
- package/dist/core/performance-intelligence/types.d.ts +203 -0
- package/dist/core/performance-optimizer/bottlenecks.d.ts +9 -0
- package/dist/core/performance-optimizer/index.d.ts +13 -0
- package/dist/core/performance-optimizer/optimizer.d.ts +43 -0
- package/dist/core/performance-optimizer/profiler.d.ts +38 -0
- package/dist/core/performance-optimizer/react.d.ts +55 -0
- package/dist/core/performance-optimizer/strategies.d.ts +22 -0
- package/dist/core/performance-optimizer/types.d.ts +227 -0
- package/dist/core/performance-optimizer/workers.d.ts +27 -0
- package/dist/core/physics/collision-constraints.d.ts +15 -0
- package/dist/core/physics/collision-detection.d.ts +93 -0
- package/dist/core/physics/collision-response.d.ts +24 -0
- package/dist/core/physics/collision-types.d.ts +381 -0
- package/dist/core/physics/collision-world.d.ts +11 -0
- package/dist/core/physics/composition-behaviors.d.ts +97 -0
- package/dist/core/physics/composition-choreography.d.ts +14 -0
- package/dist/core/physics/composition-engine.d.ts +25 -0
- package/dist/core/physics/composition-recipes.d.ts +46 -0
- package/dist/core/physics/composition-types.d.ts +265 -0
- package/dist/core/physics/composition-validation.d.ts +33 -0
- package/dist/core/physics/index.d.ts +37 -0
- package/dist/core/physics/inertia-animation.d.ts +11 -0
- package/dist/core/physics/inertia-math.d.ts +56 -0
- package/dist/core/physics/inertia-presets.d.ts +25 -0
- package/dist/core/physics/inertia-simulation.d.ts +11 -0
- package/dist/core/physics/inertia-types.d.ts +355 -0
- package/dist/core/physics/inertia-validation.d.ts +22 -0
- package/dist/core/physics/math.d.ts +99 -0
- package/dist/core/physics/presets.d.ts +28 -0
- package/dist/core/physics/simulation.d.ts +11 -0
- package/dist/core/physics/spring-animation.d.ts +11 -0
- package/dist/core/physics/spring-math.d.ts +47 -0
- package/dist/core/physics/spring-presets.d.ts +29 -0
- package/dist/core/physics/spring-simulation.d.ts +11 -0
- package/dist/core/physics/spring-types.d.ts +350 -0
- package/dist/core/physics/spring-validation.d.ts +22 -0
- package/dist/core/physics/stepper.d.ts +24 -0
- package/dist/core/physics/types.d.ts +280 -0
- package/dist/core/physics/validation.d.ts +62 -0
- package/dist/core/pointer-capture.d.ts +7 -0
- package/dist/core/reference-analysis/index.d.ts +10 -0
- package/dist/core/reference-analysis/interpreter.d.ts +12 -0
- package/dist/core/reference-analysis/planner.d.ts +15 -0
- package/dist/core/reference-analysis/specification.d.ts +14 -0
- package/dist/core/reference-analysis/types.d.ts +244 -0
- package/dist/core/resource-intelligence/cache.d.ts +43 -0
- package/dist/core/resource-intelligence/gpu.d.ts +19 -0
- package/dist/core/resource-intelligence/index.d.ts +16 -0
- package/dist/core/resource-intelligence/leaks.d.ts +13 -0
- package/dist/core/resource-intelligence/memory.d.ts +27 -0
- package/dist/core/resource-intelligence/pooling.d.ts +32 -0
- package/dist/core/resource-intelligence/pressure.d.ts +32 -0
- package/dist/core/resource-intelligence/react.d.ts +63 -0
- package/dist/core/resource-intelligence/registry.d.ts +33 -0
- package/dist/core/resource-intelligence/reports.d.ts +14 -0
- package/dist/core/resource-intelligence/types.d.ts +232 -0
- package/dist/core/scene-generation/engine.d.ts +31 -0
- package/dist/core/scene-generation/generator.d.ts +14 -0
- package/dist/core/scene-generation/index.d.ts +14 -0
- package/dist/core/scene-generation/input-parser.d.ts +24 -0
- package/dist/core/scene-generation/presets.d.ts +10 -0
- package/dist/core/scene-generation/react.d.ts +13 -0
- package/dist/core/scene-generation/scene-analyzer.d.ts +9 -0
- package/dist/core/scene-generation/scene-planner.d.ts +12 -0
- package/dist/core/scene-generation/types.d.ts +236 -0
- package/dist/core/scene-generation/validator.d.ts +18 -0
- package/dist/core/schema.d.ts +185 -0
- package/dist/core/scroll-intelligence/generator.d.ts +11 -0
- package/dist/core/scroll-intelligence/index.d.ts +11 -0
- package/dist/core/scroll-intelligence/intent.d.ts +11 -0
- package/dist/core/scroll-intelligence/runtime.d.ts +21 -0
- package/dist/core/scroll-intelligence/schema.d.ts +78 -0
- package/dist/core/scroll-intelligence/types.d.ts +85 -0
- package/dist/core/spring.d.ts +38 -0
- package/dist/core/svg-morph/animator.d.ts +10 -0
- package/dist/core/svg-morph/arc-to-cubic.d.ts +11 -0
- package/dist/core/svg-morph/index.d.ts +10 -0
- package/dist/core/svg-morph/interpolate.d.ts +23 -0
- package/dist/core/svg-morph/normalize.d.ts +34 -0
- package/dist/core/svg-morph/parser.d.ts +13 -0
- package/dist/core/svg-morph/shapes.d.ts +32 -0
- package/dist/core/svg-morph/types.d.ts +144 -0
- package/dist/core/transform.d.ts +27 -0
- package/dist/core/transitions/controller.d.ts +45 -0
- package/dist/core/transitions/engine.d.ts +26 -0
- package/dist/core/transitions/group-transition.d.ts +30 -0
- package/dist/core/transitions/index.d.ts +15 -0
- package/dist/core/transitions/presets.d.ts +16 -0
- package/dist/core/transitions/schema.d.ts +71 -0
- package/dist/core/transitions/shared-element-transition.d.ts +88 -0
- package/dist/core/transitions/shared-element.d.ts +84 -0
- package/dist/core/transitions/types.d.ts +185 -0
- package/dist/core/transitions/view-transition.d.ts +25 -0
- package/dist/core/typography/engine.d.ts +19 -0
- package/dist/core/typography/index.d.ts +15 -0
- package/dist/core/typography/path-motion.d.ts +24 -0
- package/dist/core/typography/presets.d.ts +14 -0
- package/dist/core/typography/properties.d.ts +19 -0
- package/dist/core/typography/segmenter.d.ts +32 -0
- package/dist/core/typography/stagger.d.ts +15 -0
- package/dist/core/typography/transitions.d.ts +11 -0
- package/dist/core/typography/types.d.ts +154 -0
- package/dist/core/utils/safe-json.d.ts +50 -0
- package/dist/core/visual-style-registry.d.ts +659 -0
- package/dist/easing/easings.d.ts +44 -0
- package/dist/effects/border-beam.d.ts +28 -0
- package/dist/effects/count-up.d.ts +30 -0
- package/dist/effects/cursor-trail.d.ts +23 -0
- package/dist/effects/drag.d.ts +41 -0
- package/dist/effects/draw-svg.d.ts +19 -0
- package/dist/effects/follow-pointer.d.ts +19 -0
- package/dist/effects/glow.d.ts +25 -0
- package/dist/effects/gradient-text.d.ts +22 -0
- package/dist/effects/hover-motion.d.ts +32 -0
- package/dist/effects/in-view.d.ts +14 -0
- package/dist/effects/magnetic.d.ts +40 -0
- package/dist/effects/morph-svg.d.ts +15 -0
- package/dist/effects/parallax.d.ts +42 -0
- package/dist/effects/pinch.d.ts +27 -0
- package/dist/effects/reveal.d.ts +33 -0
- package/dist/effects/ripple.d.ts +21 -0
- package/dist/effects/scroll-animate.d.ts +23 -0
- package/dist/effects/scroll-direction.d.ts +19 -0
- package/dist/effects/scroll-progress.d.ts +29 -0
- package/dist/effects/scroll-trigger.d.ts +22 -0
- package/dist/effects/scroll-velocity.d.ts +29 -0
- package/dist/effects/shine.d.ts +23 -0
- package/dist/effects/split-text.d.ts +17 -0
- package/dist/effects/spotlight.d.ts +24 -0
- package/dist/effects/stagger.d.ts +46 -0
- package/dist/effects/swipe.d.ts +27 -0
- package/dist/effects/text-highlight.d.ts +25 -0
- package/dist/effects/text-mask.d.ts +25 -0
- package/dist/effects/text-reveal.d.ts +28 -0
- package/dist/effects/text-scramble.d.ts +18 -0
- package/dist/effects/tilt.d.ts +42 -0
- package/dist/effects/typewriter.d.ts +26 -0
- package/dist/graphics/capabilities.d.ts +12 -0
- package/dist/graphics/composition/engine.d.ts +14 -0
- package/dist/graphics/composition/fallback.d.ts +13 -0
- package/dist/graphics/composition/index.d.ts +10 -0
- package/dist/graphics/composition/ordering.d.ts +29 -0
- package/dist/graphics/composition/quality.d.ts +24 -0
- package/dist/graphics/composition/schema.d.ts +156 -0
- package/dist/graphics/composition/types.d.ts +81 -0
- package/dist/graphics/composition/unified.d.ts +23 -0
- package/dist/graphics/effects/advanced/engine.d.ts +9 -0
- package/dist/graphics/effects/advanced/index.d.ts +1 -0
- package/dist/graphics/effects/composer.d.ts +9 -0
- package/dist/graphics/effects/distortion/engine.d.ts +9 -0
- package/dist/graphics/effects/distortion/index.d.ts +1 -0
- package/dist/graphics/effects/fluid/engine.d.ts +9 -0
- package/dist/graphics/effects/fluid/index.d.ts +1 -0
- package/dist/graphics/effects/index.d.ts +10 -0
- package/dist/graphics/effects/particles/engine.d.ts +9 -0
- package/dist/graphics/effects/particles/index.d.ts +2 -0
- package/dist/graphics/effects/particles/pool.d.ts +17 -0
- package/dist/graphics/effects/schema.d.ts +312 -0
- package/dist/graphics/effects/types.d.ts +85 -0
- package/dist/graphics/engine.d.ts +5 -0
- package/dist/graphics/environment/clouds.d.ts +28 -0
- package/dist/graphics/environment/environment.d.ts +50 -0
- package/dist/graphics/environment/fire-smoke.d.ts +32 -0
- package/dist/graphics/environment/fog.d.ts +28 -0
- package/dist/graphics/environment/index.d.ts +18 -0
- package/dist/graphics/environment/lightning.d.ts +33 -0
- package/dist/graphics/environment/rain.d.ts +33 -0
- package/dist/graphics/environment/snow.d.ts +30 -0
- package/dist/graphics/environment/types.d.ts +184 -0
- package/dist/graphics/environment/weather.d.ts +19 -0
- package/dist/graphics/environment/wind.d.ts +23 -0
- package/dist/graphics/fluid/flow-field.d.ts +74 -0
- package/dist/graphics/fluid/grid.d.ts +43 -0
- package/dist/graphics/fluid/index.d.ts +13 -0
- package/dist/graphics/fluid/interactions.d.ts +39 -0
- package/dist/graphics/fluid/rendering.d.ts +32 -0
- package/dist/graphics/fluid/simulation.d.ts +50 -0
- package/dist/graphics/fluid/solver.d.ts +19 -0
- package/dist/graphics/fluid/types.d.ts +186 -0
- package/dist/graphics/gpu-simulation/backends/backend.d.ts +24 -0
- package/dist/graphics/gpu-simulation/backends/cpu.d.ts +21 -0
- package/dist/graphics/gpu-simulation/backends/selection.d.ts +15 -0
- package/dist/graphics/gpu-simulation/backends/webgl2.d.ts +28 -0
- package/dist/graphics/gpu-simulation/backends/webgpu.d.ts +23 -0
- package/dist/graphics/gpu-simulation/capabilities.d.ts +14 -0
- package/dist/graphics/gpu-simulation/device.d.ts +17 -0
- package/dist/graphics/gpu-simulation/engine.d.ts +8 -0
- package/dist/graphics/gpu-simulation/index.d.ts +22 -0
- package/dist/graphics/gpu-simulation/ping-pong.d.ts +23 -0
- package/dist/graphics/gpu-simulation/pipeline.d.ts +18 -0
- package/dist/graphics/gpu-simulation/resource-manager.d.ts +8 -0
- package/dist/graphics/gpu-simulation/shaders.d.ts +50 -0
- package/dist/graphics/gpu-simulation/types.d.ts +288 -0
- package/dist/graphics/index.d.ts +23 -0
- package/dist/graphics/materials/glass.d.ts +22 -0
- package/dist/graphics/materials/index.d.ts +9 -0
- package/dist/graphics/materials/lighting.d.ts +22 -0
- package/dist/graphics/materials/presets.d.ts +28 -0
- package/dist/graphics/materials/schema.d.ts +574 -0
- package/dist/graphics/materials/surface.d.ts +13 -0
- package/dist/graphics/materials/types.d.ts +150 -0
- package/dist/graphics/particle-fields/composition.d.ts +32 -0
- package/dist/graphics/particle-fields/forces.d.ts +103 -0
- package/dist/graphics/particle-fields/index.d.ts +12 -0
- package/dist/graphics/particle-fields/interaction.d.ts +32 -0
- package/dist/graphics/particle-fields/spatial-index.d.ts +20 -0
- package/dist/graphics/particle-fields/system.d.ts +52 -0
- package/dist/graphics/particle-fields/types.d.ts +138 -0
- package/dist/graphics/particles/behaviors.d.ts +11 -0
- package/dist/graphics/particles/controller.d.ts +82 -0
- package/dist/graphics/particles/data-layout.d.ts +51 -0
- package/dist/graphics/particles/emitters.d.ts +24 -0
- package/dist/graphics/particles/index.d.ts +15 -0
- package/dist/graphics/particles/random.d.ts +25 -0
- package/dist/graphics/particles/rendering.d.ts +16 -0
- package/dist/graphics/particles/simulation.d.ts +23 -0
- package/dist/graphics/particles/types.d.ts +282 -0
- package/dist/graphics/renderer.d.ts +66 -0
- package/dist/graphics/resource-manager.d.ts +6 -0
- package/dist/graphics/schema.d.ts +177 -0
- package/dist/graphics/simulation/adapters.d.ts +36 -0
- package/dist/graphics/simulation/coordinator.d.ts +64 -0
- package/dist/graphics/simulation/index.d.ts +11 -0
- package/dist/graphics/simulation/optimizer.d.ts +101 -0
- package/dist/graphics/simulation/resource-manager.d.ts +40 -0
- package/dist/graphics/simulation/types.d.ts +126 -0
- package/dist/graphics/textures/cache.d.ts +29 -0
- package/dist/graphics/textures/canvas-utils.d.ts +31 -0
- package/dist/graphics/textures/engine.d.ts +34 -0
- package/dist/graphics/textures/generators.d.ts +29 -0
- package/dist/graphics/textures/index.d.ts +11 -0
- package/dist/graphics/textures/material-integration.d.ts +20 -0
- package/dist/graphics/textures/prng.d.ts +27 -0
- package/dist/graphics/textures/schema.d.ts +219 -0
- package/dist/graphics/textures/types.d.ts +80 -0
- package/dist/graphics/types.d.ts +152 -0
- package/dist/graphics/viewport.d.ts +32 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.js +4921 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/prompts.d.ts +9 -0
- package/dist/mcp/resources.d.ts +9 -0
- package/dist/mcp/server.d.ts +29 -0
- package/dist/mcp/tools.d.ts +9 -0
- package/dist/mcp/transport.d.ts +33 -0
- package/dist/mcp/types.d.ts +96 -0
- package/dist/presets.d.ts +176 -0
- package/dist/presets.js +3 -0
- package/dist/react.d.ts +5358 -0
- package/dist/react.js +7557 -0
- package/package.json +112 -6
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AF Motion — Advanced Spring Physics Type System
|
|
3
|
+
*
|
|
4
|
+
* Strongly typed contracts for mass-spring-damper simulations,
|
|
5
|
+
* damping regimes, dynamic retargeting, and animation controls.
|
|
6
|
+
*/
|
|
7
|
+
import type { PhysicsValue, IntegratorType, PhysicsSimulationContext, PhysicsStepOptions } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Three fundamental damping regimes of a second-order harmonic oscillator.
|
|
10
|
+
*/
|
|
11
|
+
export type SpringDampingBehavior = "underdamped" | "critically-damped" | "overdamped";
|
|
12
|
+
/**
|
|
13
|
+
* Advanced configuration options for spring physics simulations.
|
|
14
|
+
*/
|
|
15
|
+
export interface AdvancedSpringConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Spring stiffness coefficient (k).
|
|
18
|
+
* Dictates the restorative force pulling towards equilibrium.
|
|
19
|
+
* Must be finite and > 0. Default: 170.
|
|
20
|
+
*/
|
|
21
|
+
stiffness?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Damping coefficient (c).
|
|
24
|
+
* Friction / resistance force proportional to velocity.
|
|
25
|
+
* Must be finite and >= 0. Default: 26.
|
|
26
|
+
*/
|
|
27
|
+
damping?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Mass of the physical entity (m).
|
|
30
|
+
* Dictates inertia and resistance to acceleration.
|
|
31
|
+
* Must be finite and > 0. Default: 1.0.
|
|
32
|
+
*/
|
|
33
|
+
mass?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Initial spatial position (scalar or vector).
|
|
36
|
+
* Default: 0.
|
|
37
|
+
*/
|
|
38
|
+
from?: PhysicsValue;
|
|
39
|
+
/**
|
|
40
|
+
* Equilibrium / target position (scalar or vector).
|
|
41
|
+
* Default: 1.
|
|
42
|
+
*/
|
|
43
|
+
target?: PhysicsValue;
|
|
44
|
+
/**
|
|
45
|
+
* Initial velocity in position units per second (scalar or vector).
|
|
46
|
+
* Default: 0.
|
|
47
|
+
*/
|
|
48
|
+
initialVelocity?: PhysicsValue;
|
|
49
|
+
/**
|
|
50
|
+
* Distance from target below which the spring considers position settled.
|
|
51
|
+
* Must be finite and > 0. Default: 0.01.
|
|
52
|
+
*/
|
|
53
|
+
restDelta?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Speed below which the spring considers velocity settled.
|
|
56
|
+
* Must be finite and > 0. Default: 0.01.
|
|
57
|
+
*/
|
|
58
|
+
restSpeed?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Discrete timestep in seconds for numerical integration steps.
|
|
61
|
+
* Default: 1/60 (~0.016667s). Must be finite and > 0.
|
|
62
|
+
*/
|
|
63
|
+
timestep?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Numerical integration algorithm.
|
|
66
|
+
* Default: 'semi-implicit-euler'.
|
|
67
|
+
*/
|
|
68
|
+
integrator?: IntegratorType;
|
|
69
|
+
/**
|
|
70
|
+
* Simulation time multiplier.
|
|
71
|
+
* Default: 1.0. Must be finite and >= 0.
|
|
72
|
+
*/
|
|
73
|
+
timeScale?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Maximum sub-steps per tick to prevent the spiral of death.
|
|
76
|
+
* Default: 10. Must be an integer >= 1.
|
|
77
|
+
*/
|
|
78
|
+
maxSubSteps?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Precision threshold snapping small micro-oscillations to zero.
|
|
81
|
+
* Default: 1e-5.
|
|
82
|
+
*/
|
|
83
|
+
precision?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Optional maximum duration limit in seconds.
|
|
86
|
+
* If reached, forces the spring to settle at the target.
|
|
87
|
+
*/
|
|
88
|
+
maxDuration?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Automatically start advancing on creation.
|
|
91
|
+
* Default: false.
|
|
92
|
+
*/
|
|
93
|
+
autoStart?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Respect system reduced motion preferences.
|
|
96
|
+
* Default: true.
|
|
97
|
+
*/
|
|
98
|
+
respectReducedMotion?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Complete snapshot of the spring's mechanical state.
|
|
102
|
+
*/
|
|
103
|
+
export interface SpringState {
|
|
104
|
+
/**
|
|
105
|
+
* Current spatial position (scalar or vector).
|
|
106
|
+
*/
|
|
107
|
+
readonly position: PhysicsValue;
|
|
108
|
+
/**
|
|
109
|
+
* Current velocity (scalar or vector).
|
|
110
|
+
*/
|
|
111
|
+
readonly velocity: PhysicsValue;
|
|
112
|
+
/**
|
|
113
|
+
* Current instantaneous acceleration (scalar or vector).
|
|
114
|
+
*/
|
|
115
|
+
readonly acceleration: PhysicsValue;
|
|
116
|
+
/**
|
|
117
|
+
* Current target / equilibrium position.
|
|
118
|
+
*/
|
|
119
|
+
readonly target: PhysicsValue;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the spring has settled at the target equilibrium.
|
|
122
|
+
*/
|
|
123
|
+
readonly settled: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Damping regime classification.
|
|
126
|
+
*/
|
|
127
|
+
readonly dampingBehavior: SpringDampingBehavior;
|
|
128
|
+
/**
|
|
129
|
+
* Damping ratio (zeta = c / (2 * sqrt(k * m))).
|
|
130
|
+
*/
|
|
131
|
+
readonly dampingRatio: number;
|
|
132
|
+
/**
|
|
133
|
+
* Undamped natural frequency in rad/s (omega0 = sqrt(k / m)).
|
|
134
|
+
*/
|
|
135
|
+
readonly naturalFrequency: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Diagnostic result returned by each spring simulation step.
|
|
139
|
+
*/
|
|
140
|
+
export interface SpringStepResult {
|
|
141
|
+
readonly position: PhysicsValue;
|
|
142
|
+
readonly velocity: PhysicsValue;
|
|
143
|
+
readonly acceleration: PhysicsValue;
|
|
144
|
+
readonly settled: boolean;
|
|
145
|
+
readonly stepsTaken: number;
|
|
146
|
+
readonly clamped: boolean;
|
|
147
|
+
readonly context: PhysicsSimulationContext;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Options when dynamically updating a spring's target.
|
|
151
|
+
*/
|
|
152
|
+
export interface SpringRetargetOptions {
|
|
153
|
+
/**
|
|
154
|
+
* Whether to preserve the current velocity (true, default) or reset it to zero (false).
|
|
155
|
+
*/
|
|
156
|
+
preserveVelocity?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* If true, snaps immediately to the new target without further animation.
|
|
159
|
+
*/
|
|
160
|
+
immediate?: boolean;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Standard spring preset names.
|
|
164
|
+
*/
|
|
165
|
+
export type SpringPresetName = "gentle" | "smooth" | "snappy" | "bouncy" | "stiff" | "heavy" | "soft" | "elastic" | "critical";
|
|
166
|
+
/**
|
|
167
|
+
* Spring preset structure.
|
|
168
|
+
*/
|
|
169
|
+
export interface SpringPreset {
|
|
170
|
+
readonly id: string;
|
|
171
|
+
readonly name: string;
|
|
172
|
+
readonly description: string;
|
|
173
|
+
readonly behavior: SpringDampingBehavior;
|
|
174
|
+
readonly config: Required<Pick<AdvancedSpringConfig, "stiffness" | "damping" | "mass" | "restDelta" | "restSpeed">> & Partial<AdvancedSpringConfig>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Callback signatures for spring events.
|
|
178
|
+
*/
|
|
179
|
+
export type SpringUpdateListener = (state: SpringState, context: PhysicsSimulationContext) => void;
|
|
180
|
+
export type SpringSettleListener = (state: SpringState, context: PhysicsSimulationContext) => void;
|
|
181
|
+
export type SpringCompleteListener = (state: SpringState, context: PhysicsSimulationContext) => void;
|
|
182
|
+
export type SpringRetargetListener = (newTarget: PhysicsValue, previousTarget: PhysicsValue) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Options for creating an independent spring simulation instance.
|
|
185
|
+
*/
|
|
186
|
+
export interface AdvancedSpringOptions {
|
|
187
|
+
/**
|
|
188
|
+
* Spring physical parameters or named preset identifier.
|
|
189
|
+
*/
|
|
190
|
+
config?: AdvancedSpringConfig | SpringPresetName;
|
|
191
|
+
/**
|
|
192
|
+
* Starting position override.
|
|
193
|
+
*/
|
|
194
|
+
from?: PhysicsValue;
|
|
195
|
+
/**
|
|
196
|
+
* Target position override.
|
|
197
|
+
*/
|
|
198
|
+
target?: PhysicsValue;
|
|
199
|
+
/**
|
|
200
|
+
* Initial velocity override.
|
|
201
|
+
*/
|
|
202
|
+
initialVelocity?: PhysicsValue;
|
|
203
|
+
/**
|
|
204
|
+
* Called on every simulation step.
|
|
205
|
+
*/
|
|
206
|
+
onUpdate?: SpringUpdateListener;
|
|
207
|
+
/**
|
|
208
|
+
* Called once when the spring satisfies rest conditions and settles.
|
|
209
|
+
*/
|
|
210
|
+
onSettle?: SpringSettleListener;
|
|
211
|
+
/**
|
|
212
|
+
* Called once when the simulation reaches completion or settles.
|
|
213
|
+
*/
|
|
214
|
+
onComplete?: SpringCompleteListener;
|
|
215
|
+
/**
|
|
216
|
+
* Called whenever the target is retargeted during simulation.
|
|
217
|
+
*/
|
|
218
|
+
onRetarget?: SpringRetargetListener;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Public controller interface for an active spring simulation instance.
|
|
222
|
+
*/
|
|
223
|
+
export interface AdvancedSpringControls {
|
|
224
|
+
/**
|
|
225
|
+
* Starts or resumes the spring simulation.
|
|
226
|
+
*/
|
|
227
|
+
start(): void;
|
|
228
|
+
/**
|
|
229
|
+
* Pauses the simulation without losing position, velocity, or progress.
|
|
230
|
+
*/
|
|
231
|
+
pause(): void;
|
|
232
|
+
/**
|
|
233
|
+
* Resumes a paused simulation.
|
|
234
|
+
*/
|
|
235
|
+
resume(): void;
|
|
236
|
+
/**
|
|
237
|
+
* Stops the simulation and marks it idle.
|
|
238
|
+
*/
|
|
239
|
+
stop(): void;
|
|
240
|
+
/**
|
|
241
|
+
* Resets the spring to its initial state (or specified new position and velocity).
|
|
242
|
+
*/
|
|
243
|
+
reset(newInitialState?: Partial<AdvancedSpringConfig>): void;
|
|
244
|
+
/**
|
|
245
|
+
* Manually steps the spring simulation forward by deltaTime seconds.
|
|
246
|
+
*/
|
|
247
|
+
step(deltaTimeOrOptions?: number | PhysicsStepOptions): SpringStepResult;
|
|
248
|
+
/**
|
|
249
|
+
* Returns a snapshot of the current spring state.
|
|
250
|
+
*/
|
|
251
|
+
getState(): SpringState;
|
|
252
|
+
/**
|
|
253
|
+
* Returns a snapshot of the current simulation context.
|
|
254
|
+
*/
|
|
255
|
+
getContext(): PhysicsSimulationContext;
|
|
256
|
+
/**
|
|
257
|
+
* Dynamically updates the target position without introducing discontinuities in position or velocity.
|
|
258
|
+
*/
|
|
259
|
+
setTarget(newTarget: PhysicsValue, immediate?: boolean): void;
|
|
260
|
+
/**
|
|
261
|
+
* Re-targets the spring with configurable velocity preservation.
|
|
262
|
+
*/
|
|
263
|
+
retarget(newTarget: PhysicsValue, options?: SpringRetargetOptions): void;
|
|
264
|
+
/**
|
|
265
|
+
* Sets the velocity directly (velocity injection).
|
|
266
|
+
*/
|
|
267
|
+
setVelocity(newVelocity: PhysicsValue): void;
|
|
268
|
+
/**
|
|
269
|
+
* Injects an impulse or delta velocity to the current velocity vector.
|
|
270
|
+
*/
|
|
271
|
+
injectVelocity(deltaVelocity: PhysicsValue): void;
|
|
272
|
+
/**
|
|
273
|
+
* Overrides the current position directly.
|
|
274
|
+
*/
|
|
275
|
+
setPosition(newPosition: PhysicsValue): void;
|
|
276
|
+
/**
|
|
277
|
+
* Inverts the direction of the current velocity vector.
|
|
278
|
+
*/
|
|
279
|
+
reverseVelocity(): void;
|
|
280
|
+
/**
|
|
281
|
+
* Updates the simulation time scaling factor dynamically.
|
|
282
|
+
*/
|
|
283
|
+
setTimeScale(scale: number): void;
|
|
284
|
+
/**
|
|
285
|
+
* Returns the current resolved configuration.
|
|
286
|
+
*/
|
|
287
|
+
getConfiguration(): Required<AdvancedSpringConfig>;
|
|
288
|
+
/**
|
|
289
|
+
* Updates physical parameters dynamically.
|
|
290
|
+
*/
|
|
291
|
+
setConfiguration(config: Partial<AdvancedSpringConfig>): void;
|
|
292
|
+
/**
|
|
293
|
+
* Returns whether the spring has settled at equilibrium.
|
|
294
|
+
*/
|
|
295
|
+
isSettled(): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Returns whether the spring simulation has completed.
|
|
298
|
+
*/
|
|
299
|
+
isCompleted(): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Returns whether the simulation is currently active and running.
|
|
302
|
+
*/
|
|
303
|
+
isRunning(): boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Returns whether the simulation is currently paused.
|
|
306
|
+
*/
|
|
307
|
+
isPaused(): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Returns whether the simulation has been disposed.
|
|
310
|
+
*/
|
|
311
|
+
isDisposed(): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Subscribes to step updates. Returns an unsubscribe function.
|
|
314
|
+
*/
|
|
315
|
+
onUpdate(listener: SpringUpdateListener): () => void;
|
|
316
|
+
/**
|
|
317
|
+
* Subscribes to settling events. Returns an unsubscribe function.
|
|
318
|
+
*/
|
|
319
|
+
onSettle(listener: SpringSettleListener): () => void;
|
|
320
|
+
/**
|
|
321
|
+
* Subscribes to completion events. Returns an unsubscribe function.
|
|
322
|
+
*/
|
|
323
|
+
onComplete(listener: SpringCompleteListener): () => void;
|
|
324
|
+
/**
|
|
325
|
+
* Subscribes to retargeting events. Returns an unsubscribe function.
|
|
326
|
+
*/
|
|
327
|
+
onRetarget(listener: SpringRetargetListener): () => void;
|
|
328
|
+
/**
|
|
329
|
+
* Disposes the simulation and releases all resources and listener subscriptions.
|
|
330
|
+
*/
|
|
331
|
+
dispose(): void;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Options for animated springs on the shared requestAnimationFrame loop.
|
|
335
|
+
*/
|
|
336
|
+
export interface AdvancedSpringAnimationOptions extends AdvancedSpringOptions {
|
|
337
|
+
/**
|
|
338
|
+
* Function invoked on each animation frame with updated spring state and context.
|
|
339
|
+
*/
|
|
340
|
+
onUpdate: SpringUpdateListener;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Controls for RAF-driven animated spring.
|
|
344
|
+
*/
|
|
345
|
+
export interface AdvancedSpringAnimationControls extends AdvancedSpringControls {
|
|
346
|
+
/**
|
|
347
|
+
* Cancels the animation, stopping the RAF loop and suppressing further callbacks.
|
|
348
|
+
*/
|
|
349
|
+
cancel(): void;
|
|
350
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AF Motion — Advanced Spring Validation & Correction
|
|
3
|
+
*
|
|
4
|
+
* Enforces parameter sanity and numerical stability for spring systems.
|
|
5
|
+
*/
|
|
6
|
+
import type { AdvancedSpringConfig } from "./spring-types.js";
|
|
7
|
+
import type { PhysicsValidationResult } from "./validation.js";
|
|
8
|
+
/**
|
|
9
|
+
* Validates an AdvancedSpringConfig object.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateSpringConfig(config: unknown): PhysicsValidationResult;
|
|
12
|
+
/**
|
|
13
|
+
* Asserts that a spring configuration is valid, throwing PhysicsValidationError if invalid.
|
|
14
|
+
*/
|
|
15
|
+
export declare function assertValidSpringConfig(config: unknown): asserts config is AdvancedSpringConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Safely corrects an invalid spring configuration.
|
|
18
|
+
*/
|
|
19
|
+
export declare function correctSpringConfig(config?: Partial<AdvancedSpringConfig>): {
|
|
20
|
+
corrected: Required<AdvancedSpringConfig>;
|
|
21
|
+
corrections: string[];
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AF Motion — Foundational Physics Stepper & Numerical Integrators
|
|
3
|
+
*
|
|
4
|
+
* Implements deterministic fixed-timestep integration, variable-rate accumulator,
|
|
5
|
+
* bounded catch-up processing, and numerical stability verification.
|
|
6
|
+
*/
|
|
7
|
+
import type { PhysicsConfiguration, PhysicsState, PhysicsSimulationContext, IntegratorType } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Performs a single discrete integration step for a given state over fixed delta time dt.
|
|
10
|
+
*/
|
|
11
|
+
export declare function integrateSingleStep(state: PhysicsState, dt: number, integrator: IntegratorType, precision: number): PhysicsState;
|
|
12
|
+
/**
|
|
13
|
+
* Output of a deterministic multi-step simulation advance.
|
|
14
|
+
*/
|
|
15
|
+
export interface StepAdvanceResult {
|
|
16
|
+
readonly state: PhysicsState;
|
|
17
|
+
readonly context: PhysicsSimulationContext;
|
|
18
|
+
readonly stepsTaken: number;
|
|
19
|
+
readonly clamped: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Advances a simulation deterministically over elapsed deltaTime seconds using an accumulator.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stepSimulation(currentState: PhysicsState, currentContext: PhysicsSimulationContext, config: Required<PhysicsConfiguration>, deltaTime: number, maxSubStepsOverride?: number): StepAdvanceResult;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AF Motion — Foundational Motion Physics Type System
|
|
3
|
+
*
|
|
4
|
+
* Core mathematical and simulation contracts for framework-independent
|
|
5
|
+
* physics-based animations.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 2D or 3D coordinate vector representing position, velocity, acceleration, or force.
|
|
9
|
+
*/
|
|
10
|
+
export interface PhysicsVector {
|
|
11
|
+
x: number;
|
|
12
|
+
y?: number;
|
|
13
|
+
z?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a physics quantity as either a 1D scalar or a multi-dimensional vector.
|
|
17
|
+
*/
|
|
18
|
+
export type PhysicsValue = number | PhysicsVector;
|
|
19
|
+
/**
|
|
20
|
+
* Aliases for velocity and acceleration types.
|
|
21
|
+
*/
|
|
22
|
+
export type PhysicsVelocity = PhysicsValue;
|
|
23
|
+
export type PhysicsAcceleration = PhysicsValue;
|
|
24
|
+
/**
|
|
25
|
+
* Numerical integration method for simulation steps.
|
|
26
|
+
*/
|
|
27
|
+
export type IntegratorType = "euler" | "semi-implicit-euler" | "verlet" | "rk4";
|
|
28
|
+
/**
|
|
29
|
+
* Lifecycle states of an independent physics simulation.
|
|
30
|
+
*/
|
|
31
|
+
export type PhysicsLifecycleState = "idle" | "running" | "paused" | "completed" | "disposed";
|
|
32
|
+
/**
|
|
33
|
+
* Fundamental configuration parameters for a physics simulation.
|
|
34
|
+
*/
|
|
35
|
+
export interface PhysicsConfiguration {
|
|
36
|
+
/**
|
|
37
|
+
* Fixed timestep in seconds for numerical integration steps.
|
|
38
|
+
* Default: 1/60 (~0.016667s). Must be a positive finite number.
|
|
39
|
+
*/
|
|
40
|
+
timestep?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Time scale multiplier applied to elapsed real time before advancing.
|
|
43
|
+
* Default: 1.0. Must be a non-negative finite number (0 pauses progression).
|
|
44
|
+
*/
|
|
45
|
+
timeScale?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of fixed sub-steps executed per frame to prevent the spiral of death.
|
|
48
|
+
* Default: 10. Must be an integer >= 1.
|
|
49
|
+
*/
|
|
50
|
+
maxSubSteps?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Numerical threshold below which micro-velocities and displacements round to zero.
|
|
53
|
+
* Default: 1e-5. Must be a non-negative finite number.
|
|
54
|
+
*/
|
|
55
|
+
precision?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Numerical integration algorithm.
|
|
58
|
+
* Default: 'semi-implicit-euler'.
|
|
59
|
+
*/
|
|
60
|
+
integrator?: IntegratorType;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to automatically start simulation on initialization.
|
|
63
|
+
* Default: false.
|
|
64
|
+
*/
|
|
65
|
+
autoStart?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to respect the system prefers-reduced-motion setting.
|
|
68
|
+
* Default: true.
|
|
69
|
+
*/
|
|
70
|
+
respectReducedMotion?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Dynamic state vector of a physical body at any given tick.
|
|
74
|
+
*/
|
|
75
|
+
export interface PhysicsState {
|
|
76
|
+
/**
|
|
77
|
+
* Current spatial position (scalar or vector).
|
|
78
|
+
*/
|
|
79
|
+
position: PhysicsValue;
|
|
80
|
+
/**
|
|
81
|
+
* Current velocity in position units per second (scalar or vector).
|
|
82
|
+
*/
|
|
83
|
+
velocity: PhysicsValue;
|
|
84
|
+
/**
|
|
85
|
+
* Current acceleration in position units per second squared (scalar or vector).
|
|
86
|
+
*/
|
|
87
|
+
acceleration?: PhysicsAcceleration;
|
|
88
|
+
/**
|
|
89
|
+
* Mass of the physical entity in kilograms or arbitrary mass units.
|
|
90
|
+
* Default: 1.0. Must be > 0.
|
|
91
|
+
*/
|
|
92
|
+
mass?: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Complete runtime context representing the simulation timeline and accumulator.
|
|
96
|
+
*/
|
|
97
|
+
export interface PhysicsSimulationContext {
|
|
98
|
+
/**
|
|
99
|
+
* Total simulated time in seconds elapsed since initial start/reset.
|
|
100
|
+
*/
|
|
101
|
+
readonly time: number;
|
|
102
|
+
/**
|
|
103
|
+
* Total number of discrete fixed simulation steps executed.
|
|
104
|
+
*/
|
|
105
|
+
readonly tick: number;
|
|
106
|
+
/**
|
|
107
|
+
* Elapsed time in seconds provided in the most recent advance call.
|
|
108
|
+
*/
|
|
109
|
+
readonly lastDeltaTime: number;
|
|
110
|
+
/**
|
|
111
|
+
* Residual time in seconds currently stored in the sub-step accumulator.
|
|
112
|
+
*/
|
|
113
|
+
readonly accumulator: number;
|
|
114
|
+
/**
|
|
115
|
+
* Sub-step interpolation factor between previous and current state (0.0 to 1.0).
|
|
116
|
+
* Useful for render interpolation between fixed physics steps.
|
|
117
|
+
*/
|
|
118
|
+
readonly alpha: number;
|
|
119
|
+
/**
|
|
120
|
+
* Current lifecycle state of the simulation.
|
|
121
|
+
*/
|
|
122
|
+
readonly lifecycleState: PhysicsLifecycleState;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Options provided when advancing the simulation manually.
|
|
126
|
+
*/
|
|
127
|
+
export interface PhysicsStepOptions {
|
|
128
|
+
/**
|
|
129
|
+
* Elapsed time in seconds to advance.
|
|
130
|
+
* If omitted, advances by exactly 1 fixed timestep.
|
|
131
|
+
*/
|
|
132
|
+
deltaTime?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Optional custom override for max sub-steps for this specific advance call.
|
|
135
|
+
*/
|
|
136
|
+
maxSubSteps?: number;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Diagnostic result of a simulation advance step.
|
|
140
|
+
*/
|
|
141
|
+
export interface PhysicsStepResult {
|
|
142
|
+
/**
|
|
143
|
+
* Number of discrete fixed sub-steps calculated during this advance call.
|
|
144
|
+
*/
|
|
145
|
+
readonly stepsTaken: number;
|
|
146
|
+
/**
|
|
147
|
+
* Whether the accumulator exceeded maxSubSteps and was clamped to prevent runaway catch-up.
|
|
148
|
+
*/
|
|
149
|
+
readonly clamped: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Snapshot of the physics state after this advance.
|
|
152
|
+
*/
|
|
153
|
+
readonly state: PhysicsState;
|
|
154
|
+
/**
|
|
155
|
+
* Snapshot of the simulation context after this advance.
|
|
156
|
+
*/
|
|
157
|
+
readonly context: PhysicsSimulationContext;
|
|
158
|
+
/**
|
|
159
|
+
* Whether the simulation has reached a resting state or completion condition.
|
|
160
|
+
*/
|
|
161
|
+
readonly completed: boolean;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Named preset bundling recommended configuration parameters.
|
|
165
|
+
*/
|
|
166
|
+
export interface PhysicsPreset {
|
|
167
|
+
readonly id: string;
|
|
168
|
+
readonly name: string;
|
|
169
|
+
readonly description: string;
|
|
170
|
+
readonly config: Required<PhysicsConfiguration>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Listener callback signatures.
|
|
174
|
+
*/
|
|
175
|
+
export type PhysicsStateListener = (state: PhysicsState, context: PhysicsSimulationContext) => void;
|
|
176
|
+
export type PhysicsLifecycleListener = (lifecycle: PhysicsLifecycleState, context: PhysicsSimulationContext) => void;
|
|
177
|
+
export type PhysicsCompleteListener = (state: PhysicsState, context: PhysicsSimulationContext) => void;
|
|
178
|
+
/**
|
|
179
|
+
* Construction options for an independent physics simulation.
|
|
180
|
+
*/
|
|
181
|
+
export interface PhysicsSimulationOptions {
|
|
182
|
+
/**
|
|
183
|
+
* Configuration parameters or preset overrides.
|
|
184
|
+
*/
|
|
185
|
+
config?: PhysicsConfiguration;
|
|
186
|
+
/**
|
|
187
|
+
* Initial state of the body.
|
|
188
|
+
*/
|
|
189
|
+
initialState?: Partial<PhysicsState>;
|
|
190
|
+
/**
|
|
191
|
+
* Optional custom condition callback to determine when simulation completes.
|
|
192
|
+
* If not provided, simulation continues until explicitly paused, stopped, or disposed.
|
|
193
|
+
*/
|
|
194
|
+
isComplete?: (state: PhysicsState, context: PhysicsSimulationContext) => boolean;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Public controller interface for an active physics simulation instance.
|
|
198
|
+
*/
|
|
199
|
+
export interface PhysicsControls {
|
|
200
|
+
/**
|
|
201
|
+
* Starts the simulation if idle, or resumes if paused.
|
|
202
|
+
*/
|
|
203
|
+
start(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Pauses simulation time progression.
|
|
206
|
+
*/
|
|
207
|
+
pause(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Resumes a paused simulation.
|
|
210
|
+
*/
|
|
211
|
+
resume(): void;
|
|
212
|
+
/**
|
|
213
|
+
* Stops the simulation and marks it idle.
|
|
214
|
+
*/
|
|
215
|
+
stop(): void;
|
|
216
|
+
/**
|
|
217
|
+
* Resets the simulation to the initial state (or specified new state),
|
|
218
|
+
* zeroing out accumulated time, ticks, and alpha.
|
|
219
|
+
*/
|
|
220
|
+
reset(newInitialState?: Partial<PhysicsState>): void;
|
|
221
|
+
/**
|
|
222
|
+
* Advances the simulation deterministically by deltaTime seconds (or 1 fixed timestep).
|
|
223
|
+
*/
|
|
224
|
+
step(deltaTimeOrOptions?: number | PhysicsStepOptions): PhysicsStepResult;
|
|
225
|
+
/**
|
|
226
|
+
* Returns a snapshot of the current state.
|
|
227
|
+
*/
|
|
228
|
+
getState(): PhysicsState;
|
|
229
|
+
/**
|
|
230
|
+
* Directly sets/overrides the current physics state.
|
|
231
|
+
*/
|
|
232
|
+
setState(newState: Partial<PhysicsState>): void;
|
|
233
|
+
/**
|
|
234
|
+
* Returns a snapshot of the current simulation context.
|
|
235
|
+
*/
|
|
236
|
+
getContext(): PhysicsSimulationContext;
|
|
237
|
+
/**
|
|
238
|
+
* Returns the current resolved configuration.
|
|
239
|
+
*/
|
|
240
|
+
getConfiguration(): Required<PhysicsConfiguration>;
|
|
241
|
+
/**
|
|
242
|
+
* Updates configuration parameters dynamically.
|
|
243
|
+
*/
|
|
244
|
+
setConfiguration(config: Partial<PhysicsConfiguration>): void;
|
|
245
|
+
/**
|
|
246
|
+
* Subscribes to state updates after each simulation step.
|
|
247
|
+
* Returns an unsubscribe function.
|
|
248
|
+
*/
|
|
249
|
+
onUpdate(listener: PhysicsStateListener): () => void;
|
|
250
|
+
/**
|
|
251
|
+
* Subscribes to lifecycle transitions.
|
|
252
|
+
* Returns an unsubscribe function.
|
|
253
|
+
*/
|
|
254
|
+
onLifecycle(listener: PhysicsLifecycleListener): () => void;
|
|
255
|
+
/**
|
|
256
|
+
* Subscribes to completion events.
|
|
257
|
+
* Returns an unsubscribe function.
|
|
258
|
+
*/
|
|
259
|
+
onComplete(listener: PhysicsCompleteListener): () => void;
|
|
260
|
+
/**
|
|
261
|
+
* Disposes the simulation, clears all listener subscriptions, and releases resources.
|
|
262
|
+
*/
|
|
263
|
+
dispose(): void;
|
|
264
|
+
/**
|
|
265
|
+
* Returns whether the simulation is currently active and running.
|
|
266
|
+
*/
|
|
267
|
+
isRunning(): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Returns whether the simulation is currently paused.
|
|
270
|
+
*/
|
|
271
|
+
isPaused(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Returns whether the simulation has completed.
|
|
274
|
+
*/
|
|
275
|
+
isCompleted(): boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Returns whether the simulation has been permanently disposed.
|
|
278
|
+
*/
|
|
279
|
+
isDisposed(): boolean;
|
|
280
|
+
}
|