twins1.html
À propos du fichier
- Type de fichier
- Fichier HTML de 3 Ko (text/html)
- Confidentialité
- Fichier public, envoyé le 8 octobre 2017 à 00:16, depuis l'adresse IP 24.50.x.x (CA)
- Sécurité
- Ne contient aucun Virus ou Malware connus - Dernière vérification: 5 heures
- Statistiques
- La présente page de téléchargement a été vue 523 fois depuis l'envoi du fichier
- Page de téléchargement
-
Aperçu du fichier
<HTML>
<HEAD>
<TITLE>Twins Paradox Simulation</TITLE>
<script type="text/javascript">
//
sd=0; md=0; // direction of photons for static and moving clocks
lpd=0; lpx=200; // direction and location of linking photon
mlx=200; mrx=210;
slx=200; srx=220; // initial location of moving mirrors
spx=200; mpx=200; // initial location of photons
tsx=0; tmx=0; // time display for static and moving clocks
v=.8660254038; c=1; // mirrors speed vs speed of photon
st=0; s=1; // start variable
//
window.setInterval("run()",10)
function run()
{
// moving mirrors
if(st==1){mlx+=v; mrx+=v} // start mirrors
if(mpx>mrx && md==1){md=-1; mrx-=.866; mlx-=.866; mpx=mrx} // detect right collision; reverse directions
if(mpx<mlx && md==-1){md=1; mlx-=.866; mrx-=.866; mpx=mlx; tmx+=1}//detect left coll; rev dir; update time
if(md==-1){mpx-=c} // move photon both directions
if(md== 1){mpx+=c}
if(tmx==8){v=-.8660254038}
if(tsx==32){md=0; sd=0; lpd=0; st=0}
// Linking photon
//if(lpx>mrx && lpd==1){lpd=-1} // detect right collision; reverse photon dir
//if(lpx<200 && lpd==-1){lpd=1} // detect left collision; reverse photon dir
//if(lpd==-1){lpx-=c} // move photon both directions
//if(lpd== 1){lpx+=c}
// Static mirrors
if(spx>=srx && sd==1){sd=-1; spx} // detect right collision; reverse mirr dir
if(spx<=slx && sd==-1){sd=1; spx=200; tsx+=1}//detect left coll; reverse dir; update time
if(sd==-1){spx-=c} // move photon both directions
if(sd== 1){spx+=c}
// Update display
sp.style.left=spx; // update photons positions
mp.style.left=mpx;
lp.style.left=lpx;
ml.style.left=mlx; // update moving clock position
mr.style.left=mrx;
ts.innerHTML=tsx; // update time display
tm.innerHTML=tmx;
}
function start()
{md=1; sd=1; lpd=1; st=1}
</script>
</HEAD>
<BODY style="background-color:black;color:white;font-family:arial,helvetica,sans-serif;font-size:18pt">
<center><H1>Twins Paradox Simulation</H1><br></center>
<code>
<b id="sp" style="position:absolute; left:200;top:100; font-size:18; color:red">|</b>
<b id="mp" style="position:absolute; left:200;top:120; font-size:18; color:red">|</b>
<b id="lp" style="position:absolute; left:200;top:100; font-size:18; color:white">|</b>
<b style="position:absolute; left:220;top:100; font-size:18; color:blue">|</b>
<b style="position:absolute; left:200;top:100; font-size:18; color:blue">|</b>
<b id="ml" style="position:absolute; left:210;top:120; font-size:18; color:yellow">|</b>
<b id="mr" style="position:absolute; left:200;top:120; font-size:18; color:yellow">|</b>
</code>
<a id="ts" style="position:absolute; left:180;top:100; font-size:18; color:blue"></a>
<a id="tm" style="position:absolute; left:180;top:120; font-size:18; color:yellow"></a>
<input type="button" style="position:absolute; left:200; top:200" value="start" onclick="start()"/>
</BODY>
</HTML>
Partager le fichier twins1.html sur le Web et les réseaux sociaux:
Télécharger le fichier twins1.html