Prompt specification
Build or customize the Three.js 3D scene "Schedule an illustrative round-trip voyage" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Schedule an illustrative round-trip voyage
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/schedule-an-illustrative-round-trip-voyage-x2592
Scene Description Prompt:
Schedule a low-poly Indian Ocean round trip using simplified seasonal monsoon winds, showing departure months and port waits. Three.js from cdnjs, standalone HTML.
Working Three.js Starter (schedule-an-illustrative-round-trip-voyage-x2592):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Indian Ocean Monsoon Round Trip</title>
<style>
:root {
--bg: #071619;
--panel: rgba(8, 25, 29, 0.90);
--panel-soft: rgba(12, 36, 41, 0.82);
--line: rgba(161, 216, 211, 0.17);
--text: #edf8f3;
--muted: #91aaa8;
--mint: #64e6c2;
--cyan: #55cfe8;
--gold: #ffc96b;
--orange: #ff9068;
--shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button { font: inherit; }
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
}
#overlay {
position: fixed;
inset: 0;
pointer-events: none;
}
.interactive {
pointer-events: auto;
}
header {
position: absolute;
top: 22px;
left: 26px;
right: 26px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 20px;
}
.eyebrow {
margin-bottom: 7px;
color: var(--mint);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.24em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(25px, 3vw, 42px);
line-height: 1;
letter-spacing: -0.04em;
font-weight: 760;
}
.subtitle {
margin-top: 9px;
color: var(--muted);
font-size: 12px;
letter-spacing: 0.02em;
}
.header-actions {
display: flex;
gap: 8px;
align-items: center;
}
.small-button {
border: 1px solid var(--line);
border-radius: 999px;
padding: 8px 12px;
color: var(--text);
background: rgba(9, 29, 33, 0.76);
cursor: pointer;
font-size: 11px;
transition: 160ms ease;
}
.small-button:hover {
border-color: rgba(100, 230, 194, 0.6);
color: var(--mint);
transform: translateY(-1px);
}
.panel {
position: absolute;
border: 1px solid var(--line);
border-radius: 18px;
background: var(--panel);
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
-webkit-backdrop-filter: blur(18px);
}
#schedule-panel {
top: 112px;
left: 24px;
width: 342px;
max-height: calc(100vh - 255px);
overflow: auto;
scrollbar-width: thin;
scrollbar-color: rgba(100,230,194,.35) transparent;
}
.panel-inner {
padding: 17px;
}
.panel-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 13px;
}
.panel-title strong {
font-size: 11px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.badge {
border-radius: 999px;
padding: 4px 8px;
color: var(--mint);
background: rgba(100, 230, 194, 0.10);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.plan-tabs {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 7px;
margin-bottom: 15px;
}
.plan-tab {
padding: 10px 8px;
border: 1px solid var(--line);
border-radius: 11px;
color: var(--muted);
background: rgba(255,255,255,.025);
text-align: left;
cursor: pointer;
transition: 160ms ease;
}
.plan-tab span {
display: block;
margin-top: 3px;
color: var(--text);
font-size: 13px;
font-weight: 720;
}
.plan-tab small {
color: var(--muted);
font-size: 9px;
letter-spacing: .04em;
}
.plan-tab.active {
border-color: rgba(100, 230, 194, .58);
background: rgba(100, 230, 194, .09);
}
.plan-tab.active span { color: var(--mint); }
.route-summary {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 7px;
margin-bottom: 16px;
}
.metric {
padding: 10px 8px;
border: 1px solid var(--line);
border-radius: 11px;
background: var(--panel-soft);
}
.metric b {
display: block;
font-size: 14px;
color: var(--text);
}
.metric span {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 8px;
letter-spacing: .08em;
text-transform: uppercase;
}
.route-line {
display: flex;
align-items: center;
gap: 5px;
overflow: hidden;
margin-bottom: 15px;
white-space: nowrap;
}
.route-stop {
color: #b9ceca;
font-size: 9px;
}
.route-stop::after {
content: "→";
margin-left: 5px;
color: var(--mint);
}
.route-stop:last-child::after { content: none; }
.section-label {
margin: 14px 0 11px;
color: var(--muted);
font-size: 9px;
font-weight: 800;
letter-spacing: .14em;
text-transform: uppercase;
}
.timeline {
position: relative;
}
.timeline::before {
content: "";
position: absolute;
top: 8px;
bottom: 11px;
left: 5px;
width: 1px;
background: linear-gradient(var(--mint), rgba(100,230,194,.12));
}
.event {
position: relative;
display: grid;
grid-template-columns: 12px 1fr auto;
gap: 9px;
align-items: start;
padding: 0 0 15px;
cursor: pointer;
}
.event::before {
content: "";
position: relative;
z-index: 1;
width: 9px;
height: 9px;
margin-top: 4px;
border: 2px solid #183c40;
border-radius: 50%;
background: var(--mint);
box-shadow: 0 0 0 1px rgba(100,230,194,.5);
}
.event:last-child { padding-bottom: 3px; }
.event b {
display: block;
font-size: 11px;
font-weight: 720;
}
.event small {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 9px;
line-height: 1.4;
}
.wait-pill {
margin-top: 1px;
padding: 4px 6px;
border-radius: 6px;
color: var(--gold);
background: rgba(255,201,107,.10);
font-size: 8px;
font-weight: 800;
white-space: nowrap;
}
.event.selected b { color: var(--mint); }
#port-panel {
top: 112px;
right: 24px;
width: 274px;
padding: 17px;
}
#port-name {
margin: 4px 0 5px;
font-size: 21px;
letter-spacing: -.03em;
}
#port-country {
color: var(--muted);
font-size: 10px;
letter-spacing: .08em;
text-transform: uppercase;
}
#port-copy {
margin: 13px 0 15px;
color: #b6c8c5;
font-size: 11px;
line-height: 1.55;
}
.port-stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 7px;
}
.port-stat {
padding: 9px;
border: 1px solid var(--line);
border-radius: 10px;
background: rgba(255,255,255,.025);
}
.port-stat b {
display: block;
color: var(--mint);
font-size: 12px;
}
.port-stat span {
display: block;
margin-top: 3px;
color: var(--muted);
font-size: 8px;
text-transform: uppercase;
letter-spacing: .07em;
}
.legend {
margin-top: 14px;
padding-top: 13px;
border-top: 1px solid var(--line);
}
.legend-row {
display: flex;
align-items: center;
gap: 8px;
margin: 8px 0;
color: var(--muted);
font-size: 9px;
}
.legend-line {
width: 22px;
height: 2px;
background: var(--mint);
box-shadow: 0 0 8px rgba(100,230,194,.5);
}
.legend-arrow {
width: 22px;
height: 0;
border-top: 2px solid var(--gold);
position: relative;
}
.legend-arrow::after {
content: "";
position: absolute;
right: -1px;
top: -4px;
width: 6px;
height: 6px;
border-top: 2px solid var(--gold);
border-right: 2px solid var(--gold);
transform: rotate(45deg);
}
#month-panel {
position: absolute;
left: 50%;
bottom: 22px;
width: min(760px, calc(100% - 48px));
transform: translateX(-50%);
padding: 13px 15px 14px;
}
.wind-head {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
margin-bottom: 9px;
}
#wind-title {
font-size: 11px;
font-weight: 750;
}
#wind-description {
margin-top: 3px;
color: var(--muted);
font-size: 9px;
}
#wind-state {
color: var(--gold);
font-size: 9px;
font-weight: 800;
letter-spacing: .08em;
text-transform: uppercase;
white-space: nowrap;
}
.months {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 4px;
}
.month {
position: relative;
height: 29px;
padding: 0;
border: 1px solid transparent;
border-radius: 7px;
color: #8ea7a4;
background: rgba(255,255,255,.035);
cursor: pointer;
font-size: 9px;
font-weight: 800;
transition: 150ms ease;
}
.month:hover {
color: var(--text);
background: rgba(100,230,194,.08);
}
.month.active {
border-color: rgba(100,230,194,.55);
color: var(--mint);
background: rgba(100,230,194,.12);
}
.month.departure::after {
content: "";
position: absolute;
top: 4px;
right: 4px;
width: 3px;
height: 3px;
border-radius: 50%;
background: var(--gold);
}
.month-note {
display: flex;
justify-content: space-between;
gap: 12px;
margin-top: 8px;
color: #718b88;
font-size: 8px;
line-height: 1.35;
}
#labels {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.port-label {
position: absolute;
min-width: 72px;
padding: 5px 7px;
border: 1px solid rgba(100,230,194,.24);
border-radius: 8px;
color: var(--text);
background: rgba(5, 20, 23, .80);
box-shadow: 0 8px 25px rgba(0,0,0,.24);
text-align: center;
transform: translate(-50%, -100%);
pointer-events: auto;
cursor: pointer;
transition: 150ms ease;
}
.port-label:hover,
.port-label.selected {
border-color: var(--mint);
background: rgba(12, 43, 43, .94);
}
.port-label strong {
display: block;
font-size: 9px;
letter-spacing: .025em;
}
.port-label span {
display: block;
margin-top: 2px;
color: var(--gold);
font-size: 7px;
letter-spacing: .04em;
}
#map-help {
position: absolute;
right: 26px;
bottom: 25px;
color: rgba(205,225,220,.55);
font-size: 9px;
letter-spacing: .05em;
}
#loading {
position: fixed;
inset: 0;
z-index: 100;
display: grid;
place-items: center;
color: var(--mint);
background: var(--bg);
font-size: 11px;
letter-spacing: .15em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 920px) {
#port-panel { display: none; }
#schedule-panel {
top: auto;
bottom: 116px;
max-height: 38vh;
width: 310px;
}
#map-help { display: none; }
}
@media (max-width: 620px) {
header {
top: 16px;
left: 16px;
right: 16px;
}
.subtitle { display: none; }
.header-actions { flex-direction: column; align-items: flex-end; }
#schedule-panel {
left: 12px;
bottom: 104px;
width: calc(100% - 24px);
max-height: 34vh;
}
#month-panel {
bottom: 10px;
width: calc(100% - 20px);
padding: 10px;
}
.month { height: 25px; font-size: 8px; }
.month-note span:last-child { display: none; }
.port-label { min-width: 58px; padding: 4px 5px; }
.port-label strong { font-size: 8px; }
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive low-poly map of the Indian Ocean"></canvas>
<div id="overlay">
<header>
<div>
<div class="eyebrow">Seasonal passage planner · 2026</div>
<h1>Indian Ocean Round Trip</h1>
<div class="subtitle">A six-port clockwise loop shaped by simplified monsoon windows.</div>
</div>
<div class="header-actions interactive">
<button class="small-button" id="wind-toggle">Wind: on</button>
<button class="small-button" id="reset-view">Reset view</button>
</div>
</header>
<section class="panel interactive" id="schedule-panel">
<div class="panel-inner">
<div class="panel-title">
<strong>Voyage schedule</strong>
<span class="badge">Round trip</span>
</div>
<div class="plan-tabs">
<button class="plan-tab active" data-plan="may">
<small>Recommended</small>
<span>May sailing</span>
<small>May → June</small>
</button>
<button class="plan-tab" data-plan="november">
<small>Recommended</small>
<span>November sailing</span>
<small>Nov → Dec</small>
</button>
</div>
<div class="route-summary">
<div class="metric"><b>6,670</b><span>Nautical miles</span></div>
<div class="metric"><b id="duration">36d</b><span>Door to door</span></div>
<div class="metric"><b id="wait-total">9.5d</b><span>In port</span></div>
</div>
<div class="route-line" id="route-line"></div>
<div class="section-label">Departures & port waits</div>
<div class="timeline" id="timeline"></div>
</div>
</section>
<aside class="panel interactive" id="port-panel">
<div class="eyebrow">Port call</div>
<h2 id="port-name">Mumbai</h2>
<div id="port-country">India</div>
<p id="port-copy"></p>
<div class="port-stats">
<div class="port-stat">
<b id="port-wait">12h</b>
<span>Port wait</span>
</div>
<div class="port-stat">
<b id="port-call-time">15 May</b>
<span>Call / departure</span>
</div>
</div>
<div class="legend">
<div class="section-label" style="margin-top:0">Map key</div>
<div class="legend-row"><span class="legend-line"></span> Scheduled voyage</div>
<div class="legend-row"><span class="legend-arrow"></span> Prevailing wind direction</div>
<div class="legend-row"><span style="width:7px;height:7px;border-radius:50%;background:var(--gold)"></span> Recommended departure month</div>
</div>
</aside>
<section class="panel interactive" id="month-panel">
<div class="wind-head">
<div>
<div id="wind-title">Southwest monsoon</div>
<div id="wind-description">Prevailing winds over the northern Indian Ocean</div>
</div>
<div id="wind-state">May · building</div>
</div>
<div class="months" id="months"></div>
<div class="month-note">
<span>Arrows show broad prevailing direction only—not speed, storms, or live routing.</span>
<span>Drag to orbit · Scroll to zoom</span>
</div>
</section>
<div id="labels"></div>
<div id="map-help">DRAG TO ORBIT · SCROLL TO ZOOM · SELECT A PORT</div>
</div>
<div id="loading">Charting the passage…</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const $ = (selector) => document.querySelector(selector);
const $$ = (selector) => [...document.querySelectorAll(selector)];
const PORTS = {
mumbai: {
name: "Mumbai",
country: "India",
lon: 72.83,
lat: 19.08,
copy: "Embarkation point for the clockwise loop. The harbor call is used for bunkering, provisions, and final passenger clearance."
},
colombo: {
name: "Colombo",
country: "Sri Lanka",
lon: 79.86,
lat: 6.93,
copy: "The main Indian Ocean resupply and crew-change port. Two days are reserved for cargo, stores, and shore-side services."
},
male: {
name: "Malé",
country: "Maldives",
lon: 73.51,
lat: 4.18,
copy: "A short tropical call centered on the atolls. The one-day wait allows guests, provisions, and local transfers."
},
mauritius: {
name: "Port Louis",
country: "Mauritius",
lon: 57.50,
lat: -20.16,
copy: "The longest scheduled port wait, allowing three days for cargo, maintenance, and an island call."
},
victoria: {
name: "Victoria",
country: "Seychelles",
lon: 55.42,
lat: -4.62,
copy: "A sheltered harbor stop in the western Indian Ocean. One day covers provisioning and a compact shore excursion."
}
};
const PLANS = {
may: {
month: 4,
duration: "36d",
waitTotal: "9.5d",
events: [
{ port: "mumbai", title: "Embark Mumbai", date: "15 May · 12:00", wait: "12h" },
{ port: "colombo", title: "Arrive Colombo", date: "19 May · 05:00", wait: "2 days" },
{ port: "male", title: "Arrive Malé", date: "24 May · 01:00", wait: "1 day" },
{ port: "mauritius", title: "Arrive Port Louis", date: "30 May · 13:00", wait: "3 days" },
{ port: "victoria", title: "Arrive Victoria", date: "07 Jun · 13:00", wait: "1 day" },
{ port: "colombo", title: "Arrive Colombo", date: "14 Jun · 07:00", wait: "2 days" },
{ port: "mumbai", title: "Arrive Mumbai", date: "19 Jun · 23:00", wait: "Finish" }
]
},
november: {
month: 10,
duration: "35d",
waitTotal: "9.5d",
events: [
{ port: "mumbai", title: "Embark Mumbai", date: "05 Nov · 12:00", wait: "12h" },
{ port: "colombo", title: "Arrive Colombo", date: "09 Nov · 05:00", wait: "2 days" },
{ port: "male", title: "Arrive Malé", date: "13 Nov · 22:00", wait: "1 day" },
{ port: "mauritius", title: "Arrive Port Louis", date: "20 Nov · 10:00", wait: "3 days" },
{ port: "victoria", title: "Arrive Victoria", date: "28 Nov · 10:00", wait: "1 day" },
{ port: "colombo", title: "Arrive Colombo", date: "05 Dec · 06:00", wait: "2 days" },
{ port: "mumbai", title: "Arrive Mumbai", date: "10 Dec · 22:00", wait: "Finish" }
]
}
};
const MONTHS = [
{ short: "Jan", title: "Northeast monsoon", description: "Prevailing winds blow from the northeast toward the equatorial Indian Ocean.", state: "NE · brisk" },
{ short: "Feb", title: "Northeast monsoon", description: "Prevailing winds blow from the northeast toward the equatorial Indian Ocean.", state: "NE · brisk" },
{ short: "Mar", title: "Northeast monsoon", description: "Prevailing winds begin to weaken as the season turns.", state: "NE · easing" },
{ short: "Apr", title: "Inter-monsoon", description: "Variable transitional winds; weather patterns become less predictable.", state: "Variable" },
{ short: "May", title: "Southwest monsoon", description: "The seasonal reversal begins across the Arabian Sea and central Indian Ocean.", state: "SW · building" },
{ short: "Jun", title: "Southwest monsoon", description: "Prevailing winds blow from the southwest toward the northeast.", state: "SW · strong" },
{ short: "Jul", title: "Southwest monsoon", description: "Prevailing winds blow from the southwest toward the northeast.", state: "SW · strong" },
{ short: "Aug", title: "Southwest monsoon", description: "Prevailing winds blow from the southwest toward the northeast.", state: "SW · strong" },
{ short: "Sep", title: "Southwest monsoon", description: "The southwest monsoon begins to ease as autumn approaches.", state: "SW · easing" },
{ short: "Oct", title: "Inter-monsoon", description: "Variable transitional winds surround the annual monsoon reversal.", state: "Variable" },
{ short: "Nov", title: "Northeast monsoon", description: "The northeast monsoon establishes as the seasonal winds reverse again.", state: "NE · building" },
{ short: "Dec", title: "Northeast monsoon", description: "Prevailing winds blow from the northeast toward the equatorial Indian Ocean.", state: "NE · strong" }
];
const SEQUENCE = [
"mumbai",
"colombo",
"male",
"mauritius",
"victoria",
"colombo",
"mumbai"
];
const SCALE = 0.56;
const MAP_CENTER_LON = 70;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071619);
scene.fog = new THREE.Fog(0x071619, 92, 155);
const canvas = $("#scene");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const camera = new THREE.PerspectiveCamera(
43,
window.innerWidth / window.innerHeight,
0.1,
220
);
const target = new THREE.Vector3(0, 0, 0);
const spherical = {
radius: 86,
theta: 0.68,
phi: 0.87
};
function updateCamera() {
const sinPhi = Math.sin(spherical.phi);
camera.position.set(
target.x + spherical.radius * sinPhi * Math.sin(spherical.theta),
target.y + spherical.radius * Math.cos(spherical.phi),
target.z + spherical.radius * sinPhi * Math.cos(spherical.theta)
);
camera.lookAt(target);
}
updateCamera();
scene.add(new THREE.HemisphereLight(0xbceee4, 0x14262a, 1.7));
const keyLight = new THREE.DirectionalLight(0xfff2d0, 2.7);
keyLight.position.set(-28, 55, 26);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -55;
keyLight.shadow.camera.right = 55;
keyLight.shadow.camera.top = 55;
keyLight.shadow.camera.bottom = -55;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 140;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x47b9d6, 1.1);
rimLight.position.set(35, 18, -35);
scene.add(rimLight);
function mapPoint(lon, lat, y = 0) {
return new THREE.Vector3(
(lon - MAP_CENTER_LON) * SCALE,
y,
-lat * SCALE
);
}
function addLowPolyOcean() {
const oceanGeometry = new THREE.CylinderGeometry(40, 40.7, 0.9, 16, 1, false);
const oceanMaterial = new THREE.MeshStandardMaterial({
color: 0x0b3940,
roughness: 0.92,
metalness: 0.02,
flatShading: true
});
const ocean = new THREE.Mesh(oceanGeometry, oceanMaterial);
ocean.position.y = -0.48;
ocean.receiveShadow = true;
scene.add(ocean);
const rimGeometry = new THREE.TorusGeometry(40.1, 0.20, 4, 16);
const rimMaterial = new THREE.MeshBasicMaterial({ color: 0x315b5e });
const rim = new THREE.Mesh(rimGeometry, rimMaterial);
rim.rotation.x = Math.PI / 2;
rim.position.y = 0.01;
scene.add(rim);
const gridVertices = [];
function addGridSegment(a, b) {
gridVertices.push(a.x, 0.015, a.z, b.x, 0.015, b.z);
}
for (let lat = -30; lat <= 30; lat += 10) {
let previous = null;
for (let lon = 20; lon <= 120; lon += 2) {
const p = mapPoint(lon, lat);
const valid = Math.hypot(p.x, p.z) < 39.5;
if (valid && previous) addGridSegment(previous, p);
previous = valid ? p : null;
}
}
for (let lon = 20; lon <= 120; lon += 10) {
let previous = null;
for (let lat = -35; lat <= 35; lat += 2) {
const p = mapPoint(lon, lat);
const valid = Math.hypot(p.x, p.z) < 39.5;
if (valid && previous) addGridSegment(previous, p);
previous = valid ? p : null;
}
}
const gridGeometry = new THREE.BufferGeometry();
gridGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(gridVertices, 3)
);
const grid = new THREE.LineSegments(
gridGeometry,
new THREE.LineBasicMaterial({
color: 0x6da8aa,
transparent: true,
opacity: 0.12,
depthWrite: false
})
);
scene.add(grid);
}
addLowPolyOcean();
const LAND = [
{
name: "Africa",
color: 0x667965,
points: [
[3, 36], [17, 37], [31, 31], [40, 22], [43, 12], [51, 11],
[48, 3], [42, -2], [40, -15], [35, -27], [27, -34], [17, -33],
[13, -22], [8, -7], [3, 5], [10, 15], [17, 25]
]
},
{
name: "Madagascar",
color: 0x6e8069,
points: [
[48, -12], [51, -15], [50, -22], [47, -27], [44, -25],
[43, -20], [46, -14]
]
},
{
name: "Arabia",
color: 0xa3946d,
points: [
[34, 30], [43, 31], [51, 28], [58, 24], [61, 17],
[56, 12], [48, 13], [42, 17], [37, 25]
]
},
{
name: "India",
color: 0x78866c,
points: [
[61, 25], [68, 24], [74, 22], [80, 18], [88, 15],
[84, 8], [78, 7], [73, 15], [70, 21], [64, 24]
]
},
{
name: "Sri Lanka",
color: 0x849071,
points: [
[79.5, 9.7], [81.7, 9.2], [82.1, 6.2], [80.1, 5.8], [79.5, 8]
]
},
{
name: "Southeast Asia",
color: 0x71816b,
points: [
[91, 23], [99, 21], [105, 15], [108, 9], [103, 2],
[99, 7], [96, 14]
]
},
{
name: "Sumatra",
color: 0x6e8067,
points: [
[95, 6], [99, 2], [105, -6], [107, -8], [103, -4],
[98, 2]
]
},
{
name: "Java",
color: 0x75816c,
points: [
[105, -6], [114, -8], [115, -9], [106, -7]
]
},
{
name: "Western Australia",
color: 0x8f8068,
points: [
[113, -15], [121, -15], [123, -29], [114, -34], [111, -23]
]
}
];
function addLandmass(data) {
const shape = new THREE.Shape();
data.points.forEach(([lon, lat], index) => {
const x = (lon - MAP_CENTER_LON) * SCALE;
const y = lat * SCALE;
if (index === 0) shape.moveTo(x, y);
else shape.lineTo(x, y);
});
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.68,
bevelEnabled: false,
curveSegments: 1,
steps: 1
});
geometry.rotateX(-Math.PI / 2);
const topMaterial = new THREE.MeshStandardMaterial({
color: data.color,
roughness: 0.96,
metalness: 0,
flatShading: true
});
const sideMaterial = new THREE.MeshStandardMaterial({
color: new THREE.Color(data.color).multiplyScalar(0.55),
roughness: 1,
flatShading: true
});
const land = new THREE.Mesh(geometry, [topMaterial, sideMaterial]);
land.position.y = 0.04;
land.castShadow = true;
land.receiveShadow = true;
scene.add(land);
const coastPoints = data.points.map(([lon, lat]) =>
new THREE.Vector3(
(lon - MAP_CENTER_LON) * SCALE,
0.75,
-lat * SCALE
)
);
const coastGeometry = new THREE.BufferGeometry().setFromPoints(coastPoints);
const coast = new THREE.LineLoop(
coastGeometry,
new THREE.LineBasicMaterial({
color: 0xd5d6b4,
transparent: true,
opacity: 0.24
})
);
scene.add(coast);
}
LAND.forEach(addLandmass);
function addMountains() {
const mountainMaterial = new THREE.MeshStandardMaterial({
color: 0x59675a,
roughness: 1,
flatShading: true
});
const mountains = [
[38, 13, 2.3, 2.6],
[42, 8, 1.7, 2.2],
[46, 3, 1.3, 1.8],
[72, 23, 2.0, 2.5],
[78, 20, 1.5, 2.1],
[94, 18, 1.4, 1.9],
[116, -24, 1.5, 2.1],
[47, -20, 1.1, 1.8]
];
mountains.forEach(([lon, lat, radius, height]) => {
const geometry = new THREE.ConeGeometry(radius, height, 5);
const mountain = new THREE.Mesh(geometry, mountainMaterial);
mountain.position.copy(mapPoint(lon, lat, 0.7 + height / 2));
mountain.rotation.y = lon * 0.17;
mountain.castShadow = true;
scene.add(mountain);
});
}
addMountains();
const portGroup = new THREE.Group();
scene.add(portGroup);
const portMeshes = [];
const labelElements = {};
const portObjects = {};
const portMaterial = new THREE.MeshStandardMaterial({
color: 0x64e6c2,
emissive: 0x174c43,
emissiveIntensity: 0.85,
roughness: 0.45,
flatShading: true
});
const ringMaterial = new THREE.MeshBasicMaterial({
color: 0x64e6c2,
transparent: true,
opacity: 0.58,
side: THREE.DoubleSide
});
Object.entries(PORTS).forEach(([id, port]) => {
const group = new THREE.Group();
group.position.copy(mapPoint(port.lon, port.lat, 0.76));
const base = new THREE.Mesh(
new THREE.CylinderGeometry(0.18, 0.26, 0.48, 6),
portMaterial
);
base.position.y = 0.24;
group.add(base);
const beacon = new THREE.Mesh(
new THREE.OctahedronGeometry(0.34, 0),
portMaterial
);
beacon.position.y = 0.8;
beacon.castShadow = true;
group.add(beacon);
const ring = new THREE.Mesh(
new THREE.TorusGeometry(0.57, 0.035, 4, 24),
ringMaterial.clone()
);
ring.rotation.x = Math.PI / 2;
ring.position.y = 0.08;
group.add(ring);
base.userData.portId = id;
beacon.userData.portId = id;
portMeshes.push(base, beacon);
portGroup.add(group);
portObjects[id] = { group, beacon, ring, position: group.position.clone() };
const label = document.createElement("button");
label.className = "port-label";
label.dataset.port = id;
label.innerHTML = `<strong>${port.name}</strong><span></span>`;
label.addEventListener("click", () => selectPort(id));
$("#labels").appendChild(label);
labelElements[id] = label;
});
const routeCurves = [];
const routeMeshes = [];
function makeRouteCurve(fromId, toId) {
const from = PORTS[fromId];
const to = PORTS[toId];
const start = mapPoint(from.lon, from.lat, 1.1);
const end = mapPoint(to.lon, to.lat, 1.1);
const middle = start.clone().lerp(end, 0.5);
const distance = start.distanceTo(end);
middle.y = 4.5 + distance * 0.11;
const controlA = start.clone().lerp(middle, 0.68);
controlA.y += 1.3;
const controlB = middle.clone().lerp(end, 0.32);
controlB.y += 1.3;
return new THREE.CubicBezierCurve3(start, controlA, controlB, end);
}
for (let i = 0; i < SEQUENCE.length - 1; i++) {
const curve = makeRouteCurve(SEQUENCE[i], SEQUENCE[i + 1]);
routeCurves.push(curve);
const geometry = new THREE.TubeGeometry(curve, 64, 0.075, 5, false);
const material = new THREE.MeshBasicMaterial({
color: i === SEQUENCE.length - 2 ? 0xffc96b : 0x64e6c2,
transparent: true,
opacity: 0.9
});
const route = new THREE.Mesh(geometry, material);
scene.add(route);
routeMeshes.push(route);
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.22, 0.62, 5),
new THREE.MeshBasicMaterial({ color: 0xffffff })
);
arrow.position.copy(curve.getPointAt(0.54));
arrow.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
curve.getTangentAt(0.54).normalize()
);
scene.add(arrow);
}
const ship = new THREE.Group();
const hull = new THREE.Mesh(
new THREE.ConeGeometry(0.31, 1.15, 4),
new THREE.MeshStandardMaterial({
color: 0xffd27d,
emissive: 0x6a4215,
emissiveIntensity: 0.4,
roughness: 0.55,
flatShading: true
})
);
hull.rotation.z = -Math.PI / 2;
hull.rotation.y = Math.PI / 4;
ship.add(hull);
const mast = new THREE.Mesh(
new THREE.CylinderGeometry(0.035, 0.035, 0.85, 5),
new THREE.MeshStandardMaterial({ color: 0xf3ead3 })
);
mast.position.y = 0.45;
ship.add(mast);
const sailGeometry = new THREE.BufferGeometry();
sailGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute([
0.02, 0.72, 0,
0.02, 0.15, 0,
0.48, 0.28, 0
], 3)
);
sailGeometry.computeVertexNormals();
const sail = new THREE.Mesh(
sailGeometry,
new THREE.MeshStandardMaterial({
color: 0xf1f7ec,
side: THREE.DoubleSide,
roughness: 0.8,
flatShading: true
})
);
ship.add(sail);
scene.add(ship);
const windGroup = new THREE.Group();
scene.add(windGroup);
const windShaftGeometry = new THREE.CylinderGeometry(0.055, 0.055, 1.05, 5);
const windHeadGeometry = new THREE.ConeGeometry(0.18, 0.48, 5);
const windShaftMaterial = new THREE.MeshBasicMaterial({
color: 0xffc96b,
transparent: true,
opacity: 0.68,
depthWrite: false
});
const windHeadMaterial = windShaftMaterial.clone();
const windPositions = [];
[20, 8, -7, -21].forEach(lat => {
[32, 46, 60, 74, 88, 102].forEach(lon => {
windPositions.push([lon, lat]);
});
});
let selectedMonth = 4;
let windVisible = true;
function windProfile(monthIndex) {
if ([0, 1, 2, 10, 11].includes(monthIndex)) {
return {
direction: new THREE.Vector3(-1, 0, 0.42).normalize(),
color: 0xffc96b,
strength: monthIndex === 11 ? 1.28 : 1.12
};
}
if ([4, 5, 6, 7, 8].includes(monthIndex)) {
return {
direction: new THREE.Vector3(1, 0, -0.42).normalize(),
color: 0x64e6c2,
strength: [5, 6, 7].includes(monthIndex) ? 1.3 : 1.08
};
}
return {
direction: new THREE.Vector3(
monthIndex === 3 ? -0.35 : 0.65,
0,
monthIndex === 3 ? 0.25 : -0.15
).normalize(),
color: 0x8ec9d1,
strength: 0.9
};
}
function rebuildWind(monthIndex) {
windGroup.clear();
const profile = windProfile(monthIndex);
windShaftMaterial.color.setHex(profile.color);
windHeadMaterial.color.setHex(profile.color);
const up = new THREE.Vector3(0, 1, 0);
windPositions.forEach(([lon, lat], index) => {
const arrow = new THREE.Group();
arrow.position.copy(mapPoint(lon, lat, 1.13));
const shaft = new THREE.Mesh(windShaftGeometry, windShaftMaterial);
shaft.position.y = -0.05;
arrow.add(shaft);
const head = new THREE.Mesh(windHeadGeometry, windHeadMaterial);
head.position.y = 0.72;
arrow.add(head);
const localDirection = profile.direction.clone();
if (lat < -12 && [4,5,6,7,8].includes(monthIndex)) {
localDirection.set(1, 0, 0.16).normalize();
}
arrow.quaternion.setFromUnitVectors(up, localDirection);
arrow.scale.set(1, profile.strength, 1);
arrow.userData.phase = index * 0.61;
arrow.userData.baseScale = profile.strength;
windGroup.add(arrow);
});
}
rebuildWind(selectedMonth);
let selectedPlan = "may";
let selectedPort = "mumbai";
function selectPort(id) {
selectedPort = id;
const port = PORTS[id];
const event = PLANS[selectedPlan].events.find(item => item.port === id);
$("#port-name").textContent = port.name;
$("#port-country").textContent = port.country;
$("#port-copy").textContent = port.copy;
$("#port-wait").textContent = event?.wait || "—";
$("#port-call-time").textContent = event?.date.split(" · ")[0] || "—";
Object.entries(portObjects).forEach(([portId, object]) => {
const active = portId === id;
object.ring.material.color.setHex(active ? 0xffc96b : 0x64e6c2);
object.ring.material.opacity = active ? 0.95 : 0.38;
object.ring.scale.setScalar(active ? 1.25 : 1);
labelElements[portId].classList.toggle("selected", active);
});
$$(".event").forEach(item => {
item.classList.toggle("selected", item.dataset.port === id);
});
updatePortLabels();
}
function updatePortLabels() {
const plan = PLANS[selectedPlan];
Object.entries(PORTS).forEach(([id, port]) => {
const event = plan.events.find(item => item.port === id);
const label = labelElements[id];
const waitText = event
? event.wait === "Finish" ? "Return" : `+${event.wait} wait`
: "";
label.querySelector("span").textContent = waitText;
});
}
function renderTimeline() {
const plan = PLANS[selectedPlan];
const timeline = $("#timeline");
timeline.innerHTML = "";
plan.events.forEach(event => {
const item = document.createElement("div");
item.className = "event";
item.dataset.port = event.port;
item.innerHTML = `
<div>
<b>${event.title}</b>
<small>${event.date}</small>
</div>
<span class="wait-pill">${event.wait}</span>
`;
item.addEventListener("click", () => selectPort(event.port));
timeline.appendChild(item);
});
$("#duration").textContent = plan.duration;
$("#wait-total").textContent = plan.waitTotal;
const routeLine = $("#route-line");
routeLine.innerHTML = SEQUENCE.map(id =>
`<span class="route-stop">${PORTS[id].name}</span>`
).join("");
updatePortLabels();
selectPort(selectedPort);
}
function setMonth(monthIndex, syncPlan = false) {
selectedMonth = monthIndex;
$$(".month").forEach((button, index) => {
button.classList.toggle("active", index === monthIndex);
});
const month = MONTHS[monthIndex];
$("#wind-title").textContent = month.title;
$("#wind-description").textContent = month.description;
$("#wind-state").textContent = `${month.short} · ${month.state}`;
rebuildWind(monthIndex);
if (syncPlan) {
if (monthIndex === 4) selectPlan("may");
if (monthIndex === 10) selectPlan("november");
}
}
function selectPlan(planId) {
selectedPlan = planId;
const plan = PLANS[planId];
$$(".plan-tab").forEach(button => {
button.classList.toggle("active", button.dataset.plan === planId);
});
setMonth(plan.month);
renderTimeline();
}
const monthContainer = $("#months");
MONTHS.forEach((month, index) => {
const button = document.createElement("button");
button.className = "month";
button.textContent = month.short;
button.title = `${month.title} — ${month.state}`;
button.classList.toggle("departure", index === 4 || index === 10);
button.addEventListener("click", () => setMonth(index, true));
monthContainer.appendChild(button);
});
$$(".plan-tab").forEach(button => {
button.addEventListener("click", () => selectPlan(button.dataset.plan));
});
$("#wind-toggle").addEventListener("click", event => {
windVisible = !windVisible;
windGroup.visible = windVisible;
event.currentTarget.textContent = `Wind: ${windVisible ? "on" : "off"}`;
});
function resetView() {
spherical.radius = 86;
spherical.theta = 0.68;
spherical.phi = 0.87;
target.set(0, 0, 0);
updateCamera();
}
$("#reset-view").addEventListener("click", resetView);
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
canvas.addEventListener("pointerdown", event => {
pointer.set(
(event.clientX / window.innerWidth) * 2 - 1,
-(event.clientY / window.innerHeight) * 2 + 1
);
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.intersectObjects(portMeshes, false)[0];
if (hit) selectPort(hit.object.userData.portId);
});
let dragging = false;
let previousX = 0;
let previousY = 0;
canvas.addEventListener("pointerdown", event => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.style.cursor = "grabbing";
});
canvas.addEventListener("pointermove", event => {
if (!dragging) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
spherical.theta -= deltaX * 0.005;
spherical.phi = THREE.MathUtils.clamp(
spherical.phi - deltaY * 0.004,
0.38,
1.38
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
canvas.style.cursor = "grab";
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener("dblclick", resetView);
canvas.addEventListener("wheel", event => {
event.preventDefault();
spherical.radius = THREE.MathUtils.clamp(
spherical.radius + event.deltaY * 0.055,
48,
120
);
updateCamera();
}, { passive: false });
window.addEventListener("keydown", event => {
if (event.key === "+" || event.key === "=") {
spherical.radius = Math.max(48, spherical.radius - 4);
}
if (event.key === "-" || event.key === "_") {
spherical.radius = Math.min(120, spherical.radius + 4);
}
if (event.key === "ArrowLeft") spherical.theta -= 0.08;
if (event.key === "ArrowRight") spherical.theta += 0.08;
if (event.key === "ArrowUp") spherical.phi = Math.max(0.38, spherical.phi - 0.06);
if (event.key === "ArrowDown") spherical.phi = Math.min(1.38, spherical.phi + 0.06);
updateCamera();
});
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
const projected = new THREE.Vector3();
function updateLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
Object.entries(portObjects).forEach(([id, object]) => {
projected.copy(object.position);
projected.y += 1.35;
projected.project(camera);
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
const visible =
projected.z > -1 &&
projected.z < 1 &&
x > -80 &&
x < width + 80 &&
y > -40 &&
y < height + 40;
const label = labelElements[id];
label.style.display = visible ? "block" : "none";
label.style.left = `${x}px`;
label.style.top = `${y}px`;
});
}
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
routeMeshes.forEach((route, index) => {
route.material.opacity = 0.76 + Math.sin(elapsed * 1.4 + index * 0.5) * 0.14;
});
Object.values(portObjects).forEach((object, index) => {
const pulse = 1 + Math.sin(elapsed * 2.1 + index) * 0.08;
object.beacon.scale.setScalar(pulse);
object.beacon.rotation.y = elapsed * 0.55;
});
windGroup.children.forEach(arrow => {
const pulse = 0.96 + Math.sin(elapsed * 1.25 + arrow.userData.phase) * 0.05;
arrow.scale.x = pulse;
arrow.scale.z = pulse;
});
const totalSegments = routeCurves.length;
const routeProgress = (elapsed * 0.035) % 1;
const scaledProgress = routeProgress * totalSegments;
const segment = Math.min(totalSegments - 1, Math.floor(scaledProgress));
const localProgress = scaledProgress - segment;
const curve = routeCurves[segment];
ship.position.copy(curve.getPointAt(localProgress));
const tangent = curve.getTangentAt(localProgress);
ship.rotation.y = -Math.atan2(tangent.z, tangent.x);
ship.position.y += 0.25;
ship.rotation.z = Math.sin(elapsed * 1.7) * 0.035;
updateLabels();
renderer.render(scene, camera);
}
selectPlan("may");
animate();
requestAnimationFrame(() => {
$("#loading").classList.add("hidden");
setTimeout(() => $("#loading").remove(), 450);
});
</script>
</body>
</html>
```