i have re create a #JavaScript version here
http://iwant2study.org/ospsg/index.php/interactive-resources/physics/04-waves/04-light/114-fermat-princple-model-refraction-example
Enjoy!
[img]http://2.bp.blogspot.com/-OOUBF8zx1GY/VbXMp1n5ZsI/AAAAAAAAv0M/rZeMK562aqg/s640/2015-07-27_0911.png[/img]