P5js > Dessiner en fonction de la taille du canevas

Variables de système de la taille du canevas

width
height

Trouver le centre avec une multiplication

var centreHorizontal = width * 0.5;
var centreVertical = height * 0.5;

Trouver le centre avec une division

var centreHorizontal = width / 2;
var centreVertical = height / 2;

Exemples