@classytic/labs 0.1.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/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/biology/enzyme-rate/index.d.mts +1 -0
- package/dist/biology/enzyme-rate/preset.d.mts +25 -0
- package/dist/biology/enzyme-rate/preset.mjs +256 -0
- package/dist/biology/genetic-cross/core.d.mts +64 -0
- package/dist/biology/genetic-cross/core.mjs +147 -0
- package/dist/biology/genetic-cross/grid.mjs +239 -0
- package/dist/biology/genetic-cross/index.d.mts +3 -0
- package/dist/biology/genetic-cross/preset.d.mts +26 -0
- package/dist/biology/genetic-cross/preset.mjs +184 -0
- package/dist/biology/genetic-cross/sex-linked.d.mts +27 -0
- package/dist/biology/genetic-cross/sex-linked.mjs +226 -0
- package/dist/biology/index.d.mts +11 -0
- package/dist/biology/index.mjs +12 -0
- package/dist/biology/photosynthesis-factors/index.d.mts +1 -0
- package/dist/biology/photosynthesis-factors/preset.d.mts +25 -0
- package/dist/biology/photosynthesis-factors/preset.mjs +270 -0
- package/dist/biology/punnett-cross/index.d.mts +1 -0
- package/dist/biology/punnett-cross/preset.d.mts +27 -0
- package/dist/biology/punnett-cross/preset.mjs +21 -0
- package/dist/biology/respiration/index.d.mts +1 -0
- package/dist/biology/respiration/preset.d.mts +17 -0
- package/dist/biology/respiration/preset.mjs +179 -0
- package/dist/biology/sequence/central-dogma.d.mts +17 -0
- package/dist/biology/sequence/central-dogma.mjs +339 -0
- package/dist/biology/sequence/core.d.mts +38 -0
- package/dist/biology/sequence/core.mjs +178 -0
- package/dist/biology/sequence/index.d.mts +3 -0
- package/dist/biology/sequence/preset.d.mts +20 -0
- package/dist/biology/sequence/preset.mjs +235 -0
- package/dist/blocks/accounting.d.mts +142 -0
- package/dist/blocks/accounting.mjs +446 -0
- package/dist/blocks/authoring.d.mts +12 -0
- package/dist/blocks/authoring.mjs +705 -0
- package/dist/blocks/biology.d.mts +197 -0
- package/dist/blocks/biology.mjs +513 -0
- package/dist/blocks/chem.d.mts +128 -0
- package/dist/blocks/chem.mjs +486 -0
- package/dist/blocks/circuits.d.mts +86 -0
- package/dist/blocks/circuits.mjs +348 -0
- package/dist/blocks/discrete.d.mts +62 -0
- package/dist/blocks/discrete.mjs +314 -0
- package/dist/blocks/economics.d.mts +56 -0
- package/dist/blocks/economics.mjs +203 -0
- package/dist/blocks/geography.d.mts +58 -0
- package/dist/blocks/geography.mjs +115 -0
- package/dist/blocks/geometry.d.mts +28 -0
- package/dist/blocks/geometry.mjs +160 -0
- package/dist/blocks/ict.d.mts +65 -0
- package/dist/blocks/ict.mjs +197 -0
- package/dist/blocks/index.d.mts +4555 -0
- package/dist/blocks/index.mjs +120 -0
- package/dist/blocks/lab-block.d.mts +16 -0
- package/dist/blocks/lab-block.mjs +74 -0
- package/dist/blocks/lab-config.d.mts +23 -0
- package/dist/blocks/lab-config.mjs +200 -0
- package/dist/blocks/lab-gallery.d.mts +30 -0
- package/dist/blocks/lab-gallery.mjs +208 -0
- package/dist/blocks/language.d.mts +349 -0
- package/dist/blocks/language.mjs +750 -0
- package/dist/blocks/lesson.d.mts +43 -0
- package/dist/blocks/lesson.mjs +140 -0
- package/dist/blocks/math.d.mts +411 -0
- package/dist/blocks/math.mjs +1536 -0
- package/dist/blocks/ml.d.mts +84 -0
- package/dist/blocks/ml.mjs +146 -0
- package/dist/blocks/physics.d.mts +259 -0
- package/dist/blocks/physics.mjs +868 -0
- package/dist/blocks/statistics.d.mts +29 -0
- package/dist/blocks/statistics.mjs +123 -0
- package/dist/catalog/index.d.mts +3 -0
- package/dist/catalog/index.mjs +8 -0
- package/dist/catalog/registry.d.mts +46 -0
- package/dist/catalog/registry.mjs +56 -0
- package/dist/catalog/templates.d.mts +11 -0
- package/dist/catalog/templates.mjs +141 -0
- package/dist/chem/battery.d.mts +16 -0
- package/dist/chem/battery.mjs +311 -0
- package/dist/chem/bohr-atom.d.mts +16 -0
- package/dist/chem/bohr-atom.mjs +212 -0
- package/dist/chem/diffusion/asset.mjs +76 -0
- package/dist/chem/diffusion/index.d.mts +1 -0
- package/dist/chem/diffusion/preset.d.mts +15 -0
- package/dist/chem/diffusion/preset.mjs +188 -0
- package/dist/chem/electrochem/index.d.mts +1 -0
- package/dist/chem/electrochem/preset.d.mts +23 -0
- package/dist/chem/electrochem/preset.mjs +402 -0
- package/dist/chem/equilibrium/index.d.mts +1 -0
- package/dist/chem/equilibrium/preset.d.mts +36 -0
- package/dist/chem/equilibrium/preset.mjs +416 -0
- package/dist/chem/gas-box/index.d.mts +1 -0
- package/dist/chem/gas-box/preset.d.mts +27 -0
- package/dist/chem/gas-box/preset.mjs +395 -0
- package/dist/chem/index.d.mts +16 -0
- package/dist/chem/index.mjs +17 -0
- package/dist/chem/kinetics/index.d.mts +1 -0
- package/dist/chem/kinetics/preset.d.mts +31 -0
- package/dist/chem/kinetics/preset.mjs +478 -0
- package/dist/chem/periodic-trends/index.d.mts +1 -0
- package/dist/chem/periodic-trends/preset.d.mts +21 -0
- package/dist/chem/periodic-trends/preset.mjs +831 -0
- package/dist/chem/reaction-lab.d.mts +18 -0
- package/dist/chem/reaction-lab.mjs +165 -0
- package/dist/chem/reaction-profile.d.mts +21 -0
- package/dist/chem/reaction-profile.mjs +287 -0
- package/dist/chem/solution/dilution.d.mts +27 -0
- package/dist/chem/solution/dilution.mjs +199 -0
- package/dist/chem/solution/field.d.mts +30 -0
- package/dist/chem/solution/field.mjs +145 -0
- package/dist/chem/solution/index.d.mts +3 -0
- package/dist/chem/solution/solution-box.d.mts +28 -0
- package/dist/chem/solution/solution-box.mjs +140 -0
- package/dist/chem/stoichiometry/index.d.mts +1 -0
- package/dist/chem/stoichiometry/preset.d.mts +29 -0
- package/dist/chem/stoichiometry/preset.mjs +392 -0
- package/dist/chem/titration/index.d.mts +1 -0
- package/dist/chem/titration/preset.d.mts +29 -0
- package/dist/chem/titration/preset.mjs +436 -0
- package/dist/circuits/ac-dc/asset.mjs +295 -0
- package/dist/circuits/ac-dc/index.d.mts +1 -0
- package/dist/circuits/ac-dc/preset.d.mts +16 -0
- package/dist/circuits/ac-dc/preset.mjs +134 -0
- package/dist/circuits/capacitor-leak/index.d.mts +1 -0
- package/dist/circuits/capacitor-leak/preset.d.mts +32 -0
- package/dist/circuits/capacitor-leak/preset.mjs +271 -0
- package/dist/circuits/circuit/asset.d.mts +6 -0
- package/dist/circuits/circuit/asset.mjs +367 -0
- package/dist/circuits/circuit/index.d.mts +2 -0
- package/dist/circuits/circuit/preset.d.mts +46 -0
- package/dist/circuits/circuit/preset.mjs +235 -0
- package/dist/circuits/circuit-builder.d.mts +30 -0
- package/dist/circuits/circuit-builder.mjs +412 -0
- package/dist/circuits/circuit-lab.d.mts +20 -0
- package/dist/circuits/circuit-lab.mjs +400 -0
- package/dist/circuits/index.d.mts +7 -0
- package/dist/circuits/index.mjs +8 -0
- package/dist/commerce/accounting/core.d.mts +48 -0
- package/dist/commerce/accounting/core.mjs +57 -0
- package/dist/commerce/accounting/equation-balance.d.mts +35 -0
- package/dist/commerce/accounting/equation-balance.mjs +292 -0
- package/dist/commerce/accounting/index.d.mts +4 -0
- package/dist/commerce/accounting/journal-poster.d.mts +29 -0
- package/dist/commerce/accounting/journal-poster.mjs +472 -0
- package/dist/commerce/accounting/statement-sorter.d.mts +25 -0
- package/dist/commerce/accounting/statement-sorter.mjs +304 -0
- package/dist/commerce/economics/core.d.mts +33 -0
- package/dist/commerce/economics/core.mjs +26 -0
- package/dist/commerce/economics/demand-shift-vs-move.d.mts +35 -0
- package/dist/commerce/economics/demand-shift-vs-move.mjs +324 -0
- package/dist/commerce/economics/elasticity-revenue.d.mts +31 -0
- package/dist/commerce/economics/elasticity-revenue.mjs +253 -0
- package/dist/commerce/economics/index.d.mts +4 -0
- package/dist/commerce/economics/market-equilibrium.d.mts +33 -0
- package/dist/commerce/economics/market-equilibrium.mjs +340 -0
- package/dist/commerce/index.d.mts +9 -0
- package/dist/commerce/index.mjs +10 -0
- package/dist/core/easing.d.mts +28 -0
- package/dist/core/easing.mjs +66 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.mjs +11 -0
- package/dist/core/numeric.d.mts +37 -0
- package/dist/core/numeric.mjs +75 -0
- package/dist/core/reactive.d.mts +24 -0
- package/dist/core/reactive.mjs +51 -0
- package/dist/core/rng.d.mts +21 -0
- package/dist/core/rng.mjs +39 -0
- package/dist/core/tex.d.mts +14 -0
- package/dist/core/tex.mjs +44 -0
- package/dist/core/timeline.d.mts +34 -0
- package/dist/core/timeline.mjs +77 -0
- package/dist/core/util.d.mts +19 -0
- package/dist/core/util.mjs +31 -0
- package/dist/discrete/arrangements/preset.d.mts +28 -0
- package/dist/discrete/arrangements/preset.mjs +304 -0
- package/dist/discrete/bayes/preset.d.mts +33 -0
- package/dist/discrete/bayes/preset.mjs +476 -0
- package/dist/discrete/binomial/preset.d.mts +25 -0
- package/dist/discrete/binomial/preset.mjs +333 -0
- package/dist/discrete/core/combinatorics.d.mts +23 -0
- package/dist/discrete/core/combinatorics.mjs +57 -0
- package/dist/discrete/core/inclusionExclusion.d.mts +19 -0
- package/dist/discrete/core/inclusionExclusion.mjs +30 -0
- package/dist/discrete/core/pigeonhole.d.mts +15 -0
- package/dist/discrete/core/pigeonhole.mjs +24 -0
- package/dist/discrete/core/probability.d.mts +29 -0
- package/dist/discrete/core/probability.mjs +43 -0
- package/dist/discrete/core/sets.d.mts +21 -0
- package/dist/discrete/core/sets.mjs +45 -0
- package/dist/discrete/counting-slots/preset.d.mts +30 -0
- package/dist/discrete/counting-slots/preset.mjs +553 -0
- package/dist/discrete/counting-tree/index.d.mts +1 -0
- package/dist/discrete/counting-tree/preset.d.mts +44 -0
- package/dist/discrete/counting-tree/preset.mjs +364 -0
- package/dist/discrete/expected-value/preset.d.mts +28 -0
- package/dist/discrete/expected-value/preset.mjs +352 -0
- package/dist/discrete/hypergeometric/preset.d.mts +25 -0
- package/dist/discrete/hypergeometric/preset.mjs +330 -0
- package/dist/discrete/index.d.mts +26 -0
- package/dist/discrete/index.mjs +27 -0
- package/dist/discrete/karnaugh/index.d.mts +1 -0
- package/dist/discrete/karnaugh/preset.d.mts +30 -0
- package/dist/discrete/karnaugh/preset.mjs +452 -0
- package/dist/discrete/lln/asset.mjs +206 -0
- package/dist/discrete/lln/index.d.mts +1 -0
- package/dist/discrete/lln/preset.d.mts +17 -0
- package/dist/discrete/lln/preset.mjs +152 -0
- package/dist/discrete/logic-circuit/index.d.mts +1 -0
- package/dist/discrete/logic-circuit/preset.d.mts +47 -0
- package/dist/discrete/logic-circuit/preset.mjs +307 -0
- package/dist/discrete/monte-carlo/index.d.mts +1 -0
- package/dist/discrete/monte-carlo/preset.d.mts +64 -0
- package/dist/discrete/monte-carlo/preset.mjs +446 -0
- package/dist/discrete/monty-hall/index.d.mts +1 -0
- package/dist/discrete/monty-hall/preset.d.mts +23 -0
- package/dist/discrete/monty-hall/preset.mjs +491 -0
- package/dist/discrete/outcome-builder/preset.d.mts +24 -0
- package/dist/discrete/outcome-builder/preset.mjs +283 -0
- package/dist/discrete/pascal/preset.d.mts +24 -0
- package/dist/discrete/pascal/preset.mjs +372 -0
- package/dist/discrete/sample-space/index.d.mts +1 -0
- package/dist/discrete/sample-space/preset.d.mts +42 -0
- package/dist/discrete/sample-space/preset.mjs +395 -0
- package/dist/discrete/selection/preset.d.mts +33 -0
- package/dist/discrete/selection/preset.mjs +406 -0
- package/dist/discrete/truth-table/index.d.mts +1 -0
- package/dist/discrete/truth-table/preset.d.mts +30 -0
- package/dist/discrete/truth-table/preset.mjs +456 -0
- package/dist/discrete/venn/index.d.mts +1 -0
- package/dist/discrete/venn/preset.d.mts +32 -0
- package/dist/discrete/venn/preset.mjs +461 -0
- package/dist/geography/cycle-lab/index.d.mts +1 -0
- package/dist/geography/cycle-lab/preset.d.mts +25 -0
- package/dist/geography/cycle-lab/preset.mjs +254 -0
- package/dist/geography/cycles.d.mts +21 -0
- package/dist/geography/cycles.mjs +205 -0
- package/dist/geography/index.d.mts +4 -0
- package/dist/geography/index.mjs +5 -0
- package/dist/geometry/board/index.d.mts +1 -0
- package/dist/geometry/board/preset.d.mts +71 -0
- package/dist/geometry/board/preset.mjs +148 -0
- package/dist/geometry/builder.d.mts +18 -0
- package/dist/geometry/builder.mjs +332 -0
- package/dist/geometry/index.d.mts +4 -0
- package/dist/geometry/index.mjs +5 -0
- package/dist/geometry/intersecting-circles.d.mts +17 -0
- package/dist/geometry/intersecting-circles.mjs +104 -0
- package/dist/ict/index.d.mts +5 -0
- package/dist/ict/index.mjs +6 -0
- package/dist/ict/number-systems/base-odometer.d.mts +34 -0
- package/dist/ict/number-systems/base-odometer.mjs +160 -0
- package/dist/ict/number-systems/bit-grouper.d.mts +32 -0
- package/dist/ict/number-systems/bit-grouper.mjs +190 -0
- package/dist/ict/number-systems/index.d.mts +4 -0
- package/dist/ict/number-systems/place-value-dial.d.mts +29 -0
- package/dist/ict/number-systems/place-value-dial.mjs +153 -0
- package/dist/ict/number-systems/wheel.d.mts +73 -0
- package/dist/ict/number-systems/wheel.mjs +279 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/kit/anim.mjs +52 -0
- package/dist/kit/annotate.mjs +116 -0
- package/dist/kit/answer-check.d.mts +38 -0
- package/dist/kit/answer-check.mjs +65 -0
- package/dist/kit/asset-util.mjs +15 -0
- package/dist/kit/controls.mjs +77 -0
- package/dist/kit/cycle.d.mts +44 -0
- package/dist/kit/cycle.mjs +188 -0
- package/dist/kit/diagram.mjs +176 -0
- package/dist/kit/electronics.mjs +357 -0
- package/dist/kit/expr-analysis.d.mts +37 -0
- package/dist/kit/expr-analysis.mjs +111 -0
- package/dist/kit/frame.d.mts +70 -0
- package/dist/kit/frame.mjs +205 -0
- package/dist/kit/freq-tree.mjs +99 -0
- package/dist/kit/gameshow.mjs +315 -0
- package/dist/kit/index.d.mts +5 -0
- package/dist/kit/index.mjs +6 -0
- package/dist/kit/logic-gates.d.mts +6 -0
- package/dist/kit/logic-gates.mjs +210 -0
- package/dist/kit/molecules.mjs +178 -0
- package/dist/kit/pedagogy.d.mts +126 -0
- package/dist/kit/pedagogy.mjs +331 -0
- package/dist/kit/play.d.mts +21 -0
- package/dist/kit/play.mjs +52 -0
- package/dist/kit/probability.mjs +141 -0
- package/dist/kit/proportion.mjs +112 -0
- package/dist/kit/reaction.mjs +102 -0
- package/dist/kit/rich.d.mts +10 -0
- package/dist/kit/rich.mjs +21 -0
- package/dist/kit/scale.mjs +230 -0
- package/dist/kit/space.mjs +326 -0
- package/dist/kit/steps.d.mts +24 -0
- package/dist/kit/steps.mjs +57 -0
- package/dist/kit/thermal.mjs +289 -0
- package/dist/language/agreement/index.d.mts +1 -0
- package/dist/language/agreement/preset.d.mts +27 -0
- package/dist/language/agreement/preset.mjs +113 -0
- package/dist/language/article-lens/index.d.mts +1 -0
- package/dist/language/article-lens/preset.d.mts +31 -0
- package/dist/language/article-lens/preset.mjs +125 -0
- package/dist/language/deck.d.mts +45 -0
- package/dist/language/deck.mjs +61 -0
- package/dist/language/icon.d.mts +40 -0
- package/dist/language/icon.mjs +73 -0
- package/dist/language/index.d.mts +10 -0
- package/dist/language/index.mjs +11 -0
- package/dist/language/preposition-scene/index.d.mts +1 -0
- package/dist/language/preposition-scene/preset.d.mts +34 -0
- package/dist/language/preposition-scene/preset.mjs +234 -0
- package/dist/language/sentence-builder/index.d.mts +1 -0
- package/dist/language/sentence-builder/preset.d.mts +32 -0
- package/dist/language/sentence-builder/preset.mjs +122 -0
- package/dist/language/transform/index.d.mts +1 -0
- package/dist/language/transform/preset.d.mts +31 -0
- package/dist/language/transform/preset.mjs +137 -0
- package/dist/language/ui.d.mts +53 -0
- package/dist/language/ui.mjs +88 -0
- package/dist/language/word-match/index.d.mts +1 -0
- package/dist/language/word-match/preset.d.mts +22 -0
- package/dist/language/word-match/preset.mjs +148 -0
- package/dist/math/area-model/asset.d.mts +6 -0
- package/dist/math/area-model/asset.mjs +270 -0
- package/dist/math/area-model/index.d.mts +2 -0
- package/dist/math/area-model/preset.d.mts +29 -0
- package/dist/math/area-model/preset.mjs +243 -0
- package/dist/math/balance-algebra/asset.d.mts +6 -0
- package/dist/math/balance-algebra/asset.mjs +150 -0
- package/dist/math/balance-algebra/index.d.mts +2 -0
- package/dist/math/balance-algebra/preset.d.mts +30 -0
- package/dist/math/balance-algebra/preset.mjs +228 -0
- package/dist/math/derivation.d.mts +22 -0
- package/dist/math/derivation.mjs +113 -0
- package/dist/math/derivative-explorer/index.d.mts +1 -0
- package/dist/math/derivative-explorer/preset.d.mts +19 -0
- package/dist/math/derivative-explorer/preset.mjs +227 -0
- package/dist/math/function-machine/index.d.mts +1 -0
- package/dist/math/function-machine/preset.d.mts +21 -0
- package/dist/math/function-machine/preset.mjs +177 -0
- package/dist/math/gradient-descent.d.mts +23 -0
- package/dist/math/gradient-descent.mjs +473 -0
- package/dist/math/grapher/index.d.mts +1 -0
- package/dist/math/grapher/preset.d.mts +40 -0
- package/dist/math/grapher/preset.mjs +313 -0
- package/dist/math/harmonic-form/index.d.mts +1 -0
- package/dist/math/harmonic-form/preset.d.mts +21 -0
- package/dist/math/harmonic-form/preset.mjs +387 -0
- package/dist/math/index.d.mts +25 -0
- package/dist/math/index.mjs +26 -0
- package/dist/math/integral-explorer/index.d.mts +1 -0
- package/dist/math/integral-explorer/preset.d.mts +23 -0
- package/dist/math/integral-explorer/preset.mjs +217 -0
- package/dist/math/interactive/index.d.mts +1 -0
- package/dist/math/interactive/preset.d.mts +72 -0
- package/dist/math/interactive/preset.mjs +202 -0
- package/dist/math/limit-explorer/index.d.mts +1 -0
- package/dist/math/limit-explorer/preset.d.mts +19 -0
- package/dist/math/limit-explorer/preset.mjs +216 -0
- package/dist/math/linear-system/index.d.mts +1 -0
- package/dist/math/linear-system/preset.d.mts +28 -0
- package/dist/math/linear-system/preset.mjs +164 -0
- package/dist/math/mystery-bucket/asset.d.mts +6 -0
- package/dist/math/mystery-bucket/asset.mjs +145 -0
- package/dist/math/mystery-bucket/index.d.mts +2 -0
- package/dist/math/mystery-bucket/preset.d.mts +36 -0
- package/dist/math/mystery-bucket/preset.mjs +116 -0
- package/dist/math/number-line/index.d.mts +1 -0
- package/dist/math/number-line/preset.d.mts +24 -0
- package/dist/math/number-line/preset.mjs +142 -0
- package/dist/math/parabola/index.d.mts +1 -0
- package/dist/math/parabola/preset.d.mts +13 -0
- package/dist/math/parabola/preset.mjs +79 -0
- package/dist/math/pattern/asset.d.mts +6 -0
- package/dist/math/pattern/asset.mjs +102 -0
- package/dist/math/pattern/index.d.mts +2 -0
- package/dist/math/pattern/preset.d.mts +32 -0
- package/dist/math/pattern/preset.mjs +294 -0
- package/dist/math/triangle-trig/index.d.mts +1 -0
- package/dist/math/triangle-trig/preset.d.mts +47 -0
- package/dist/math/triangle-trig/preset.mjs +245 -0
- package/dist/math/trig-explorer.d.mts +18 -0
- package/dist/math/trig-explorer.mjs +209 -0
- package/dist/ml/boundary/index.d.mts +1 -0
- package/dist/ml/boundary/preset.d.mts +24 -0
- package/dist/ml/boundary/preset.mjs +385 -0
- package/dist/ml/classifier/index.d.mts +1 -0
- package/dist/ml/classifier/preset.d.mts +25 -0
- package/dist/ml/classifier/preset.mjs +315 -0
- package/dist/ml/index.d.mts +6 -0
- package/dist/ml/index.mjs +7 -0
- package/dist/ml/kmeans/index.d.mts +1 -0
- package/dist/ml/kmeans/preset.d.mts +33 -0
- package/dist/ml/kmeans/preset.mjs +236 -0
- package/dist/ml/knn/index.d.mts +1 -0
- package/dist/ml/knn/preset.d.mts +28 -0
- package/dist/ml/knn/preset.mjs +279 -0
- package/dist/ml/regression/index.d.mts +1 -0
- package/dist/ml/regression/preset.d.mts +32 -0
- package/dist/ml/regression/preset.mjs +394 -0
- package/dist/physics/atwood/index.d.mts +1 -0
- package/dist/physics/atwood/preset.d.mts +23 -0
- package/dist/physics/atwood/preset.mjs +312 -0
- package/dist/physics/bullet-walls/index.d.mts +1 -0
- package/dist/physics/bullet-walls/preset.d.mts +28 -0
- package/dist/physics/bullet-walls/preset.mjs +373 -0
- package/dist/physics/carnot/index.d.mts +1 -0
- package/dist/physics/carnot/preset.d.mts +27 -0
- package/dist/physics/carnot/preset.mjs +427 -0
- package/dist/physics/circular-motion/index.d.mts +1 -0
- package/dist/physics/circular-motion/preset.d.mts +25 -0
- package/dist/physics/circular-motion/preset.mjs +293 -0
- package/dist/physics/collision-track/index.d.mts +1 -0
- package/dist/physics/collision-track/preset.d.mts +27 -0
- package/dist/physics/collision-track/preset.mjs +352 -0
- package/dist/physics/efficiency/index.d.mts +1 -0
- package/dist/physics/efficiency/preset.d.mts +33 -0
- package/dist/physics/efficiency/preset.mjs +343 -0
- package/dist/physics/electric-field/index.d.mts +1 -0
- package/dist/physics/electric-field/preset.d.mts +15 -0
- package/dist/physics/electric-field/preset.mjs +306 -0
- package/dist/physics/energy-skate/index.d.mts +1 -0
- package/dist/physics/energy-skate/preset.d.mts +25 -0
- package/dist/physics/energy-skate/preset.mjs +254 -0
- package/dist/physics/entropy/index.d.mts +1 -0
- package/dist/physics/entropy/preset.d.mts +18 -0
- package/dist/physics/entropy/preset.mjs +416 -0
- package/dist/physics/expansion/index.d.mts +1 -0
- package/dist/physics/expansion/preset.d.mts +26 -0
- package/dist/physics/expansion/preset.mjs +609 -0
- package/dist/physics/exponential/asset.mjs +221 -0
- package/dist/physics/exponential/index.d.mts +1 -0
- package/dist/physics/exponential/preset.d.mts +17 -0
- package/dist/physics/exponential/preset.mjs +182 -0
- package/dist/physics/gas-process/index.d.mts +1 -0
- package/dist/physics/gas-process/preset.d.mts +30 -0
- package/dist/physics/gas-process/preset.mjs +384 -0
- package/dist/physics/gravitation/index.d.mts +1 -0
- package/dist/physics/gravitation/preset.d.mts +24 -0
- package/dist/physics/gravitation/preset.mjs +345 -0
- package/dist/physics/gravity-drop.d.mts +9 -0
- package/dist/physics/gravity-drop.mjs +187 -0
- package/dist/physics/heat-transfer/index.d.mts +1 -0
- package/dist/physics/heat-transfer/preset.d.mts +27 -0
- package/dist/physics/heat-transfer/preset.mjs +626 -0
- package/dist/physics/impulse/index.d.mts +1 -0
- package/dist/physics/impulse/preset.d.mts +29 -0
- package/dist/physics/impulse/preset.mjs +453 -0
- package/dist/physics/index.d.mts +43 -0
- package/dist/physics/index.mjs +44 -0
- package/dist/physics/kepler/index.d.mts +1 -0
- package/dist/physics/kepler/preset.d.mts +27 -0
- package/dist/physics/kepler/preset.mjs +257 -0
- package/dist/physics/lever/asset.d.mts +6 -0
- package/dist/physics/lever/asset.mjs +220 -0
- package/dist/physics/lever/index.d.mts +2 -0
- package/dist/physics/lever/preset.d.mts +31 -0
- package/dist/physics/lever/preset.mjs +261 -0
- package/dist/physics/lorentz/index.d.mts +1 -0
- package/dist/physics/lorentz/preset.d.mts +29 -0
- package/dist/physics/lorentz/preset.mjs +367 -0
- package/dist/physics/magnetism/index.d.mts +1 -0
- package/dist/physics/magnetism/preset.d.mts +15 -0
- package/dist/physics/magnetism/preset.mjs +334 -0
- package/dist/physics/optics/asset.d.mts +6 -0
- package/dist/physics/optics/asset.mjs +234 -0
- package/dist/physics/optics/index.d.mts +2 -0
- package/dist/physics/optics/preset.d.mts +14 -0
- package/dist/physics/optics/preset.mjs +202 -0
- package/dist/physics/orbit-lab.d.mts +6 -0
- package/dist/physics/orbit-lab.mjs +222 -0
- package/dist/physics/projectile-lab.d.mts +10 -0
- package/dist/physics/projectile-lab.mjs +354 -0
- package/dist/physics/rain-relative/index.d.mts +1 -0
- package/dist/physics/rain-relative/preset.d.mts +19 -0
- package/dist/physics/rain-relative/preset.mjs +358 -0
- package/dist/physics/ramp-forces/index.d.mts +1 -0
- package/dist/physics/ramp-forces/preset.d.mts +36 -0
- package/dist/physics/ramp-forces/preset.mjs +550 -0
- package/dist/physics/river-boat.d.mts +22 -0
- package/dist/physics/river-boat.mjs +498 -0
- package/dist/physics/shm/index.d.mts +1 -0
- package/dist/physics/shm/preset.d.mts +33 -0
- package/dist/physics/shm/preset.mjs +554 -0
- package/dist/physics/stopping-distance/index.d.mts +1 -0
- package/dist/physics/stopping-distance/preset.d.mts +29 -0
- package/dist/physics/stopping-distance/preset.mjs +662 -0
- package/dist/physics/temperature-scales/index.d.mts +1 -0
- package/dist/physics/temperature-scales/preset.d.mts +15 -0
- package/dist/physics/temperature-scales/preset.mjs +353 -0
- package/dist/physics/terminal-velocity/index.d.mts +1 -0
- package/dist/physics/terminal-velocity/preset.d.mts +26 -0
- package/dist/physics/terminal-velocity/preset.mjs +404 -0
- package/dist/physics/thermal/index.d.mts +1 -0
- package/dist/physics/thermal/preset.d.mts +44 -0
- package/dist/physics/thermal/preset.mjs +373 -0
- package/dist/physics/vector-board/index.d.mts +1 -0
- package/dist/physics/vector-board/preset.d.mts +65 -0
- package/dist/physics/vector-board/preset.mjs +273 -0
- package/dist/physics/vector-board/view.d.mts +49 -0
- package/dist/physics/vector-board/view.mjs +58 -0
- package/dist/physics/vector-scene.d.mts +41 -0
- package/dist/physics/vector-scene.mjs +211 -0
- package/dist/physics/vector-types/index.d.mts +1 -0
- package/dist/physics/vector-types/preset.d.mts +27 -0
- package/dist/physics/vector-types/preset.mjs +192 -0
- package/dist/physics/water-density/index.d.mts +1 -0
- package/dist/physics/water-density/preset.d.mts +18 -0
- package/dist/physics/water-density/preset.mjs +439 -0
- package/dist/physics/waves/core.mjs +33 -0
- package/dist/physics/waves/doppler.d.mts +23 -0
- package/dist/physics/waves/doppler.mjs +260 -0
- package/dist/physics/waves/index.d.mts +4 -0
- package/dist/physics/waves/preset.d.mts +30 -0
- package/dist/physics/waves/preset.mjs +488 -0
- package/dist/physics/waves/ripple.d.mts +26 -0
- package/dist/physics/waves/ripple.mjs +234 -0
- package/dist/physics/waves/string.d.mts +29 -0
- package/dist/physics/waves/string.mjs +289 -0
- package/dist/physics/work-energy/index.d.mts +1 -0
- package/dist/physics/work-energy/preset.d.mts +17 -0
- package/dist/physics/work-energy/preset.mjs +341 -0
- package/dist/schemas/index.d.mts +235 -0
- package/dist/schemas/index.mjs +145 -0
- package/dist/statistics/center-spread/preset.d.mts +34 -0
- package/dist/statistics/center-spread/preset.mjs +323 -0
- package/dist/statistics/core/descriptive.d.mts +35 -0
- package/dist/statistics/core/descriptive.mjs +64 -0
- package/dist/statistics/core/normal.d.mts +21 -0
- package/dist/statistics/core/normal.mjs +37 -0
- package/dist/statistics/core/sequences.d.mts +27 -0
- package/dist/statistics/core/sequences.mjs +35 -0
- package/dist/statistics/galton/preset.d.mts +27 -0
- package/dist/statistics/galton/preset.mjs +331 -0
- package/dist/statistics/histogram/preset.d.mts +27 -0
- package/dist/statistics/histogram/preset.mjs +385 -0
- package/dist/statistics/index.d.mts +11 -0
- package/dist/statistics/index.mjs +12 -0
- package/dist/statistics/normal/preset.d.mts +30 -0
- package/dist/statistics/normal/preset.mjs +400 -0
- package/dist/statistics/sampling/preset.d.mts +32 -0
- package/dist/statistics/sampling/preset.mjs +406 -0
- package/dist/statistics/sequence/preset.d.mts +28 -0
- package/dist/statistics/sequence/preset.mjs +302 -0
- package/dist/statistics/z-table/preset.d.mts +28 -0
- package/dist/statistics/z-table/preset.mjs +348 -0
- package/package.json +266 -0
- package/styles.css +267 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Callout, LabFrame, LiveRegion } from "../../kit/frame.mjs";
|
|
4
|
+
import { useCheckpoint } from "../../kit/pedagogy.mjs";
|
|
5
|
+
import { OPTICS_RAY_ASSET } from "./asset.mjs";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Scene, isAssetGeom, registerAsset, resolve } from "@classytic/stage";
|
|
9
|
+
|
|
10
|
+
//#region src/physics/optics/preset.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Optics flagship — drag the source, the aim point, or the mirrors so the light
|
|
13
|
+
* ray reflects into the target. A general tool built on @classytic/stage:
|
|
14
|
+
* creators place any mirrors + target.
|
|
15
|
+
*/
|
|
16
|
+
registerAsset("optics-ray", OPTICS_RAY_ASSET);
|
|
17
|
+
const MIRROR = { hidden: true };
|
|
18
|
+
function opticsDoc() {
|
|
19
|
+
return {
|
|
20
|
+
schemaVersion: 2,
|
|
21
|
+
type: "stage-scene",
|
|
22
|
+
view: {
|
|
23
|
+
xMin: -8,
|
|
24
|
+
xMax: 8,
|
|
25
|
+
yMin: -5,
|
|
26
|
+
yMax: 5
|
|
27
|
+
},
|
|
28
|
+
elements: [
|
|
29
|
+
{
|
|
30
|
+
id: "S",
|
|
31
|
+
kind: "point",
|
|
32
|
+
label: "source",
|
|
33
|
+
a11y: { label: "light source" },
|
|
34
|
+
style: { color: "var(--stage-warn)" },
|
|
35
|
+
free: {
|
|
36
|
+
at: {
|
|
37
|
+
x: -6,
|
|
38
|
+
y: -3
|
|
39
|
+
},
|
|
40
|
+
draggable: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "aim",
|
|
45
|
+
kind: "point",
|
|
46
|
+
label: "aim",
|
|
47
|
+
style: { color: "var(--stage-warn)" },
|
|
48
|
+
free: {
|
|
49
|
+
at: {
|
|
50
|
+
x: -3.4,
|
|
51
|
+
y: -1.2
|
|
52
|
+
},
|
|
53
|
+
draggable: true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "T",
|
|
58
|
+
kind: "point",
|
|
59
|
+
label: "target",
|
|
60
|
+
style: { color: "var(--stage-good)" },
|
|
61
|
+
free: { at: {
|
|
62
|
+
x: 6,
|
|
63
|
+
y: 3
|
|
64
|
+
} }
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "M1a",
|
|
68
|
+
kind: "point",
|
|
69
|
+
style: { color: "var(--stage-metal)" },
|
|
70
|
+
free: {
|
|
71
|
+
at: {
|
|
72
|
+
x: -1,
|
|
73
|
+
y: 4
|
|
74
|
+
},
|
|
75
|
+
draggable: true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "M1b",
|
|
80
|
+
kind: "point",
|
|
81
|
+
style: { color: "var(--stage-metal)" },
|
|
82
|
+
free: {
|
|
83
|
+
at: {
|
|
84
|
+
x: 2,
|
|
85
|
+
y: -2
|
|
86
|
+
},
|
|
87
|
+
draggable: true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "m1",
|
|
92
|
+
kind: "segment",
|
|
93
|
+
style: MIRROR,
|
|
94
|
+
def: {
|
|
95
|
+
op: "segment",
|
|
96
|
+
from: { ref: "M1a" },
|
|
97
|
+
to: { ref: "M1b" }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "M2a",
|
|
102
|
+
kind: "point",
|
|
103
|
+
style: { color: "var(--stage-metal)" },
|
|
104
|
+
free: {
|
|
105
|
+
at: {
|
|
106
|
+
x: 3,
|
|
107
|
+
y: 4
|
|
108
|
+
},
|
|
109
|
+
draggable: true
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "M2b",
|
|
114
|
+
kind: "point",
|
|
115
|
+
style: { color: "var(--stage-metal)" },
|
|
116
|
+
free: {
|
|
117
|
+
at: {
|
|
118
|
+
x: 6,
|
|
119
|
+
y: -1
|
|
120
|
+
},
|
|
121
|
+
draggable: true
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "m2",
|
|
126
|
+
kind: "segment",
|
|
127
|
+
style: MIRROR,
|
|
128
|
+
def: {
|
|
129
|
+
op: "segment",
|
|
130
|
+
from: { ref: "M2a" },
|
|
131
|
+
to: { ref: "M2b" }
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "ray",
|
|
136
|
+
kind: "asset",
|
|
137
|
+
def: {
|
|
138
|
+
op: "asset",
|
|
139
|
+
asset: "optics-ray",
|
|
140
|
+
params: {
|
|
141
|
+
maxBounces: 8,
|
|
142
|
+
targetR: .6,
|
|
143
|
+
far: 60
|
|
144
|
+
},
|
|
145
|
+
bind: {
|
|
146
|
+
source: { ref: "S" },
|
|
147
|
+
aim: { ref: "aim" },
|
|
148
|
+
target: { ref: "T" },
|
|
149
|
+
m0: { ref: "m1" },
|
|
150
|
+
m1: { ref: "m2" }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
bindings: []
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function OpticsLab({ height = 380 }) {
|
|
159
|
+
const [doc, setDoc] = useState(() => opticsDoc());
|
|
160
|
+
const geom = useMemo(() => resolve(doc), [doc]).values.get("ray");
|
|
161
|
+
const hit = isAssetGeom(geom) && geom.meta?.hit === true;
|
|
162
|
+
const bounces = isAssetGeom(geom) ? Number(geom.meta?.bounces ?? 0) : 0;
|
|
163
|
+
useCheckpoint({
|
|
164
|
+
solved: hit,
|
|
165
|
+
activity: "optics-light-target"
|
|
166
|
+
});
|
|
167
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
168
|
+
title: "Reflect the beam into the target",
|
|
169
|
+
prompt: "Drag the source, the aim point, or the mirrors so the ray reflects into the target.",
|
|
170
|
+
aside: /* @__PURE__ */ jsx(Callout, {
|
|
171
|
+
tone: "result",
|
|
172
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
173
|
+
style: {
|
|
174
|
+
display: "grid",
|
|
175
|
+
gap: 4
|
|
176
|
+
},
|
|
177
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
178
|
+
style: { opacity: .8 },
|
|
179
|
+
children: ["bounces: ", bounces]
|
|
180
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
181
|
+
style: {
|
|
182
|
+
color: hit ? "var(--stage-good)" : "var(--stage-warn)",
|
|
183
|
+
fontWeight: 600
|
|
184
|
+
},
|
|
185
|
+
children: hit ? "✓ Target lit!" : "not yet — keep adjusting"
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
}),
|
|
189
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Scene, {
|
|
190
|
+
doc,
|
|
191
|
+
onChange: setDoc,
|
|
192
|
+
interactive: true,
|
|
193
|
+
showGrid: false,
|
|
194
|
+
showAxes: false,
|
|
195
|
+
height,
|
|
196
|
+
ariaLabel: "Optics: reflect the light ray into the target"
|
|
197
|
+
}), /* @__PURE__ */ jsx(LiveRegion, { children: hit ? "The light ray reaches the target." : "The ray misses the target." })] })
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
export { OpticsLab, opticsDoc };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { CheckButton, Chip, Slider, StatusPill } from "../kit/controls.mjs";
|
|
4
|
+
import { ControlBar, Field, LabFrame } from "../kit/frame.mjs";
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { CanvasLayer, useFrameLoop, useInView } from "@classytic/stage";
|
|
8
|
+
|
|
9
|
+
//#region src/physics/orbit-lab.tsx
|
|
10
|
+
/**
|
|
11
|
+
* OrbitLab — an orbit is just falling sideways fast enough to keep missing the
|
|
12
|
+
* ground. Too slow → crash; too fast → escape; just right → a closed ellipse.
|
|
13
|
+
*
|
|
14
|
+
* A genuine high-element-count animation (a 260-point fading trail + starfield +
|
|
15
|
+
* a sub-stepped N-body integrator mutating a ref every frame), so it renders on
|
|
16
|
+
* the engine's zero-dependency `<CanvasLayer>` (raw Canvas2D) rather than one SVG
|
|
17
|
+
* node per trail point — the same boundary GradientDescent uses.
|
|
18
|
+
*/
|
|
19
|
+
const GM = 9e3;
|
|
20
|
+
const R0 = 120;
|
|
21
|
+
const VIEW = {
|
|
22
|
+
xMin: -1,
|
|
23
|
+
xMax: 1,
|
|
24
|
+
yMin: -1,
|
|
25
|
+
yMax: 1
|
|
26
|
+
};
|
|
27
|
+
function OrbitLab() {
|
|
28
|
+
const [speed, setSpeed] = useState(1);
|
|
29
|
+
const [phase, setPhase] = useState("idle");
|
|
30
|
+
const [, setTick] = useState(0);
|
|
31
|
+
const circular = Math.sqrt(GM / R0);
|
|
32
|
+
const { ref: viewRef, inView } = useInView();
|
|
33
|
+
const sim = useRef({
|
|
34
|
+
x: R0,
|
|
35
|
+
y: 0,
|
|
36
|
+
vx: 0,
|
|
37
|
+
vy: -circular,
|
|
38
|
+
trail: []
|
|
39
|
+
});
|
|
40
|
+
const box = useRef({
|
|
41
|
+
w: 640,
|
|
42
|
+
h: 340
|
|
43
|
+
});
|
|
44
|
+
const resetSim = useCallback(() => {
|
|
45
|
+
sim.current = {
|
|
46
|
+
x: R0,
|
|
47
|
+
y: 0,
|
|
48
|
+
vx: 0,
|
|
49
|
+
vy: -circular * speed,
|
|
50
|
+
trail: []
|
|
51
|
+
};
|
|
52
|
+
}, [circular, speed]);
|
|
53
|
+
const draw = useCallback((ctx, c) => {
|
|
54
|
+
box.current = {
|
|
55
|
+
w: c.width,
|
|
56
|
+
h: c.height
|
|
57
|
+
};
|
|
58
|
+
const cx = c.width / 2, cy = c.height / 2;
|
|
59
|
+
ctx.clearRect(0, 0, c.width, c.height);
|
|
60
|
+
ctx.fillStyle = "color-mix(in oklab, var(--stage-fg) 22%, transparent)";
|
|
61
|
+
for (let i = 0; i < 22; i++) {
|
|
62
|
+
const a = i * 2.39996 % (Math.PI * 2);
|
|
63
|
+
const r = i * 53 % (Math.min(c.width, c.height) / 2 - 10) + 30;
|
|
64
|
+
ctx.beginPath();
|
|
65
|
+
ctx.arc(cx + Math.cos(a) * r, cy + Math.sin(a) * r, .7, 0, Math.PI * 2);
|
|
66
|
+
ctx.fill();
|
|
67
|
+
}
|
|
68
|
+
const tr = sim.current.trail;
|
|
69
|
+
if (tr.length === 0) {
|
|
70
|
+
ctx.strokeStyle = "color-mix(in oklab, var(--stage-accent) 35%, transparent)";
|
|
71
|
+
ctx.lineWidth = 1.5;
|
|
72
|
+
ctx.setLineDash([5, 6]);
|
|
73
|
+
ctx.beginPath();
|
|
74
|
+
ctx.arc(cx, cy, R0, 0, Math.PI * 2);
|
|
75
|
+
ctx.stroke();
|
|
76
|
+
ctx.setLineDash([]);
|
|
77
|
+
}
|
|
78
|
+
if (tr.length > 1) {
|
|
79
|
+
ctx.strokeStyle = "var(--stage-accent)";
|
|
80
|
+
ctx.lineWidth = 2;
|
|
81
|
+
ctx.lineJoin = "round";
|
|
82
|
+
ctx.globalAlpha = .55;
|
|
83
|
+
ctx.beginPath();
|
|
84
|
+
ctx.moveTo(cx + tr[0][0], cy + tr[0][1]);
|
|
85
|
+
for (let i = 1; i < tr.length; i++) ctx.lineTo(cx + tr[i][0], cy + tr[i][1]);
|
|
86
|
+
ctx.stroke();
|
|
87
|
+
ctx.globalAlpha = 1;
|
|
88
|
+
}
|
|
89
|
+
const glow = ctx.createRadialGradient(cx, cy, 8, cx, cy, 40);
|
|
90
|
+
glow.addColorStop(0, "color-mix(in oklab, oklch(0.7 0.13 250) 45%, transparent)");
|
|
91
|
+
glow.addColorStop(1, "transparent");
|
|
92
|
+
ctx.fillStyle = glow;
|
|
93
|
+
ctx.beginPath();
|
|
94
|
+
ctx.arc(cx, cy, 40, 0, Math.PI * 2);
|
|
95
|
+
ctx.fill();
|
|
96
|
+
const grd = ctx.createRadialGradient(cx - 4, cy - 4, 3, cx, cy, 20);
|
|
97
|
+
grd.addColorStop(0, "oklch(0.82 0.13 250)");
|
|
98
|
+
grd.addColorStop(1, "oklch(0.42 0.13 250)");
|
|
99
|
+
ctx.fillStyle = grd;
|
|
100
|
+
ctx.beginPath();
|
|
101
|
+
ctx.arc(cx, cy, 18, 0, Math.PI * 2);
|
|
102
|
+
ctx.fill();
|
|
103
|
+
const sx = cx + sim.current.x, sy = cy + sim.current.y;
|
|
104
|
+
ctx.fillStyle = "color-mix(in oklab, oklch(0.92 0.12 90) 35%, transparent)";
|
|
105
|
+
ctx.beginPath();
|
|
106
|
+
ctx.arc(sx, sy, 10, 0, Math.PI * 2);
|
|
107
|
+
ctx.fill();
|
|
108
|
+
ctx.fillStyle = "oklch(0.92 0.12 90)";
|
|
109
|
+
ctx.beginPath();
|
|
110
|
+
ctx.arc(sx, sy, 5.5, 0, Math.PI * 2);
|
|
111
|
+
ctx.fill();
|
|
112
|
+
}, []);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (phase !== "running") {
|
|
115
|
+
resetSim();
|
|
116
|
+
setTick((n) => n + 1);
|
|
117
|
+
}
|
|
118
|
+
}, [resetSim, phase]);
|
|
119
|
+
useFrameLoop(() => {
|
|
120
|
+
const s = sim.current;
|
|
121
|
+
const { w, h } = box.current;
|
|
122
|
+
const bound = Math.min(w, h) / 2;
|
|
123
|
+
const sub = 4;
|
|
124
|
+
const dt = .18 / sub;
|
|
125
|
+
for (let k = 0; k < sub; k++) {
|
|
126
|
+
const r2 = s.x * s.x + s.y * s.y;
|
|
127
|
+
const r = Math.sqrt(r2);
|
|
128
|
+
if (r < 16) {
|
|
129
|
+
setPhase("crashed");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const a = -9e3 / (r2 * r);
|
|
133
|
+
s.vx += a * s.x * dt;
|
|
134
|
+
s.vy += a * s.y * dt;
|
|
135
|
+
s.x += s.vx * dt;
|
|
136
|
+
s.y += s.vy * dt;
|
|
137
|
+
}
|
|
138
|
+
s.trail.push([s.x, s.y]);
|
|
139
|
+
if (s.trail.length > 260) s.trail.shift();
|
|
140
|
+
if (Math.hypot(s.x, s.y) > bound + 40) {
|
|
141
|
+
setPhase("escaped");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
setTick((n) => n + 1);
|
|
145
|
+
}, { running: phase === "running" && inView });
|
|
146
|
+
const launch = () => {
|
|
147
|
+
resetSim();
|
|
148
|
+
setTick((n) => n + 1);
|
|
149
|
+
setPhase("running");
|
|
150
|
+
};
|
|
151
|
+
const verdict = phase === "crashed" ? {
|
|
152
|
+
text: "💥 Too slow — it fell back and crashed",
|
|
153
|
+
ok: false
|
|
154
|
+
} : phase === "escaped" ? {
|
|
155
|
+
text: "🚀 Too fast — it escaped into space",
|
|
156
|
+
ok: false
|
|
157
|
+
} : phase === "running" ? {
|
|
158
|
+
text: "…orbiting (watch the path close into an ellipse)",
|
|
159
|
+
ok: true
|
|
160
|
+
} : null;
|
|
161
|
+
const figure = /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
ref: viewRef,
|
|
163
|
+
children: [/* @__PURE__ */ jsx(CanvasLayer, {
|
|
164
|
+
view: VIEW,
|
|
165
|
+
height: 340,
|
|
166
|
+
draw,
|
|
167
|
+
ariaLabel: `Satellite orbiting a planet at ${speed.toFixed(2)}× circular speed`
|
|
168
|
+
}), phase === "idle" && /* @__PURE__ */ jsxs("p", {
|
|
169
|
+
style: {
|
|
170
|
+
textAlign: "center",
|
|
171
|
+
fontSize: 12,
|
|
172
|
+
color: "var(--stage-muted)",
|
|
173
|
+
margin: "6px 0 0"
|
|
174
|
+
},
|
|
175
|
+
children: [
|
|
176
|
+
"The dashed ring is a stable circular orbit. Press ",
|
|
177
|
+
/* @__PURE__ */ jsx("strong", { children: "Launch" }),
|
|
178
|
+
" — too slow and it spirals in, too fast and it escapes."
|
|
179
|
+
]
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
const controls = /* @__PURE__ */ jsxs(ControlBar, { children: [
|
|
183
|
+
/* @__PURE__ */ jsx(Field, {
|
|
184
|
+
label: "launch speed",
|
|
185
|
+
value: `${speed.toFixed(2)}× v꜀`,
|
|
186
|
+
children: /* @__PURE__ */ jsx(Slider, {
|
|
187
|
+
value: Number(speed.toFixed(2)),
|
|
188
|
+
min: .5,
|
|
189
|
+
max: 1.5,
|
|
190
|
+
step: .02,
|
|
191
|
+
onChange: (v) => {
|
|
192
|
+
setSpeed(v);
|
|
193
|
+
setPhase("idle");
|
|
194
|
+
},
|
|
195
|
+
ariaLabel: "launch speed (× circular)",
|
|
196
|
+
style: { width: 130 }
|
|
197
|
+
})
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ jsx(CheckButton, {
|
|
200
|
+
onClick: launch,
|
|
201
|
+
children: "Launch"
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
204
|
+
selected: false,
|
|
205
|
+
onClick: () => setPhase("idle"),
|
|
206
|
+
children: "Reset"
|
|
207
|
+
})
|
|
208
|
+
] });
|
|
209
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
210
|
+
title: "Orbit Lab",
|
|
211
|
+
prompt: "An orbit is just falling sideways fast enough to keep missing the ground.",
|
|
212
|
+
aside: verdict ? /* @__PURE__ */ jsx(StatusPill, {
|
|
213
|
+
ok: verdict.ok,
|
|
214
|
+
children: verdict.text
|
|
215
|
+
}) : void 0,
|
|
216
|
+
controls,
|
|
217
|
+
children: figure
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
//#endregion
|
|
222
|
+
export { OrbitLab };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/physics/projectile-lab.d.ts
|
|
4
|
+
interface ProjectileLabProps {
|
|
5
|
+
targetMeters?: number | string;
|
|
6
|
+
g?: number | string;
|
|
7
|
+
}
|
|
8
|
+
declare function ProjectileLab(props: ProjectileLabProps): ReactNode;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ProjectileLab, ProjectileLabProps };
|