🩷 Featured in the official Nature of Code Ports to Other Languages 🩷
This repository contains ports of the p5.js sketches from The Nature of Code book by Daniel Shiffman, published by No Starch Press® Inc., licensed under CC BY-NC-SA 4.0.
This project is non-commercial and distributed under the same license.
The examples are rewritten in Go using the Ebitengine game engine.
The original p5.js examples can be found at natureofcode.com/examples and in the noc-book-2 GitHub repository.
You will need to have Go installed (version 1.24.5 or newer).
Each example is in its own directory with a main.go file. To run an example, navigate to its directory and run:
go run .To keep things simple, I've chosen to use only Go and Ebitengine for these examples. Where necessary, I've written my own simplified ported versions of p5.js math functions and separate physics library functions, rather than relying on additional third-party libraries.
If you adapt these examples, feel free to modify the ported functions or substitute them with functions from another library.