Dear Fu-Kwun
it is better to make it a separate EJS: in a learning line this one would come first, refelcting daily "logic" in "saving a person's life" or "winning a contest", apart from a logic that takes every driver from A to B in the least time.
Then I would use the refraction as a study that follows this logic: also nature acts within 'the least time" logic. This makes sense then to 13-14 years old learners. Refraction becomes aan application of what happens in daily life, with an in dept understanding of nature.
Snellius' law does not offer that conceptual understanding.

Too many variables in one applet confuses and makes it difficult for the teacher to focus on what needs to be learnt by the students.

Thank you again, we are moving quickly!!!