Book: Generative Art with JavaScript and SVG

Published 22 Mar 2024 (Updated 10 Jul 2025)
Physical Book Generative Art with JS and SVG

Here you'll find all the CodePen examples accompanying my book Generative Art with JavaScript and SVG, published by Apress.

You can also browse the code on Github or download the repository here.

1. The Beginner's Path

1.1 Hilma af Klint-inspired Composition

1.2 Cornflower Blue in SvJs

1.3 Our First Generative Sketch

Re-run this one for different results.

2. A Programming Primer

2.1 Web-Safe Colour Spiral

3. All About SVG

3.1 Adjusting the viewBox

3.2 Rectangle Colour Illusion

3.3 Circle Overlay Loop

3.4 Chalkboard Gag

3.5 Optical Illusion

4. Randomness and Regularity

4.1 Elements Everywhere All At Once

4.2 Regular Grids

4.3 Clip Path Patterns

4.4 Chance In Action

4.5 Gaussian Distribution

4.6 Porto Pareto

5. The Need for Noise

5.1 Noise Matrix

5.2 Spinning Noise

6. The All-Powerful Path

6.1 Quadratic Slinky

6.2 Interactive Arc Curve

6.3 Generative Arcs

6.4 Organic Curves

7. Motion and Interactivity

7.1 Cursor Tracking

7.2 Making Things Move

7.3 Collision Detection

7.4 Circular Loop

8. Filter Effects

8.1 Colour Filter

8.2 Turbulence

8.3 Hubble Bubble

8.4 Rough Paper

8.5 Rocky Randomness

9. The Generative Way

9.1 Trigonometry

9.2 Fractals

9.3 Systems Simulations