RayManembedded diagrams

RayMan diagrams in a web page. They are read-only. Point at one for its buttons: Open in RayMan opens it in a new tab to change it or trace more rays (the reader's own work there is one ⌘Z away), and Enlarge shows it large over the page, where you can pan and zoom. RayMan · The guide

How

Load the script once per page, then add an element for each diagram. Give the scene as a .json file saved from RayMan:

<script src="https://swcmicroscopy.com/RayMan/embed.js" defer></script>
<div class="rayman" data-src="two-lenses.json"></div>

or write the scene into the page. RayMan's menu → Copy embed code gives exactly this for the scene on the bench, ready to paste.

data-src="…json"the scene file, relative to the page
data-height="320"height in pixels (otherwise half the width)
data-theme="dark"light (default), dark, or auto to follow the reader's system
data-alt="…"what the diagram shows, for screen readers
data-enlarge="off"no Enlarge button
data-open="off"no Open in RayMan button
data-rayman="https://…/"the RayMan that opens it (default: the one the script came from). If it cannot be reached, the button downloads the .json instead.

From a file

<div class="rayman" data-src="two-lenses.json"></div>

Dark, with a set height

<div class="rayman" data-src="negative-lens.json" data-theme="dark" data-height="280"></div>

The scene in the page

As given by Copy embed code.

<div class="rayman" data-height="300">
<script type="application/json">{"version":…,"elements":[…],"rays":[…]}</script>
</div>

No buttons

<div class="rayman" data-src="iris.json" data-enlarge="off" data-open="off" data-height="240"></div>

A bigger system

<div class="rayman" data-src="kohler-4-aperture-diaphragm.json" data-height="340"></div>