Template:IGEM Kyoto/game/js: Difference between revisions
From OpenWetWare
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
setTimeout("game_menu_fadeout()",0); | setTimeout("game_menu_fadeout()",0); | ||
setTimeout("game_menu_return()",300); | setTimeout("game_menu_return()",300); | ||
setTimeout("game_open()",300); | |||
} | } | ||
function game_menu_fadeout() | function game_menu_fadeout() | ||
{ | { | ||
var | var menubase=document.getElementById("kyoto-menu-base"); | ||
var opa = 1.0; | var opa = 1.0; | ||
var id = setInterval(function() { | var id = setInterval(function() { | ||
menubase.style.opacity = opa; | |||
opa+=-0.2; | opa+=-0.2; | ||
if(opa < 0) { | if(opa < 0) { | ||
Line 20: | Line 21: | ||
function game_menu_return() | function game_menu_return() | ||
{ | { | ||
var | var menubase=document.getElementById("kyoto-menu-base"); | ||
menubase.style.top="-480px"; | |||
} | |||
function game_open(){ | |||
var gamebase=document.getElementById("kyoto-game-base"); | |||
var top = -480; | |||
var t=0; | |||
var id = setInterval(function() { | |||
game.style.top = top + "px"; | |||
t+=1; | |||
top=-0.09375*(t-80)*(t-80)+120; | |||
if(t > 80) { | |||
clearInterval(id); | |||
} | |||
}, 12.5); | |||
} | } | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 22:29, 2 March 2015
<html> <script type="text/javascript">
function game_start() { setTimeout("game_menu_fadeout()",0); setTimeout("game_menu_return()",300); setTimeout("game_open()",300); } function game_menu_fadeout() { var menubase=document.getElementById("kyoto-menu-base"); var opa = 1.0; var id = setInterval(function() { menubase.style.opacity = opa; opa+=-0.2; if(opa < 0) { clearInterval(id); } }, 60); } function game_menu_return() { var menubase=document.getElementById("kyoto-menu-base"); menubase.style.top="-480px"; } function game_open(){ var gamebase=document.getElementById("kyoto-game-base"); var top = -480; var t=0; var id = setInterval(function() { game.style.top = top + "px"; t+=1; top=-0.09375*(t-80)*(t-80)+120; if(t > 80) { clearInterval(id); } }, 12.5); }
</script> </html>