Julia Set Filter
Become the Julia Set with your webcam
cā=
cā=
iterations=
Here’s the JavaScript code that computes the Julia set map:
function iterateMap(x, y, map, iterations) {
let [real, imag] = [x, y];
for (let i = 0; i < iterations; i++) {
[real, imag] = map(real, imag);
}
return [real, imag];
}
function juliaSet(x, y, c1, c2, iterations) {
const map = (x, y) => {
const real = x * x - y * y + c1;
const imag = 2 * x * y + c2;
return [real, imag];
};
return iterateMap(x, y, map, iterations);
}
This was inspired by this video. It wasn’t too bad to implement, and I’ve left the complex power function in the code for possibly creating other complex maps in the future.