Melbourne Art School
Creative coding3 minute read

Creative coding: the 180-year-old idea hiding in your web browser

What creative coding is, where it came from (from Jacquard’s loom to Ada Lovelace to Processing), and how to make your first generative drawing in p5.js this weekend.

A wooden Jacquard loom with a long chain of punched cards hanging from it
A Jacquard loom with its punched cards, National Museum of Scotland. Photo: Stephencdickson, CC BY-SA 4.0, via Wikimedia Commons.

Key takeaways

  • Creative coding means writing code to make art: images, animation, sound and interactive work.
  • The idea is older than computers. A punched-card loom of 1804 and Ada Lovelace’s notes of 1843 imagined machines making art.
  • You can start today in your web browser with p5.js. It’s free and there’s nothing to install.

A painter decides where every brushstroke goes. A creative coder writes the rules, and lets the computer place the strokes. Change one number and a thousand marks move at once. It’s a different way of making, and much older than you might think.

What is creative coding?

Creative coding is programming for expression rather than function. Instead of building an app, you build an artwork: a drawing that grows, an animation that reacts to sound, an installation that responds to the people in the room. When the rules include chance, so the work is different each time it runs, it’s often called generative art.

A short history, from looms to laptops

1804: a loom that reads instructions

Joseph Marie Jacquard’s loom used chains of punched cards to control which threads were lifted, so the pattern was stored as information. The Jacquard machine inspired early computing pioneers, including Charles Babbage.

1843: Ada Lovelace imagines a creative machine

Writing about Babbage’s planned Analytical Engine, Ada Lovelace saw that it could work with more than numbers. She suggested it “might compose elaborate and scientific pieces of music”, an idea a century ahead of its time.

Watercolour portrait of Ada Lovelace in an evening gown, holding a fan
Alfred Edward Chalon, Ada Lovelace, c. 1840. Watercolour. Public domain, via Wikimedia Commons.

1965: the first computer art exhibitions

In 1965 Georg Nees exhibited computer-generated drawings in Stuttgart, and A. Michael Noll and Bela Julesz showed theirs in New York. Frieder Nake was soon exhibiting too. The drawings were made by pen plotters following code. See computer art.

1968: Vera Molnár gets a computer

Vera Molnár had already been making drawings by following rules by hand. In 1968 she began using a computer, and spent the next half-century exploring how small changes to a system produce surprising images.

2001 to now: tools for artists

Processing (2001) and later p5.js (2013) made coding approachable for artists and designers, and creative coding moved from research labs into art schools, galleries and browsers everywhere.

Make your first generative drawing this weekend

Open the free p5.js Web Editor, delete what’s there, paste this in and press play:

function setup() {
  createCanvas(600, 600);
  background(243, 242, 238);
  stroke(37, 64, 208, 120);
}

function draw() {
  const x = random(width);
  const y = random(height);
  line(width / 2, height / 2, x, y);
}

setup() runs once, to create the canvas. draw() then runs up to 60 times a second, and each time it draws a line from the centre to a random point. In seconds you have a dense, glowing burst, and no two are the same.

Now play:

  • Replace line(...) with circle(x, y, 8); for a field of dots.
  • Replace width / 2, height / 2 with mouseX, mouseY and draw with your mouse.
  • Change the four numbers in stroke() to change colour and transparency.

Tools to explore next

  • p5.js: the friendliest start, in JavaScript, in the browser.
  • Processing: the original, in Java, great for installations and print.
  • openFrameworks: a C++ toolkit for ambitious, high-performance work.
  • Hydra: live-coding visuals in the browser, made by artist Olivia Jack and popular for performances.

For more free tools, see our list of the best free, open-source software for artists.

A single computer-generated tree with a white trunk and dense green canopy on a pale grey ground
Alex Gibson, Trees Are Algorithms Too, 2020. Code can describe how a tree grows, not just how it looks.

References and further reading

  1. Creative coding on Wikipedia
  2. Generative art on Wikipedia
  3. Jacquard machine on Wikipedia
  4. Ada Lovelace on Wikipedia
  5. Computer art on Wikipedia
  6. Georg Nees on Wikipedia
  7. Vera Molnár on Wikipedia
  8. p5.js Web Editor
  9. openFrameworks
  10. Hydra
Alex Gibson, founder of Melbourne Art School, in a black-and-white portrait wearing headphones

Alex Gibson

I’m an artist and creative technologist with a Master of Fine Arts, and the founder of Melbourne Art School. My work moves between pencils, plotters, code and live printmaking performance, and I teach drawing and creative coding in small evening classes in Brunswick.

More about me and the school

Stay curious.

Hear about new classes, workshops, artist talks and creative ideas from our studio.

Unsubscribe anytime. Read our privacy policy.