Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Depend on what is in the spec and not behavior that happens to be in …

…webkit
  • Loading branch information...
commit 9aa9d5905a1a6e48af75ee36cc1a6dc1b55b23da 1 parent a6ffe7f
Benjamin C Meyer authored

Showing 2 changed files with 38 additions and 20 deletions. Show diff stats Hide diff stats

  1. +34 16 anigma.js
  2. +4 4 style.css
50 anigma.js
@@ -148,13 +148,27 @@ function checkLevel()
148 148 }
149 149 }
150 150
151   -function outOfTime()
  151 +function outOfTime(event)
152 152 {
153   - if (levelCompleted) {
  153 + if (event.propertyName !== 'width') {
154 154 return;
155 155 }
156   - showMessageBox('Out of Time!');
157   - changeScore(-10);
  156 + if (clock.style.width === '100%') {
  157 + // turn back on duration
  158 + clock.style.webkitTransitionDuration = clock.time + 's';
  159 + clock.style.MozTransitionDuration = clock.time + 's';
  160 + clock.style.OTransitionDuration = clock.time + 's';
  161 +
  162 + // start animating to 0
  163 + clock.style.backgroundColor = 'red';
  164 + clock.style.width = '0%';
  165 + } else {
  166 + if (levelCompleted) {
  167 + return;
  168 + }
  169 + showMessageBox('Out of Time!');
  170 + changeScore(-10);
  171 + }
158 172 }
159 173
160 174 function selectJewel(node)
@@ -725,18 +739,25 @@ function loadLevelFile(level)
725 739 clock.time = 45;
726 740 }
727 741
728   - // turnoff the duration
729   - clock.style.webkitTransitionDuration = '0';
730   - clock.style.MozTransitionDuration = '0';
731   - clock.style.OTransitionDuration = '0';
  742 + if (clock.style.width === '100%') {
  743 + outOfTime();
  744 + } else {
  745 + // turnoff the duration
  746 + clock.style.webkitTransitionDuration = '1s';
  747 + clock.style.MozTransitionDuration = '1s';
  748 + clock.style.OTransitionDuration = '1s';
732 749
733   - // reset bg color and width
734   - clock.style.backgroundColor = 'white';
735   - clock.style.width = '100%';
  750 + // reset bg color and width
  751 + clock.style.backgroundColor = 'white';
  752 + clock.style.width = '100%';
  753 + }
736 754
737   - // force rendering engine to set width/color
738   - window.getComputedStyle(clock, null).width;
  755 + checkGravity();
  756 + levelCompleted = false;
  757 +}
739 758
  759 +function resetClockDone()
  760 +{
740 761 // turn back on duration
741 762 clock.style.webkitTransitionDuration = clock.time + 's';
742 763 clock.style.MozTransitionDuration = clock.time + 's';
@@ -745,9 +766,6 @@ function loadLevelFile(level)
745 766 // start animating to 0
746 767 clock.style.backgroundColor = 'red';
747 768 clock.style.width = '0%';
748   -
749   - checkGravity();
750   - levelCompleted = false;
751 769 }
752 770
753 771 function loadLevel()
8 style.css
@@ -242,19 +242,19 @@ div.gameobject {
242 242
243 243 #clock, #score {
244 244 height: 3px;
245   - width: 0px;
  245 + width: 0%;
246 246
247 247 -webkit-transition-property: width, background-color;
248 248 -webkit-transition-timing-function: linear;
249   - -webkit-transition-duration: 0s;
  249 + -webkit-transition-duration: 0.1s;
250 250
251 251 -moz-transition-property: width, background-color;
252 252 -moz-transition-timing-function: linear;
253   - -moz-transition-duration: 0s;
  253 + -moz-transition-duration: 0.1s;
254 254
255 255 -o-transition-property: width, background-color;
256 256 -o-transition-timing-function: linear;
257   - -o-transition-duration: 0s;
  257 + -o-transition-duration: 0.1s;
258 258 }
259 259
260 260 #clock {

0 comments on commit 9aa9d59

Please sign in to comment.
Something went wrong with that request. Please try again.