-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFallJSS5.html
16 lines (16 loc) · 2.99 KB
/
FallJSS5.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<html><head><style type="text/css">#flyingObject0 { position:absolute; left:0px; top:30px; width:3em; }#catchObject0{ position:absolute; left:0px; top:30px; width:3em; }#flyingObject1 { position:absolute; left:0px; top:30px; width:3em; }#catchObject1{ position:absolute; left:0px; top:30px; width:3em; }</style><script type="text/javascript"> var distmax = 1807.1287442983657;var hmax = 400.0;var flyobj0 = null;var catobj0 = null;var count0 = 0; var theoval0 = 1277.7930597851923;var movedata0 = new Array(200.0000000000285,204.90018498430638,
399.99999999992616,219.59977500342356,
599.9999999997443,244.0988150709466,
799.9999999995624,278.39738020937824,
999.9999999993805,322.49557545138964,
1199.9999999991987,376.39353584159073,
1277.779999999128,400.00112545056794); var flyobj1 = null;var catobj1 = null;var count1 = 0; var theoval1 = 1807.1287442983657;var movedata1 = new Array(200.0000000000285,4.899878746552929,
399.99999999992616,19.598550111307986,
599.9999999997443,44.0960591008195,
799.9999999995624,78.3924807258781,
999.9999999993805,122.48792000274489,
1199.9999999991987,176.38251195493032,
1399.9999999990168,240.07642161546858,
1599.999999998835,313.569844029697,
1799.999999998653,396.86300425854483,
1807.0999999986466,400.0000349434763); function doAnimLoop0() { flyobj0.style.left = parseFloat(movedata0[count0])*800/distmax + 'px'; flyobj0.style.top = parseFloat(movedata0[count0+1])*400/hmax + 'px'; count0+=2; if( count0 < movedata0.length ) { setTimeout(doAnimLoop0,20); } else { if( (parseFloat(movedata0[count0-2]) - theoval0 > 3) || (parseFloat(movedata0[count0-2]) - theoval0 < -3) ) { flyobj0.style.background = 'red'; } else { flyobj0.style.background = 'blue'; } }}function doAnimStart0() { flyobj0 = document.getElementById('flyingObject0'); flyobj0.style.left='0px'; flyobj0.style.top='0px'; catobj0 = document.getElementById('catchObject0'); catobj0.style.left=theoval0*800/distmax +'px'; catobj0.style.top=400+'px'; doAnimLoop0();}function doAnimLoop1() { flyobj1.style.left = parseFloat(movedata1[count1])*800/distmax + 'px'; flyobj1.style.top = parseFloat(movedata1[count1+1])*400/hmax + 'px'; count1+=2; if( count1 < movedata1.length ) { setTimeout(doAnimLoop1,20); } else { if( (parseFloat(movedata1[count1-2]) - theoval1 > 3) || (parseFloat(movedata1[count1-2]) - theoval1 < -3) ) { flyobj1.style.background = 'red'; } else { flyobj1.style.background = 'blue'; } }}function doAnimStart1() { flyobj1 = document.getElementById('flyingObject1'); flyobj1.style.left='0px'; flyobj1.style.top='0px'; catobj1 = document.getElementById('catchObject1'); catobj1.style.left=theoval1*800/distmax +'px'; catobj1.style.top=400+'px'; doAnimLoop1();}function doAnimStart(){doAnimStart0();doAnimStart1();} window.onload = doAnimStart;</script></head><body><div id="flyingObject0">object0</div> <div id="catchObject0">catch0</div><div id="flyingObject1">object1</div> <div id="catchObject1">catch1</div></body></html>