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.

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.

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(...)withcircle(x, y, 8);for a field of dots. - Replace
width / 2, height / 2withmouseX, mouseYand 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.

References and further reading
Keep reading
ToolsYou won’t believe how good these 7 free, open-source tools for artists are (number 4 is incredible)
Krita, GIMP, Inkscape, Blender, Processing, p5.js and OpenToonz: seven free, open-source programs artists use for painting, design, 3D, animation and creative code.
4 minute read
Art history7 drawings that will change how you see (the Seurat is pure magic)
From Leonardo’s hands to Seurat’s shadows: seven famous drawings, what each one teaches a beginner, and an exercise to borrow from every artist.
3 minute read