Skip to content

Mandelbrot in HTML5

A Mandelbrot fractal calculated in JavaScript and drawn on an HTML5 canvas:

This complex fractal pattern is based on the simple iteration:

Z = Z2 + C

Where C is a complex number obtained by the position of the pixel, with the horizontal axis being real, and the vertical axis imaginary. The iteration is performed for each pixel, and its colour is decided based on the rate at which the value goes to infinity. The white region in the centre is where the iteration does not go to infinity, this is the Mandelbrot set.