An open API service indexing awesome lists of open source software.

https://github.com/microhod/ball-simulator


https://github.com/microhod/ball-simulator

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

# Simple 'Balls in a Box' Simulator

Simple simulation of some coloured balls in a box using a [canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).

## Run

1. [Install NodeJS](https://nodejs.org/) following the instructions on their website.
2. Clone this repository
3. Run `npm install` in this repository
4. Run `npm start` and it should be running at `localhost:8080`

> Note: you can also debug in vscode. Use the `live server` extension to run the server and then you can debug in vscode using chrome (check they're pointing to the same localhost port).

## Usage

* Gravity: how strong the pull to the bottom of the box is
* Friction: how much friction the sides of the box have
* Bouce: how bouncy the balls are
* Balls: number of balls

The 'New' button will create a new simulation.

> Note: all apart from 'Balls' will change the current animation, to change number of balls, you also have to click 'new'

![demo](img/demo.gif)