Permalink
Browse files

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

…webkit
  • Loading branch information...
1 parent a6ffe7f commit 9aa9d5905a1a6e48af75ee36cc1a6dc1b55b23da @icefox committed Feb 21, 2010
Showing with 38 additions and 20 deletions.
  1. +34 −16 anigma.js
  2. +4 −4 style.css
View
@@ -148,13 +148,27 @@ function checkLevel()
}
}
-function outOfTime()
+function outOfTime(event)
{
- if (levelCompleted) {
+ if (event.propertyName !== 'width') {
return;
}
- showMessageBox('Out of Time!');
- changeScore(-10);
+ if (clock.style.width === '100%') {
+ // turn back on duration
+ clock.style.webkitTransitionDuration = clock.time + 's';
+ clock.style.MozTransitionDuration = clock.time + 's';
+ clock.style.OTransitionDuration = clock.time + 's';
+
+ // start animating to 0
+ clock.style.backgroundColor = 'red';
+ clock.style.width = '0%';
+ } else {
+ if (levelCompleted) {
+ return;
+ }
+ showMessageBox('Out of Time!');
+ changeScore(-10);
+ }
}
function selectJewel(node)
@@ -725,18 +739,25 @@ function loadLevelFile(level)
clock.time = 45;
}
- // turnoff the duration
- clock.style.webkitTransitionDuration = '0';
- clock.style.MozTransitionDuration = '0';
- clock.style.OTransitionDuration = '0';
+ if (clock.style.width === '100%') {
+ outOfTime();
+ } else {
+ // turnoff the duration
+ clock.style.webkitTransitionDuration = '1s';
+ clock.style.MozTransitionDuration = '1s';
+ clock.style.OTransitionDuration = '1s';
- // reset bg color and width
- clock.style.backgroundColor = 'white';
- clock.style.width = '100%';
+ // reset bg color and width
+ clock.style.backgroundColor = 'white';
+ clock.style.width = '100%';
+ }
- // force rendering engine to set width/color
- window.getComputedStyle(clock, null).width;
+ checkGravity();
+ levelCompleted = false;
+}
+function resetClockDone()
+{
// turn back on duration
clock.style.webkitTransitionDuration = clock.time + 's';
clock.style.MozTransitionDuration = clock.time + 's';
@@ -745,9 +766,6 @@ function loadLevelFile(level)
// start animating to 0
clock.style.backgroundColor = 'red';
clock.style.width = '0%';
-
- checkGravity();
- levelCompleted = false;
}
function loadLevel()
View
@@ -242,19 +242,19 @@ div.gameobject {
#clock, #score {
height: 3px;
- width: 0px;
+ width: 0%;
-webkit-transition-property: width, background-color;
-webkit-transition-timing-function: linear;
- -webkit-transition-duration: 0s;
+ -webkit-transition-duration: 0.1s;
-moz-transition-property: width, background-color;
-moz-transition-timing-function: linear;
- -moz-transition-duration: 0s;
+ -moz-transition-duration: 0.1s;
-o-transition-property: width, background-color;
-o-transition-timing-function: linear;
- -o-transition-duration: 0s;
+ -o-transition-duration: 0.1s;
}
#clock {

0 comments on commit 9aa9d59

Please sign in to comment.