-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript1.js
More file actions
96 lines (93 loc) · 4.93 KB
/
Copy pathscript1.js
File metadata and controls
96 lines (93 loc) · 4.93 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
colorButtonMassive = [
[0,0,1],
[1,0,0],
[0,1,0],
[1,1,0],
[1,0,1],
[0,1,1],
[1,1,1],
[0,0,1],
[1,0,0],
[0,0,0],
[1,1,1],
[0,0,0]
];
animateBool = true;
arrowBool = true;
function changeBool(e)
{
if(e.id == 'animBool')
{
if(e.checked) animateBool = true;
else animateBool = false;
}
if(e.id == 'arrowChecked')
{
if(e.checked) arrowBool = true;
else arrowBool = false;
}
}
function fun2(e)
{
switch(e.id)
{
case "color1":{colorButtonMassive[0] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[0]);break;}
case "color2":{colorButtonMassive[1] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[1]);break;}
case "color3":{colorButtonMassive[2] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[2]);break;}
case "color4":{colorButtonMassive[3] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[3]);break;}
case "color5":{colorButtonMassive[4] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[4]);break;}
case "color6":{colorButtonMassive[5] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[5]);break;}
case "color7":{colorButtonMassive[6] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[6]);break;}
case "color8":{colorButtonMassive[7] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[7]);break;}
case "color9":{colorButtonMassive[8] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[8]);break;}
case "color10":{colorButtonMassive[9] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[9]);break;}
case "color11":{colorButtonMassive[10] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[10]);break;}
case "color12":{colorButtonMassive[11] = [Math.round(Math.random()),Math.round(Math.random()),Math.round(Math.random())];colorType(e, colorButtonMassive[11]);break;}
}
}
function colorType(e, object)
{
if (object[0] == 0 && object[1] == 0 && object[2] == 1) e.style.backgroundColor = 'blue';
if (object[0] == 0 && object[1] == 1 && object[2] == 0) e.style.backgroundColor = 'green';
if (object[0] == 1 && object[1] == 0 && object[2] == 0) e.style.backgroundColor = 'red';
if (object[0] == 1 && object[1] == 0 && object[2] == 1) e.style.backgroundColor = 'magenta';
if (object[0] == 1 && object[1] == 1 && object[2] == 1) e.style.backgroundColor = 'white';
if (object[0] == 0 && object[1] == 1 && object[2] == 1) e.style.backgroundColor = 'cyan';
if (object[0] == 1 && object[1] == 1 && object[2] == 0) e.style.backgroundColor = 'yellow';
if (object[0] == 0 && object[1] == 0 && object[2] == 0) e.style.backgroundColor = 'black';
}
function saveAsJPG()
{
var myCanvas = document.getElementById('canvas3D');
var dataUri = myCanvas.toDataURL('image/jpeg');
console.log(myCanvas.toDataURL('image/jpeg'));
document.getElementById('linkJpg').href = dataUri;
}
function objectsChanged(e)
{
if(e.id == 'speedAnim')
{
if(e.value < 0.1 || e.value > 20)
{
document.getElementById('speedAnim').value = 0.1;
}
}
else
if(e.id == 'zMinimum' || e.id == 'zMaximum')
{
if(document.getElementById('zMinimum').value > document.getElementById('zMaximum').value) document.getElementById('resultGrafx').disabled = true;
else document.getElementById('resultGrafx').disabled = false;
}
else
if(e.id == 'xMinimum' || e.id == 'xMaximum')
{
if(document.getElementById('xMinimum').value>document.getElementById('xMaximum').value) document.getElementById('resultGrafx').disabled = true;
else document.getElementById('resultGrafx').disabled = false;
}
else
if(e.id == 'yMinimum' || e.id == 'yMaximum')
{
if(document.getElementById('yMinimum').value>document.getElementById('yMaximum').value) document.getElementById('resultGrafx').disabled = true;
else document.getElementById('resultGrafx').disabled = false;
}
}