diff --git a/public/css/main.css b/public/css/main.css index a7bb4df..d31edaa 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -16,7 +16,7 @@ h1 { } h2 { font-size: 24px; - margin-bottom: 30px; + margin-bottom: 20px; } p { font-size: 18px; @@ -25,12 +25,23 @@ p { margin: auto; width: 650px; } +.instruction-box { + height: 95px; + overflow: hidden; + -moz-transition: height 0.5s ease; + -webkit-transition: height 0.5s ease; + transition: height 0.5s ease; +} #canvas { width: 600px; height: 600px; border: solid #3ef74e 5px; border-radius: 15px; background-color: black; + opacity: 0; + -moz-transition: opacity 0.5s ease; + -webkit-transition: opacity 0.5s ease; + transition: opacity 0.5s ease; } #programsInput { diff --git a/public/index.html b/public/index.html index c7af8f1..04b189d 100644 --- a/public/index.html +++ b/public/index.html @@ -12,10 +12,12 @@

RobotWar

Welcome to the future. It is the year 2002.
Wars still rage, but they are only fought by robots.

-

Type the names of up to five programs to load into the battle robots.

-

You may choose more than one of each.

-

Then press return.

-

(available robots: )

+
+

Type the names of up to five programs to load into the battle robots.

+

You may choose more than one of each.

+

Then press return.

+

(available robots: )

+
diff --git a/public/js/main.js b/public/js/main.js index ef71fe7..46028fa 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -267,8 +267,21 @@ worlds.finish(); } var programs = this.value; - worlds = new Worlds(programs, BUFFER_LENGTH, startGame); - $(this).blur(); + worlds = new Worlds(programs, BUFFER_LENGTH, function(gameInfo) { + // TODO: instead of these hacky setTimeouts, set up + // some jQuery promise objects such that we make + // sure the css animation happens WHILE the initial + // info and the first 1000 worlds are + // being downloaded, not after. + $('.instruction-box').css({height: 0}); + setTimeout(function() { + $('#canvas').css({opacity: 1}); + setTimeout(function() { + startGame(gameInfo); + }, 500); + }, 500); + $(this).blur(); + }.bind(this)); } });