-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
24 lines (18 loc) · 1.39 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use strict";
function clearActive() {
for (var a in elements) for (var b in elements[a].classList) "active" === elements[a].classList[b] && elements[a].classList.remove("active");
}
function addActive(a) {
elements[a].classList.add("active");
}
function printSequence(a) {
for (var b = sequence[a], c = 0; c < b.length; c++) "1" === b[c] && addActive(c);
}
function stepSequence() {
clearActive(), counter >= sequence.length && (counter = 0), printSequence(counter),
document.getElementById("display").innerHTML = sequence[counter], counter++, setTimeout(stepSequence, frequency);
}
var frequency = 1e3, sequence = [ "000000", "000001", "000010", "000011", "000100", "000101", "000110", "000111", "001000", "001001", "001010", "001011", "001100", "001101", "001110", "001111", "010000", "010001", "010010", "010011", "010100", "010101", "010110", "010111", "011000", "011001", "011010", "011011", "011100", "011101", "011110", "011111", "100000", "100001", "100010", "100011", "100100", "100101", "100110", "100111", "101000", "101001", "101010", "101011", "101100", "101101", "101110", "101111", "110000", "110001", "110010", "110011", "110100", "110101", "110110", "110111", "111000", "111001", "111010", "111011", "111100", "111101", "111110", "111111" ], elements = document.getElementById("shape").getElementsByTagName("*"), counter = 0;
window.onload = function() {
stepSequence();
};