From 024de03f555291df31b30388dbd94f3344a4c682 Mon Sep 17 00:00:00 2001
From: Lucio Zambon <lucio.zambon@elettra.eu>
Date: Tue, 11 Mar 2025 04:00:27 +0000
Subject: [PATCH] Update panther.js

---
 panther.js | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/panther.js b/panther.js
index 658ea82..bc8f3e0 100644
--- a/panther.js
+++ b/panther.js
@@ -842,9 +842,9 @@
 	function initVar(name, defaultVal) {
 		return document.location.search.indexOf(name)>-1? document.location.search.split(name+'=')[1].split('&')[0]: defaultVal;
 	}
-	const tourSpeed = 10; // speed [m/s]
-	const tourPeriod = initVar('tourPeriod', 20);
-	const alphaPerPeriod = 0.008;
+	const tourSpeed = 20; // speed [m/s]
+	let tourPeriod = initVar('tourPeriod', 10);
+	let alphaPerPeriod = 0.009;
 	const tourBackets = initVar('tourBackets', 15);
 	const tourBacketSize = initVar('tourBacketSize', 0.1);
 	const tourBacketsDistance = initVar('tourBacketsDistance', 1500);
@@ -874,15 +874,18 @@
 	}
 	function tour(facility, section, pos, alpha, step, maxSteps) {
 		if (step==maxSteps) {
+			alphaPerPeriod = 0.008;
 			if (facility=='preinjector') {
 				facility = 'booster';
 				const preinjRotate = initVar('preinjRotate', 0.5);
 				camera.rotateY(-Math.PI*preinjRotate);
-				section = 27;
+				section = 0;
 				pos = 0;
 				step = 0;
 				maxSteps = 40;
 				console.log('camera.rotateY()', -180*preinjRotate, maxSteps);
+				alphaPerPeriod = 0.1;
+				tourPeriod = 3000;
 			}
 			else if (facility=='booster') {
 				facility = 'bts';
@@ -898,7 +901,7 @@
 				section = 0;
 				pos = 0;
 				step = 0;
-				camera.rotateY(-Math.PI*preinjRotate);
+				camera.rotateY(-Math.PI*1.5);
 				maxSteps = 3000;
 			}
 		}
@@ -928,13 +931,13 @@
 				pos = pos+tourSpeed*tourPeriod - d;
 			}
 			else pos = pos+tourSpeed*tourPeriod;
-			const alphaFactor = facility=='sr'? 0.6: 8;
+			const alphaFactor = facility=='sr'? 0.77: 0.6;
 			if (params.tour) setTimeout(tour, tourPeriod, facility, section, pos, (alpha<0? 2*Math.PI+alpha: alpha)*alphaFactor, step, maxSteps);
 		}
 	}
 	function preTour(step, steps, facility, section, cameraPos, preFactor) {
 		console.log(step, facility, section, lattice);
-		const pos = facility=='preinjector'? -10000: 0;
+		const pos = facility=='preinjector'? -20000: 0;
 		const maxSteps = facility=='preinjector'? 3: 10000;
 		const bx = (lattice[facility].sections[section].start.x-pos)*tourTransverse;
 		const bz = (lattice[facility].sections[section].start.z)*tourTransverse;
-- 
GitLab