xxxxxxxxxx
36
let N = 1;
let PSFs = [];
let PSFcoords = [];
let pitch = 1;
function preload() {
for (let nx = 0; nx < N; nx++) {
for (let ny = 0; ny < N; ny++) {
PSFs.push(loadImage("https://www.mso.anu.edu.au/\~jcranney/files/PSFs/-3.00_-3.00.png"));
PSFcoords.push([nx / (N - 1), ny / (N - 1)]);
}
}
}
function setup() {
createCanvas(400, 400);
pitch = 1 / (N - 1);
}
function draw() {
background(220);
let x = mouseX / width;
let y = mouseY / height;
for (let nx = 0; nx < N; nx++) {
for (let ny = 0; ny < N; ny++) {
let alpha = 0;
if (abs(x / pitch - nx) <= 1 && abs(y / pitch - ny) <= 1) {
alpha = (1 - abs(x / pitch - nx)) * (1 - abs(y / pitch - ny));
}
//image(PSFs[ny*N+nx],0,0,width,height);
ellipse(nx / (N - 1) * width, ny / (N - 1) * height, alpha * 50, alpha * 50);
}
}
image(PSFs[0], 0, 0, width, height);
console.log(PSFs[0]);
}