ricktu288 / ray-optics

A web app for creating and simulating 2D geometric optical scenes, with a gallery of (interactive) demos.
https://phydemo.app/ray-optics/
Apache License 2.0
1.32k stars 220 forks source link

Scripting? #125

Closed jumpjack closed 8 months ago

jumpjack commented 8 months ago

Is it possible to script objects? I need to simulate a rotating and translating source of lilght.

ricktu288 commented 8 months ago

A desmos-like variable/equation system has been proposed. See the discussion in #105.

In the current simulator, you may try to use the JavaScript console to access the global objs array. Call draw() to redraw the scene.

jumpjack commented 8 months ago

it's amazing that this tool exposes so many functions, but what about grouping them under one single collector, such as rayOptics, so developer can have a total list of them at a glance? rayOptics.add(), rayOptics.objs, ...

What I really like is that it works also locally and out of the box, please don't change this! :-)