3 ms·
I kept radius of blackhole very small ( ~3px) because many demos do so[1][2]. If you look into the code you will see it's a faux effect. It's canvas so you can
by cturhan 12y ago
I kept radius of blackhole very small ( ~3px) because many demos do so[1][2]. If you look into the code you will see it's a faux effect. It's canvas so you can imagine performance when comparing with WebGL :) It just replaces positions of pixels according to an effective radius and some simple mirror algorithm. Also to smooth effect I used smoothstep function.
[1] https://www.youtube.com/watch?v=FCoxYlpJq9s&t=1m13s https://www.youtube.com/watch?v=FCoxYlpJq9s&t=1m13s
[2] http://upload.wikimedia.org/wikipedia/commons/d/d6/BlackHole_Lensing.gif http://upload.wikimedia.org/wikipedia/commons/d/d6/BlackHole...
[3] http://en.wikipedia.org/wiki/Smoothstep http://en.wikipedia.org/wiki/Smoothstep