xxxxxxxxxx
37
/*****************************************************
source https://openprocessing.org/sketch/2469465
*****************************************************/
let ctx;
let agents = [];
let colors = ['#FE4D03', '#FCAD8A', '#003DCC', '#08AC7E', '#DED9DF', '#f71735', '#f654a9'];
function setup() {
createCanvas(windowWidth, windowHeight);
background(220);
rectMode(CENTER);
noStroke() ;
// see https://p5js.org/reference/p5/drawingContext/
ctx = drawingContext;
let count = 13;
let cellSize = width / count;
for (let i = 0; i < count; i++) {
for (let j = 0; j < count; j++) {
let x = cellSize * i + cellSize / 2;
let y = cellSize * j + cellSize / 2;
// t est d'autanjt plus grand qu'il est loin du centre du canevas
let t = -int(dist(width / 2, height / 2, x, y) / 10);
if ((i + j) % 2 == 0) {
fill( 100, 20, 20 ) ;
ellipse( x, y, cellSize * 0.9 ) ;
fill( 20, 100, 100 ) ;
ellipse( x + 10 , y + 10 , t ) ;
}
// agents.push(new Shape(x, y, cellSize * 1.2, t));
}
}
}