Commit b75afa2
docs(examples): add xkcd 2347 dependency physics example (tldraw#8362)
Adds an interactive recreation of the [xkcd "Dependency" comic
(tldraw#2347)](https://xkcd.com/2347/) as a tldraw SDK example, inspired by
[isohedral's p5.js
version](https://editor.p5js.org/isohedral/full/vJa5RiZWs). The example
builds a tower of geo shapes matching the comic's layout and simulates
physics using Rapier 2D — blocks settle under gravity, and you can drag
or delete blocks to watch the tower collapse.
https://github.com/user-attachments/assets/4a32706c-8f72-4e9e-9eb6-b07cf0cdc052
### Change type
- [x] `other`
### Test plan
1. Run `yarn dev` and navigate to the "Gravity sim (xkcd 2347)" example
under use-cases
2. Wait for blocks to settle after the initial physics warm-up
3. Drag a block out of the tower and watch surrounding blocks react
4. Delete a block and confirm the tower collapses realistically
5. Pull out the red "critical dependency" block and watch everything
fall
### Release notes
- Add xkcd 2347 "Dependency" physics example demonstrating Rapier 2D
integration with tldraw shapes
### Code changes
| Section | LOC change |
| --------------- | ---------- |
| Documentation | +406 / -0 |
| Config/tooling | +9 / -0 |
Made with [Cursor](https://cursor.com)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b95d5c7 commit b75afa2
4 files changed
Lines changed: 415 additions & 0 deletions
File tree
- apps/examples
- src/examples/use-cases/xkcd-dependency
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments