Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cycleColor = function() {
- ++curColor;
- if (curColor == colors.length) {
- curColor = 0;
- }
- jello.className = "jello " + colors[curColor];
- },
- checkColorMatch = function() {
- if (curColor == nextMatchColor) {
- ++streak;
- dur -= 10;
- if (dur < minDur) {
- dur = minDur;
- }
- streakCounter.innerHTML = streak;
- } else {
- streak = 0;
- dur = 2000;
- streakCounter.innerHTML = "";
- }
- prevMatchColor = nextMatchColor;
- nextMatchColor = chooseColor();
- boxes[0].className = "box " + colors[prevMatchColor];
- boxes[1].className = "box " + colors[nextMatchColor];
- rerun();
- setTimeout(checkColorMatch, dur);
- };
- main.classList.add("run");
- jello.classList.add(colors[curColor]);
- boxes[0].classList.add(colors[prevMatchColor]);
- boxes[1].classList.add(colors[nextMatchColor]);
- for (b in boxes) {
- if (b < boxes.length) {
- boxes[b].classList.add(colors[chooseColor()]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement