/contagious-simulator

creating a contagious simulator with p5, js and html

Primary LanguageJavaScript

What's this

It's a visual contagius simulator with basic infos and movement behavior. The initial idea was to simulate covid-19 in a normal society and that is the result.

To run

Just open index.html on your browser

Variables

Index.js

  • Amount: Amount of "persons" moving;

Ball.js

  • Constructor (in sequence):
    • radius;
    • id;
    • can pass to show range
    • can pass if start infected
  • x and y: ball position;
  • velocity (x, y): moving orientation and speed;
  • radius: ball visual size and infection size;
  • infection math: infectionRate / 100;
  • infectionRate: % of infection;
  • color: default ball color;
  • infectionColor: when infected different color;