There are millions of way to do it but I think you might like this one .
Updates/steps are handled by the JS scheduler/timers. It's non-blocking and won't have your CPU go crazy with a heavy for loop.
The fractal data is also handled a different way. You could put any fractal made with affine transforms just by changing the parameters at one place. You also don't have to sum the probabilities as it does it for you.
ex: (StackOverflow won't let me post a JSFiddle link without a code exemple)
var probability_transforms = [
{
"probability": 0.01,
"item": function(point){ return affine_transform(point, 0, 0, 0, 0.16, 0, 0) }
},
{
"probability": 0.85,
"item": function(point){ return affine_transform(point, 0.85, 0.04, -0.04, 0.85, 0, 1.6) }
},
{
"probability": 0.07,
"item": function(point){ return affine_transform(point, 0.2, -0.26, 0.23, 0.22, 0, 1.6) }
},
{
"probability": 0.07,
"item": function(point){ return affine_transform(point, -0.15, 0.28, 0.26, 0.24, 0, 0.44) }
}
];
Have fun :)