expressions = {
const out = [];
const min = -1;
const max = 1;
const z = '-1.0';
for (let i = 0; i < N; i++) {
for (let j = 0; j < N; j++) {
const x = Number(min + i/(N - 1) * (max - min)).toFixed(5);
const y = Number(min + j/(N - 1) * (max - min)).toFixed(5);
const s1 = 60 * (3 + Math.floor(Math.random() * 5)) * (Math.random() > 0.5 ? -1 : 1)
const s2 = 60 * (3 + Math.floor(Math.random() * 5)) * (Math.random() > 0.5 ? -1 : 1)
out.push({
color: [1, 0, 1],
locals: {
F: Math.floor(Math.random() * 30 + 1).toFixed(1),
t: `frame / ${s1.toFixed(1)}`,
r_wave: 'r * (1.0 + a*sin(F * TAU * (u + t)))',
A: 'R + r_wave * cos(TAU * v)',
x,
y,
z
},
expr: `(A * sin(TAU * u) + x, r_wave * sin(TAU * v) + y, A * cos(TAU * u) + z)`
}, {
color: [.3, 0, 1],
locals: {
F: Math.floor(Math.random() * 30 + 1).toFixed(1),
t: `frame / ${s2.toFixed(1)}`,
r_wave: 'r * (1.0 + a*sin(F * TAU * (u + t)))',
A: 'R + r_wave * cos(TAU * v)',
x,
y,
z
},
expr: `(r_wave * sin(TAU * v) + x, A * cos(TAU * u) + y, A * sin(TAU * u) - R + z)`
})
}
}
return out;
}