-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitialValues.js
166 lines (139 loc) · 3.81 KB
/
initialValues.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
let lissaY = 1;
let lissaX = 1;
let multiX = 0;
let multiY = 0;
let initialX = 1;
let initialY = 3;
let multiplierX = 1;
let multiplierY = 1;
let distance = 700;
let polar = 0; //polarity//
let radi = 0; //graph rotation//
let amount = 500; //density of data present on screen//
let click = 0; //menu position//
let blend = 0; //blendmode setting//
let startP = 0; //starting point for all points//
let trigxNum = 0;
let trigyNum = 0;
//transparency settings//
let transSettings = 0;
let backTrans = 20;
let lineTrans = 255;
let fillTrans = 50;
//point, line, triangle settings//
let lineSettings = 0;
let lineCount = 0;
let pointSpacing = 1;
let bpress = 0; //prints to console if button is pressed or not//
let trails = 0; //whether "o" (Y on controller) is pressed or not//
let twist = 180; //the direction/speed the graph is generated//
let colour = 3;
let speed = 0.05;
// let t = 200;
let timerCount = 0;
let timerRunning = 0;
let analogStickSign = 1;
let analogStickMap = 1000;
let check = 1;
let analogStickTimer;
let analogsticky;
let funcx = 'sin'; // Change this variable to switch between sin, cos, or other functions
let funcy = 'sin';
let elements = [
"Distance",
"Transparency",
"Radians",
"Polarity",
"xtrig",
"ytrig",
"Lines",
"Amount",
"Twist",
"BlendMode",
"Colour",
"BeansX",
"BeansY"
];
let eyes = new keyboard(); // is eyes used???
const trigFunctions = {
sin: Math.sin,
cos: Math.cos,
tan: Math.tan,
asin: Math.asin,
acos: Math.acos,
atan: Math.atan,
reciprocalSin: (value) => 1 / Math.sin(value),
reciprocalCos: (value) => 1 / Math.cos(value),
reciprocalTan: (value) => 1 / Math.tan(value),
reciprocalASin: (value) => 1 / Math.asin(value),
reciprocalACos: (value) => 1 / Math.acos(value),
reciprocalATan: (value) => 1 / Math.atan(value)
};
let trigArray = [
"sin",
"cos",
"tan",
"asin",
"acos",
"atan",
"reciprocalSin",
"reciprocalCos",
"reciprocalTan",
"reciprocalASin",
"reciprocalACos",
"reciprocalATan"
];
function calculateTrig(value, funcName) {
// Check if the function exists in the mapping
if (trigFunctions[funcName]) {
// Call the function using bracket notation
return trigFunctions[funcName](value);
}
return 0;
}
// function mybutton(boop) { //changes click when mouse presses buttons
// click = boop;
// document.getElementById(elements[boop]).style.color = "#FFFFFF";
// elements.forEach((element, i) => {
// if (i != boop) {
// document.getElementById(element).style.color = "#8B8B8B";
// }
// });
// }
function mybutton(buttonIndex) {
// Get all buttons in the group
const buttons = document.querySelectorAll('.btn-group-vertical .btn');
// Remove primary style from all buttons and add secondary style
buttons.forEach((button, index) => {
if (index === buttonIndex) {
button.classList.remove('btn-secondary-custom');
button.classList.add('btn-primary-custom');
} else {
button.classList.remove('btn-primary-custom');
button.classList.add('btn-secondary-custom');
}
});
}
const blendModes = [
() => blendMode(BLEND),
() => blendMode(SCREEN),
() => blendMode(ADD),
() => blendMode(DIFFERENCE),
() => blendMode(EXCLUSION),
() => blendMode(LIGHTEST),
() => blendMode(OVERLAY),
() => blendMode(HARD_LIGHT),
() => blendMode(SOFT_LIGHT),
() => blendMode(DODGE)
];
function setBlendModeByIndex(index) {
const selectedBlendMode = blendModes[index];
if (selectedBlendMode) {
selectedBlendMode();
} else {
console.error("Invalid blend mode index");
}
}
let backgroundColor = '#000000';
let outlineColor1 = '#FFFFFF';
let outlineColor2 = '#009DFF';