Step-by-step animations for programming lessons. Each one lets you step through real code, one line at a time, forwards and backwards, and shows what is hard to see when you only read the code.
Open them at fontysvenlo.github.io/animations.
| Animation | Goes with | What it shows | |
|---|---|---|---|
| HashMap Visualiser | Java, MOOC part 8: hash maps | When hashCode and equals are called, for seven Book implementations |
Open |
| Inheritance Visualiser | Java, MOOC part 9: inheritance and interfaces | Which method is executed: what the compiler checks with the static type, and how Java finds the method from the dynamic type | Open |
| Stream Visualiser | Java, MOOC part 10: streams | How the elements of a stream go along a conveyor belt: one at a time through filter, map and the other operations, and why sorted waits for all of them |
Open |
| Git Graph Visualiser | Git: version control | A git session as a graph: commits are vertices, parents are edges, branches are labels | Open |
Each animation's README (the name in the table) says what it shows, gives links to useful steps, and explains how it works.
| Key | Action |
|---|---|
| ← / → (or A / D) | Step back / forward |
| ↑ / ↓ (or W / S) | Previous / next call |
| Home / End | First / last step |
| Space | Play or pause |
| Esc | Restore a maximised card, or leave full screen |
A key that only one animation uses is in its README.
- Sharing: the address bar always holds what you chose and the step you are at. Copy it to share exactly what you see, e.g.
…/inheritance/?example=vehicles&static=Vehicle&dynamic=Car&method=move&step=10. - Projector: maximise a card to fill the window with larger text, or use full screen.
- Step into: an animation with detail steps can hide them, so a call shows as one step.
- Light and dark: follows your system setting.
This repository is public: anyone with a GitHub account can open an issue. Go to Issues → New issue and pick a form. In an animation, the 💬 button in the header opens the bug form with the animation and a link to your current step already filled in.
| Form | Issue type | Use it when |
|---|---|---|
| Bug: something is wrong | Bug | An animation is broken, shows something that real Java doesn't do, or explains something wrongly or unclearly |
| Idea: an improvement or a new animation | Feature | Something could be clearer, or a topic deserves an animation of its own |
The issue type is set by the form, so you don't have to choose it. Teachers use a third type, Task, for planned work such as "add an animation for streams"; you won't need it.
To make a bug easy to fix:
- include the link to the step (the address bar), so we see exactly what you see;
- say what you expected, and what real Java does if it differs;
- mention your browser, and add a screenshot if it's about how something looks.
- Questions about an assignment or the course: ask your teacher during class.
- Solutions to assignments, passwords or personal information: issues are public, so don't post them.
Every animation is a small browser app built with Svelte, Vite and TypeScript. The code you see is shown with CodeMirror. The animations share one shell: the layout, the timeline, playback, the keyboard, maximise and full screen, and the shareable URL.
code/<animation>/* ──(?raw import)──► the code students see, with // @markers
│
choices ──► simulate() ──► one immutable snapshot per step: line, call stack, console, what the visual shows
│
UI renders steps[i] · → = i + 1 · ← = i − 1
- Real code: the code students see is real code in
code/. Lines the simulation stops on end with a marker such as// @put.hash. The marker is removed from the code shown (src/lib/lines.ts). - Simulation: each animation's
simulate()follows that code by hand and records a snapshot at every step. The current file and line, the call stack, the console and everything the visual needs are in that snapshot. Stepping backwards is just showing an earlier snapshot. - Golden tests: each animation has a test that runs the real code (with
javacandjava, orgit) and checks that it prints exactly what the animation shows. Its README says what the test covers. The tests are skipped when there is no JDK or no git.
src/
lib/ shared: Shell and the other components, StepSession, CodeMirror setup, app.css
animations.ts the list of animations (index page, report button)
index/ the index page
hashmap/ App, components, session, url, model/ (simulate, scenarios, tests)
inheritance/ App, components, session, url, model/ (hierarchy, scenarios, simulate, tests)
streams/ App, components, session, url, model/ (scenarios, simulate, links, tests)
git-graph/ App, components, session, url, model/ (history, graph, simulate, tests)
code/<id>/ the code students see
<id>/ each animation's page (index.html) and README
index.html the index page
You need Node 26 or newer, the current LTS. .nvmrc pins it: fnm and nvm switch to it, and CI and the deploy use it. The golden tests need a JDK (17 or newer) and git.
npm install
npm run dev # dev server at http://localhost:5173/animations/
npm test # all tests, including the golden tests
npm run check # type-check (svelte-check)
npm run build # check, then build into dist/
npm run preview # serve the built site- Add it to
ANIMATIONSinsrc/animations.ts(id, title, topic, description, icon). Add its name to theanimationdropdowns in.github/ISSUE_TEMPLATE/bug.ymlandidea.yml. - Create
<id>/index.html(copy one of the others) and add it tobuild.rollupOptions.inputinvite.config.ts. Next to it, write a<id>/README.md: what the animation shows, links to useful steps, and how it works. Link it from the table at the top of this README. - Put the code students see in
code/<id>/, with// @markercomments (# @markerin a shell script) on the lines to stop on. - In
src/<id>/:- write
model/simulate.ts, whose steps extendBaseStepfromsrc/lib/trace.ts; - write a
Sessionthat extendsStepSession; - write an
App.sveltethat fills theShell's snippets (controls, code, visual, lower tabs); - write a
main.ts. The existing animations show the pattern.
- write
- Add a
model.test.tsand a golden test that runs the real code (java.test.ts,git.test.ts).
Animations that don't step through Java can share the shell too, or use their own page. Anything listed in animations.ts appears on the index.
Pull requests are welcome. main is protected: every change goes through a pull request, which is squash-merged.
- The pull request title becomes the commit on
main, so it follows Conventional Commits (feat:,fix:,docs:, …). A check enforces this. - CI runs the tests and the build on every pull request, and they must pass.
- Dependabot keeps the dependencies and actions up to date.
Every push to main is published on GitHub Pages by .github/workflows/deploy.yml. The workflow:
- runs the tests;
- builds the site for the repository's Pages path;
- deploys it.
In the repository settings, Pages → Source must be GitHub Actions.