ボールの落下、バウンド運動のプログラムです。
上の『放物線』ボタンを押してください。
空気抵抗 0、バウンド面の摩擦抵抗 0、バウンド面の反発係数? -0.5、
更に、10回ほどバウンドして画面上にほどよく納まるよう、重力加速度、落下高は
それなり(いい加減に?)にしています。
テンポを遅くすると、風せんの落下のように見えますが、反発係数は異なるにしても、
鉄球でも風せんでも同じ落下運動をすることは、高校の時(中学?)の教え、
それは、単に、スローモーションに過ぎません。
実際、現実の世界で、そう見えてしまうのは、空気抵抗のおかげ、
ここでは、それはオミットしています。

以下、プログラムソースです。

<HTML><HEAD></HEAD>
<BODY bgcolor="black" text="white">
             <input type="button" name="button1" value="START"
onClick="button1.disabled=true;button2.disabled=false;button3.disabled=false;RS()"> 
<input type="button" name="button2" value="STOP"
onClick="button2.disabled=true;button1.disabled=false;button3.disabled=false;Stop()"> 
<input type="button" name="button3" value="CLEAR" onClick="button2.disabled=true;button1.disabled=false;button3.disabled=true;Seiretsu()">
<img src="vline.jpg" style="position: absolute;left:0; top: 326">
<div id=MovePoint1 style="font-size:30; color:#ffffff;
position:absolute;top:0;left:-50;width=10">●</div>
</BODY>
<SCRIPT LANGUAGE="javaScript">
<!--
var dif1=0;
var timeID;
var PosX;
var PosY;
function RS(){
dif1=dif1+0.005;
if(dif1*500<977.97){
j=Math.ceil(Math.random()*10*16).toString(16);
if(j.length==1){j="0"+j};
k=Math.ceil(Math.random()*10*16).toString(16);
if(k.length==1){k="0"+k};
l=Math.ceil(Math.random()*10*16).toString(16);
if(l.length==1){l="0"+l};
document.all("MovePoint1").style.color="#"+j+k+l;
dif1=0;
}
if(dif1*500<173.21){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=2500*dif1*dif1;
}else{
if(dif1*500<418.15){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+((500*dif1-295.68)*(500*dif1-295.68))/100;
}else{
if(dif1*500<591.36){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+((500*dif1-504.76)*(500*dif1-504.76))/100;
}else{
if(dif1*500<713.83){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+((500*dif1-652.60)*(500*dif1-652.60))/100;
}else{
if(dif1*500<800.40){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+((500*dif1-757.13)*(500*dif1-757.13))/100;
}else{
if(dif1*500<861.67){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+9.375+((500*dif1-831.05)*(500*dif1-831.05))/100;
}else{
if(dif1*500<904.97){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+9.375+4.69+((500*dif1-883.32)*(500*dif1-883.32))/100;
}else{
if(dif1*500<935.59){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+9.375+4.69+2.34+((500*dif1-920.28)*(500*dif1-920.28))/100;
}else{
if(dif1*500<957.24){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+9.375+4.69+2.34+1.17+((500*dif1-946.42)*(500*dif1-946.42))/100;
}else{
if(dif1*500<972.55){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+9.375+4.69+2.34+1.17+0.59+((500*dif1-964.90)*(500*dif1-964.90))/100;
}else{
if(dif1*500<983.37){
document.all("MovePoint1").style.left =dif1*500;
document.all("MovePoint1").style.top=150+75+37.5+18.75+9.375+4.69+2.34+1.17+0.59+0.29+((500*dif1-977.97)*(500*dif1-977.97))/100;
}
}
}
}
}
}
}
}
}
}
}
timeID=window.setTimeout("RS()",0);
}

function Stop(){
clearTimeout(timeID);
}

function Seiretsu(){
if(timeID){
clearTimeout(timeID);
}
document.all("MovePoint1").style.left =-50;
document.all("MovePoint1").style.top=0;
}
-->
</SCRIPT>
</HTML>



バウンドの位置をあらかじめ、計算の上、上のプログラムに反映しています。
プログラム上で計算させ、代入させれば、水平方向の速度変化にも対応可能ですし、
もっとすっきりしたソースになると思いますが、とりあえずは、位置を計算して、数値を代入しています。

バウンドの位置計算表
バウンド回数 最高点のY座標(YH) バウンド位置から
最高点に達するまでの
X軸方向の距離(凅)
最高点の時のX座標(Xh) バウンドのX座標(Xb)
前回のYH*1/2 √(YH*100) (前回のXb)+(今回の凅) (前回のXb)+(今回の凅)*2
0 300     173.205
1 150 122.474 295.68 418.1541
2 75 86.6025 504.76 591.3591
3 37.5 61.2372 652.6 713.8336
以下、同様に変化 以下、同様に変化 以下、同様に変化 以下、同様に変化 以下、同様に変化