We should write a library for that with webgl + GLSL backend for faster computation (It would be quite a hack: textures would be used to store data and communicate with JS, but everything would be much faster). We could also use WebCL but this thing does not seem to work with many browsers.