O'Reilly logo

HTML5 Web Application Development By Example Beginner's guide by J.M. Gustafson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Mandelbrot set

To demonstrate how to use web workers to do some real processing we will create an application that draws Mandelbrot fractals . Drawing a Mandelbrot is pretty intensive and takes a lot of processing power. If you don't run it in a separate thread, the application will become unresponsive while it's drawing.

Drawing a Mandelbrot is a relatively simple process. We will use the escape time algorithm . For each pixel in the image we will determine how many iterations it takes to reach a critical escape condition. The number of iterations determines the color of the pixel. If we don't reach the escape condition within a maximum number of iterations, it is considered to be inside the Mandelbrot set and we color it black.

For more information ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required