A lightweight, installable Pong built with HTML5 Canvas, vanilla JS, and a PWA service worker. Play in the browser or add to your home screen.
- Single-player vs AI with 3 difficulties (Easy, Normal, Hard)
- Scoreboard and win screen (first to 7 wins)
- Tap/click to start; pointer/touch controls on mobile
- Sound effects with a mute toggle
- PWA: offline support, installable, maskable icons
- Mobile-responsive canvas sizing
- Move paddle: drag on the canvas (touch) or move the mouse
- Start/Pause rounds: tap/click the canvas (after score)
- UI controls: difficulty select and mute toggle above the canvas
- Files live in this folder:
index.html,style.css,pong.jssw.js,manifest.webmanifesticons/(SVG sources; PNGs generated in CI)scripts/gen-icons.js(icon generator)
- Run locally by opening
index.htmlin a browser.- Note: service worker registration works from file:// in some browsers but is best tested via a local server.
- SVG sources:
icons/icon.svg(any),icons/icon-maskable.svg(maskable) - CI generates PNG sizes: 192, 256, 384, 512 (maskable and non-maskable) and
icon-180.pngfor Apple touch. - Update the SVGs and push; CI regenerates PNGs automatically.
- Offline caching handled by
sw.js(pre-caches core assets) - Manifest:
manifest.webmanifestwith maskable and standard icons
- This repo deploys via GitHub Actions on pushes to
main. - Workflow:
.github/workflows/pages.yml - In GitHub Settings → Pages, set Source to GitHub Actions.
- Your site URL will be
https://<username>.github.io/<repo>/.
- ESLint runs in CI (Node 20) with a basic recommended config.
- Scripts:
npm run gen:icons– generate PNGs from SVGsnpm run lint– lint*.jsfiles
Personal or educational use. No warranty.