Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. cycleColor = function() {
  2. ++curColor;
  3. if (curColor == colors.length) {
  4. curColor = 0;
  5. }
  6. jello.className = "jello " + colors[curColor];
  7. },
  8. checkColorMatch = function() {
  9. if (curColor == nextMatchColor) {
  10. ++streak;
  11. dur -= 10;
  12. if (dur < minDur) {
  13. dur = minDur;
  14.  
  15. }
  16. streakCounter.innerHTML = streak;
  17. } else {
  18. streak = 0;
  19. dur = 2000;
  20. streakCounter.innerHTML = "";
  21. }
  22.  
  23. prevMatchColor = nextMatchColor;
  24. nextMatchColor = chooseColor();
  25.  
  26. boxes[0].className = "box " + colors[prevMatchColor];
  27. boxes[1].className = "box " + colors[nextMatchColor];
  28.  
  29. rerun();
  30. setTimeout(checkColorMatch, dur);
  31. };
  32.  
  33. main.classList.add("run");
  34. jello.classList.add(colors[curColor]);
  35. boxes[0].classList.add(colors[prevMatchColor]);
  36. boxes[1].classList.add(colors[nextMatchColor]);
  37.  
  38. for (b in boxes) {
  39. if (b < boxes.length) {
  40. boxes[b].classList.add(colors[chooseColor()]);
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement