Science.js is a p5.js library that makes it easy to build science simulations.

Example Usage


Velocity and Acceleration Vectors

Velocity and acceleration vectors of a bouncing ball.

Rotating Vector (Alternate)

A different rotating vector.

Rotating Vector

A rotating vector.

Simple Vector

A simple vector.

Vector Addition

Vectors can be added together.

Free Body Diagrams

Free Body Diagram

Displays a free body diagram.

Moving Background

Moving Background (City Street)

Displays a moving background of a city street.

Moving Background (Clouds)

Displays a moving background of a cloudy sky.


Moving Ball (Accelerating)

A simple accelerating ball.

Moving Ball (Vectors and Grid)

A ball on a grid with viewable vectors.

Simple Moving Ball

A ball that bounces around in a canvas.

Simple Moving Balls

Just some balls that bounce around in a canvas.

Random Walk

A particle's movement and Brownian motion.


Plot and Change a Function

How you can plot a simple function with a controllable parameter

Plot a Function

How you can plot a simple function


Rotating Wheel

A simple wheel that rotates.

Rotating Wheels

Wheels that rotate.

Non-slip Wheel

A wheel that rolls, but does not slip.

Translating Wheel

A wheel with translational motion.

Wheel Arc

The relationship between the arc of a wheel and its path.


Simple Spring

A simple spring.




Have a cool feature to add to the library? Before submitting a pull request, read through here first.



Detailed reference documentation for each object in the library.


Science.js 101

Getting started with Science.js.