T Krobot gestures towards a laptop displaying a drawing canvas.

Creative Coding with p5.js

Two levels, 30 hours each

Duration:
Two levels, 30 hours each
Type:
Computer Science Fundamentals
Updated:

Which level should my students start with?

Start with Level 1 if students are new to p5.js. Level 2 builds on Level 1: students should be able to organise a sketch using classes and use vectors to model motion. If they learned those skills elsewhere, tell us what they've built so we can suggest where to start.

Course overview

What makes a ball bounce, a planet orbit or a flock turn together? Students use p5.js, a JavaScript library for drawing and animation in the browser, to turn those questions into interactive programs they can test. Drawing on Daniel Shiffman’s The Nature of Code, Level 1 teaches programming through physics. Level 2 uses those foundations to model groups, generate patterns and build games.

Planning your course

School levels: Upper secondary
Format: Two courses taught in sequence

Tell us what your students can already code, how long each lesson slot is and what devices they’ll use. If your school restricts browser-based tools or student accounts, let us know so we can discuss the setup.

Learning outcomes

  • Write and debug JavaScript programs that handle input and manage many objects at once.
  • Turn a scientific idea into a working model and explain what the model leaves out.
  • Design rules for a simulation or game, then test how changing one rule affects the whole system.

Curriculum and hands-on

Level 1: JavaScript and physics modelling (30 hours)

Students start by drawing and animating in p5.js. They use loops and arrays to work with many objects, classes to give those objects their own behaviour, and vectors to describe motion. They compare random movement with the smoother variation of Perlin noise, for example by making a field of grass sway.

From there, they model acceleration and forces such as gravity, wind and drag. They might build a marble run or simulate planets that pull on one another. For a longer project, students can build an interactive physics visualisation that lets a classmate change a force and see how it affects the model.

Level 2: Advanced simulations and game design (30 hours)

Students build on those motion models to program autonomous agents that steer, follow paths or flock. They use cellular automata to explore what happens when cells follow simple rules, from Conway’s Game of Life to falling sand and generated cave maps.

The follow-on can also cover recursive fractals, genetic algorithms and constraint-based generation: for example, using wave function collapse to assemble a map from tiles that must fit together. Other extensions include raycasting for line of sight, 3D scenes and networked multiplayer.

For a longer project, students might turn a board game into a playable video game with autonomous opponents or a map that changes each time.

What people say about our courses

The programme taught me that anything is possible. To be able to learn, from scratch, how to code an entire app and publish it on the App Store ― it's an experience that I'd recommend to anyone who's interested in coding! The community also kept me coming back long after I graduated. Truly a great programme.

Tinkercademy is a flexible, responsive and innovative partner, ready to always collaborate to develop cutting-edge coding programmes together with the school. They have depth of expertise, in both technology skills and pedagogy, to understand the needs of our students and engage them holistically.

My past year with the programme has been an incredible journey that I will cherish forever. I've always dreamt of sharing my work with the world, and thanks to the programme's supportive mentors, I turned that dream into reality by publishing my app on the App Store for everyone to use. Along the way, I made unforgettable memories and gained hands-on experience in app development.

Very useful workshop. Guidance and examples were very beginner friendly and easy for participants to follow and try during the workshop. Good to build confidence especially for absolute beginners.

Having the experience as ex-school teachers, Tinkercademy is able to utilise sound educational pedagogy… We continually receive good feedback from students… An Arduino teachers' workshop with Tinkercademy even inspired a couple of our Science teachers to design a term-long performance task.

Most of the time i didn't feel lost, it was thoroughly well explained. I also like the Kahoot quizzes at the end of each session.

Join us for the best coding and digital making experiences for students, teachers, and professionals in Singapore and beyond.