Single file · Zero dependencies · Works offline

Every fight move
is a dance move

Rhythm is the combat system

Load a track from your device and the character dances to it. The beat is analysed up front, the whole arena pulses on the pulse, and every attack you throw is a dance move — land it in time with the music and it becomes a PERFECT hit worth 60% extra damage.

You Rival

Free & fully offline — nothing to install. The Android .apk is sideload-only (allow installs from unknown sources).

Why it slaps

Built on the beat

Six things that make Dance Fight what it is — all straight from the game.

The music drives everything

Your track is analysed for its real beat grid, and the character’s dance is locked to the audio playhead — so it can’t drift, and it doesn’t depend on frame rate.

Every move is a dance move

Arm Wave, Spinning Kick, Body-Roll Uppercut and a 720° Body-Roll Finisher. Spins are real rotations, not pose swaps.

It never stops dancing

Attack poses are layered over the ongoing groove rather than replacing it — so the character keeps moving while it fights.

Rhythm is the combat system

Moves landed on the beat hit 60% harder and build a bigger combo. Shuffle-stepping in time charges your finisher meter.

Keyboard and touch

Play on a desktop keyboard, or use the on-screen controls that appear automatically on phones. Rotate to landscape for the full arena.

One file, zero dependencies

The whole game is a single HTML file (~78 KB). No framework, no bundler, no CDN. It works offline and even from file://.

How it works

Controls & the combo game

Pick an audio file, or just press Start and it plays a default 128 BPM groove.

Keybindings

A DShuffle step
Dance-walk. Stepping in time charges your finisher meter.
WLeap
Arabesque.
SDip
Guards and dodges — hold to block.
JArm Wave
Fast, low damage.
KSpinning Kick
Medium — a full 360° turn.
LBody-Roll Uppercut
Heavy — rolls through a full turn.
SPACEBody-Roll Finisher
Needs a full meter — a 720° spin.
PPause / resume music
Stop the track, keep the fight.

Land on the beat

  • Throw a move. Any attack — Arm Wave, Spinning Kick, Uppercut or Finisher.
  • Time it to the music. A move thrown within about 80 ms of a beat lands as a PERFECT.
  • PERFECT = 1.6× damage and a bigger combo multiplier. A gold · ON BEAT tag on the move name tells you when you nailed it.
  • Charge the finisher. Shuffle-stepping in time builds your meter — then unleash the 720° Body-Roll Finisher.
1.6×
Perfect damage
~80ms
Perfect window
128
Default BPM

Under the hood

How the beat sync works

Polling an AnalyserNode every frame ties beat detection to the render frame rate, which falls apart on a slow device. Dance Fight does it offline instead, on the decoded audio buffer, before the fight starts.

The offline analysis

  1. Low-pass the signal to ~180 Hz with a one-pole filter (kick-drum territory).
  2. Build a per-10 ms RMS envelope, then take its positive flux.
  3. Peak-pick onsets against an adaptive threshold.
  4. Autocorrelate the flux over lags of 0.30–0.75 s to find the tempo, refined to sub-sample accuracy.
  5. Search every phase offset for the grid that lines up with the most onset energy.

Locked to the playhead

The result is a beat grid. During play the dance phase is read straight off the audio playhead — (playhead − phase) / period — so the groove cannot drift, and it is completely independent of frame rate.

Everything else is drawn on a forward-kinematic skeleton. Moves are keyframed joint angles blended over the ongoing dance groove rather than replacing it. Spins are faked as a horizontal squash that mirrors past 90°, with near and far limbs swapping, and every attack leaves additive ghost trails of the last few poses — which is what makes a rotation read as motion.

97%
Kicks within 30ms
5–9ms
Median offset
100/128/150
BPM tested

See it move

Straight from the arena

One HTML file, a wide arena, and a character that never stops dancing. Tap through to play it live in your browser.

Get started

Play it in seconds

No toolchain, no install, no server. Just open it — or clone it and remix.

Play right now

Open the live demo, pick a track, and fight. Browsers block audio until you interact, so your first tap or click unlocks sound.

Run it locally

# clone and open
$ git clone https://github.com/drsamonline/dance-fight.git
$ cd dance-fight
$ open index.html   # macOS; xdg-open / start elsewhere

# or serve it
$ python3 -m http.server 8000
# then visit http://localhost:8000

Live badges

GitHub stars License Last commit Code size Dependencies: 0 Build: none Web Audio API
Rhythm combat Vanilla JS Zero dependencies Touch ready Offline beat grid MIT licensed

Good questions

FAQ

QDo I need to install anything?▾

No. Dance Fight is a single HTML file with zero dependencies — no build step, no framework, no CDN. Open it in a modern browser and play, and it works offline and from file:// too.

QCan I use my own music?▾

Yes. Load an audio file from your device and the game analyses it for its real beat grid. If you just want to start, press Start and it plays a default 128 BPM groove.

QWhy do I hear nothing at first?▾

Browsers block audio until you interact with the page, so your first tap or click unlocks sound. If you ever hear nothing, a live level meter under the BPM readout shows whether audio is actually flowing — and a banner appears if it isn’t. That meter reads real signal, not a flag.

QHow does the timing work?▾

A move thrown within about 80 ms of a beat lands as a PERFECT: 1.6× damage and a bigger combo multiplier. The gold · ON BEAT tag on the move name tells you when you nailed it. Shuffle-stepping in time charges your finisher meter.

QDoes it work on a phone?▾

Yes — on-screen controls appear automatically. Hold a direction with one thumb and tap attacks with the other. The arena is 16:9, so rotate to landscape; it’s playable in portrait but cramped.

QAre the spins and trails frame-rate dependent?▾

No. Beat detection is done offline on the decoded audio buffer, and during play the dance phase is read straight off the audio playhead — so the groove can’t drift and is independent of frame rate. One honest caveat: the geometry, timing and beat grid were verified programmatically, but the feel of the spins and trails in motion was only tested in a headless browser rendering a few frames per second — that part is the player’s call.

QCan I fork and remix it?▾

Absolutely. It’s MIT licensed © Dr Sohil Momin. It’s a single HTML file, so fork it, remix it, and drop your own track in.