Skip to content

Commit

Permalink
declare once, keeping it value in range [0;360]
Browse files Browse the repository at this point in the history
  • Loading branch information
enejko committed Jun 20, 2019
1 parent 8c085da commit 9a7b5f5
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -42,15 +42,16 @@
startTime = timestamp;
}

let rotateCount = (timestamp - startTime) / 3;
rotateCount = (timestamp - startTime) / 3;

// If rotateCount gets over 359, set it to 'remainder of dividing by 360'
if(rotateCount > 359) {
rotateCount %= 360;
}

// Set the rotation of the div to be equal to rotateCount degrees
spinner.style.transform = 'rotate(' + rotateCount + 'deg)';

// If rotateCount gets to 360, set it back to 0, set it back to 0
if(rotateCount > 359) {
rotateCount -= 360;
}

// Call the next frame in the animation
rAF = requestAnimationFrame(draw);
}
Expand Down

0 comments on commit 9a7b5f5

Please sign in to comment.