Jello with Gravity Well and Light Beam

by Chantal Roth

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Elastic Universe & Light Orbit Simulation</title>
    <style>
        body { margin: 0; overflow: hidden; background-color: #000; }
        #container { width: 100%; height: 100vh; }
    </style>
    <script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script>
    <script type="importmap">
      {
        "imports": {
          "three": "https://unpkg.com/three@0.150.1/build/three.module.js",
          "three/addons/": "https://unpkg.com/three@0.150.1/examples/jsm/"
        }
      }
    </script>
</head>
<body>
    <div id="container"></div>

    <script type="module">
        import * as THREE from 'three';
        import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
        import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

        let container, camera, scene, renderer, controls;
        let jelloMesh, gridMesh, probeMesh;
        let jelloOriginalPos, gridOriginalPos;
        let clock = new THREE.Clock();

        // --- Ray / Laser Globals ---
        let rayMesh;
        // Increase segments to make the curve smooth when it loops
        const RAY_SEGMENTS = 600; 
        const RAY_TOTAL_DIST = 15.0;

        // --- Clocks Globals ---
        let labClockObj, insideClockObj;        
        let labLightClockObj, insideLightClockObj;
        let properTimeAccumulated = 0;
        let lastCoordinateTime = 0;

        let matrixDiv, matrixContainer, matrixTitle;
        let matrixCells = [];

        // Simulation Parameters
        const params = {
            color: 0x00aaff,
            opacity: 0.25,
            
            showGrid: true,
            showMetric: true,
            clockType: 'Light Clock',
            tensorMode: '4D Spacetime',

            probeX: 0.134, probeY: -0.112, probeZ: 0.064,

            // Laser - aimed slightly off-center to...