Skip to content

Commit f07a64c

Browse files
committed
fixed animating - without the px it would not actually move
1 parent 6997fdf commit f07a64c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

js/worker-main.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(function () {
55
"use strict";
66

7-
var SQUARE_SIZE = 75;
7+
var SQUARE_SIZE = 50;
88
var MOVEMENT_STEP = 3;
99

1010
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
@@ -52,26 +52,26 @@
5252
var top = parseInt(square.style.top, 10);
5353
var right = left + SQUARE_SIZE;
5454
var bottom = top + SQUARE_SIZE;
55-
55+
5656
switch (direction) {
5757
case 37: // left
5858
if (left > 0) {
59-
square.style.left = left - MOVEMENT_STEP;
59+
square.style.left = left - MOVEMENT_STEP + 'px';
6060
}
6161
break;
6262
case 38: // up
6363
if (top > 0) {
64-
square.style.top = top - MOVEMENT_STEP;
64+
square.style.top = top - MOVEMENT_STEP + 'px';
6565
}
6666
break;
6767
case 39: //right
6868
if (right < document.documentElement.clientWidth) {
69-
square.style.left = left + MOVEMENT_STEP;
69+
square.style.left = left + MOVEMENT_STEP + 'px';
7070
}
7171
break;
7272
case 40: // down
7373
if (bottom < document.documentElement.clientHeight) {
74-
square.style.top = top + MOVEMENT_STEP;
74+
square.style.top = top + MOVEMENT_STEP + 'px';
7575
}
7676
break;
7777
default:

0 commit comments

Comments
 (0)