Sand AISand AI MAGI-2MAGI-2 现已上线 SandBase:支持原生音频的 1080p 视频立即试用

Swish Shots: A Free-Throw Range of Moving Hoops

Work a night practice range of free throws, in one small offline HTML file: drag back and release to arc the ball along a dotted preview, hoops drift on rails, streaks light the score runes and a shot clock keeps every possession honest. A three.js court, crowd and synth audio, all built in code.

示例

Swish Shots free-throw range game
在新标签页中打开

Swish Shots free-throw range game

该示例在沙盒化的框架中运行,无法访问此页面。

在线运行

在 SandBase sandbox 中运行,并在 Lab 中查看结果。

在 Lab 中打开 ↗

你将获得什么

Bring the court, the hoops and the rules, and optionally the shot arc, the clock and streak numbers, the look and the UI text. The Skill returns a downloadable Skill (the free-throw project, a customize guide, headless verification) and one playable example run.

工作原理

  1. 01

    Copy the court game project

    Swish Shots starts with node scripts/new-project.mjs --out my-court under Node 22.4 or later. The project is a finished three.js dusk-court basketball game: game logic is plain modules in src/game/, numbers live in src/config.js and sound is synthesised WebAudio with no files. Everything runs locally, and the UI ships in English and Chinese.

  2. 02

    Tune shots with the customize guide

    references/customize.md maps requests such as court and palette, hoop and board, ball seams, drag-to-power curve, trajectory dots, spot rules, HUD text and audio to files and symbols. powerNorm, powerMax, velForward and velUp set how far a drag shoots, and hoop and board in src/config.js own the geometry. Retune the score window with the power numbers together.

  3. 03

    Build, shoot and read report

    npm ci && npm run build:single writes dist-single/index.html, one file under 8 MiB with no fetch, storage, workers, dialogs or external URLs. npm run shoot plays it in Chrome, or SwiftShader without a GPU, and writes shots/report.json with screenshots. Check the steps you changed; every verify.json step must reach its asserted state before you deliver.

常见问题

How do you play Swish Shots?

Swish Shots has you pull the pointer down to charge a launch and release to shoot, with a dotted arc previewing the trajectory. The ball flies on a real parabola, bounces off backboard, rim and floor and drops through for a score. Each make moves your spot somewhere on a wide arc at 3.2 to 5.2 m.

Does Swish Shots call a model or need a key?

No. Swish Shots is a finished game plus a customize guide, and the built file makes no network calls and calls no model. Sound is synthesised in the browser, so customising and playing it adds nothing to a SandBase bill.

How does Swish Shots score streaks?

Swish Shots keeps score, streak and best in the HUD. A miss resets the streak but keeps the score. Every make moves the spot, one time in three biased toward the centre and otherwise anywhere in a sweep of 75 degrees either side.

Why did a weak Swish Shots shot still score?

Swish Shots uses scoreInset to widen the swish window at small horizontal offsets, so a soft shot near the centre line can drop in. The guide's Scoring window entry explains the rule and how to shrink it, and the power numbers must be retuned with it.

Is Swish Shots built on a physics engine?

No. Swish Shots is not a real-time physics library: ball against rim is one sphere-versus-ring test per substep, not a general solver. The reset rule in resetBounces, resetTime and the reset box decides when a ball that missed everything returns.

Can I move the hoop in Swish Shots?

Yes. Swish Shots keeps hoop and board geometry in src/config.js, which buildCourt reads to draw the court and stepFlight uses for collisions.

Lab Skill · Games

Seagull Swoop

Build a 3D flight-and-delivery game with light fries, heavy fish, crosswinds and optional ring routes. The gull must bring lunch home; cargo weight changes which openings it can safely reach.

Lab Skill · Games

Wedding Cake Wobble

Build a 3D fragile-cargo delivery game around a wobbling wedding cake. Brake before turns, avoid crossing guests and steer around tables. Lost tiers change the score, while a partial delivery can still succeed.

Lab Skill · Games

Hermit Tide

Build a 3D route-and-timing game where a hermit crab changes shells to cross a tidal shore. Narrow gaps favour the cap, stronger shells resist waves, and dry stones provide shelter and checkpoints.

Lab Skill · Games

Clover Circuit: Estate Cut

Drive a coral ride-on mower through a fenced estate garden. Steering, braking and the moving blade cut actual grass tufts; Overview reveals the genuine trail. Edit three gardens and three scene palettes offline. Coverage counts trimmed tuft centers rather than continuous ground area.

Lab Skill · Games

Glide Gates: Lagoon Run

Flap a golden bird through emerald pipe pairs above a turquoise lagoon. Actual fixed-step gravity, swept circle contacts and full-gate scoring power both manual flight and clearly labeled practice. Edit three courses and three scene palettes offline.

Lab Skill · Games

3D Interactive Garden Islands

Walk a curved garden, harvest fruit, share gifts, catch butterflies, fish, grow flowers and craft furniture. Four lighting states and one offline HTML with bilingual keyboard and touch controls.