function findNext() {
let dist = 0.01
let angle = 0;
while (true) {
let incr = angle ? (1/(dist + dist * angle))/2 : dist;
let x = (dist + dist * angle) * Math.cos(angle) + center.x;
let y = (dist + dist * angle) * Math.sin(angle) + center.y;
let temp_w = Math.random() * 10 + 5
let temp_h = Math.random() * 10 + 5
let temp_rect = {x: x - temp_w/2, y: y - temp_h/2, w: temp_w, h: temp_h}
let checks = []
for (let pict of state.pictures) {
let check = collisionCheck(pict, temp_rect)
checks.push(!check)
}
if (checks.every(val => val === true)) {
state.pictures.push(temp_rect)
break;
}
angle += incr
}
}