Template:IGEM Kyoto/game/js: Difference between revisions
From OpenWetWare
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
function | function game_open() | ||
{ | { | ||
var gamebase=document.getElementById("kyoto-game-base"); | |||
gamebase.style.opacity=1.0; | |||
setTimeout("game_menu_fadeout()",0); | setTimeout("game_menu_fadeout()",0); | ||
setTimeout("game_menu_return()",300); | setTimeout("game_menu_return()",300); | ||
setTimeout(" | setTimeout("game_fadein()",300); | ||
} | } | ||
function game_menu_fadeout() | function game_menu_fadeout() | ||
{ | { | ||
var menubase=document.getElementById("kyoto-menu-base"); | var menubase=document.getElementById("kyoto-menu-base"); | ||
var opa = | var opa = 0.9; | ||
var id = setInterval(function() { | var id = setInterval(function() { | ||
menubase.style.opacity = opa; | menubase.style.opacity = opa; | ||
opa+=-0. | opa+=-0.18; | ||
if(opa < 0) { | if(opa < 0) { | ||
clearInterval(id); | clearInterval(id); | ||
Line 24: | Line 26: | ||
menubase.style.top="-480px"; | menubase.style.top="-480px"; | ||
} | } | ||
function | function game_fadein() | ||
{ | |||
var gamebase=document.getElementById("kyoto-game-base"); | var gamebase=document.getElementById("kyoto-game-base"); | ||
var top = -480; | var top = -480; | ||
Line 36: | Line 39: | ||
} | } | ||
}, 12.5); | }, 12.5); | ||
} | |||
function game_close() | |||
{ | |||
setTimeout("game_fadeout()",0); | |||
setTimeout("game_return()",300); | |||
} | |||
function game_fadeout() | |||
{ | |||
var back=document.getElementById("kyoto-menu-background"); | |||
var gamebase=document.getElementById("kyoto-game-base"); | |||
var opa = 1.0; | |||
var opa1 = 0.9 | |||
var id = setInterval(function() { | |||
back.style.opacity = opa1; | |||
gamebase.style.opacity = opa; | |||
opa+=-0.2; | |||
opa1+=-0.18 | |||
if(opa < 0) { | |||
clearInterval(id); | |||
} | |||
}, 60); | |||
} | |||
function game_return() | |||
{ | |||
var back=document.getElementById("kyoto-menu-background"); | |||
var gamebase=document.getElementById("kyoto-game-base"); | |||
back.style.height="0%"; | |||
gamebase.style.top="-480px"; | |||
} | |||
function game_start() | |||
{ | |||
} | } | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 07:39, 4 March 2015
<html> <script type="text/javascript">
function game_open() { var gamebase=document.getElementById("kyoto-game-base"); gamebase.style.opacity=1.0; setTimeout("game_menu_fadeout()",0); setTimeout("game_menu_return()",300); setTimeout("game_fadein()",300); } function game_menu_fadeout() { var menubase=document.getElementById("kyoto-menu-base"); var opa = 0.9; var id = setInterval(function() { menubase.style.opacity = opa; opa+=-0.18; if(opa < 0) { clearInterval(id); } }, 60); } function game_menu_return() { var menubase=document.getElementById("kyoto-menu-base"); menubase.style.top="-480px"; } function game_fadein() { var gamebase=document.getElementById("kyoto-game-base"); var top = -480; var t=0; var id = setInterval(function() { gamebase.style.top = top + "px"; t+=1; top=-0.09375*(t-80)*(t-80)+120; if(t > 80) { clearInterval(id); } }, 12.5); }
function game_close() { setTimeout("game_fadeout()",0); setTimeout("game_return()",300); } function game_fadeout() { var back=document.getElementById("kyoto-menu-background"); var gamebase=document.getElementById("kyoto-game-base"); var opa = 1.0; var opa1 = 0.9 var id = setInterval(function() { back.style.opacity = opa1; gamebase.style.opacity = opa; opa+=-0.2; opa1+=-0.18 if(opa < 0) { clearInterval(id); } }, 60); } function game_return() { var back=document.getElementById("kyoto-menu-background"); var gamebase=document.getElementById("kyoto-game-base"); back.style.height="0%"; gamebase.style.top="-480px"; } function game_start() { }
</script> </html>