-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
46 lines (45 loc) · 1.84 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<title>Cerberus</title>
<script src="AnimCube3.js"></script>
<div class="cube" style='width: 100vw; height: 100vh;'>
<script>
AnimCube3("edit=0&hint=10&scale=10&speed=1&colorscheme=wybgro&movetext=1");
scrollDown();
</script>
</div>
<script>
let scramble = "";
function scrollDown() {
let body = document.body;
let html = document.documentElement;
let height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
window.scrollTo(0, height);
}
function test(scramble){
console.log(scramble);
AnimCube3("edit=0&hint=10&scale=10&speed=1&colorscheme=wybgro&movetext=1&initmove="+scramble);
scrollDown();
}
document.onkeydown = function(e){
e = e || window.event;
var key = e.which || e.keyCode;
if(key===77){ // 'm' --> move sequence to be executed starting from the current state of the cube
let newScramble = prompt("Enter the scramble: ");
if(newScramble==null){
test(scramble);
}else{
scramble += newScramble;
test(scramble);
}
}else if(key==67){ //'c' --> clear all scrambles and start with a fully solved cube
scramble="";
AnimCube3("edit=0&hint=10&scale=10&speed=1&colorscheme=wybgro&movetext=1");
scrollDown();
}else if(key==65){ //'a' --> animate a move sequence
let animationScramble = prompt("Enter the animation sequence: ");
console.log(animationScramble);
AnimCube3("edit=0&hint=10&scale=10&speed=2&colorscheme=wybgro&movetext=1&buttonheight=25&repeat=0&initmove="+scramble+"&move="+animationScramble);
scrollDown();
scramble += animationScramble;
}
}
</script>