2025-03-05 20:16:34 -05:00
|
|
|
var nothingness = (window.localStorage.getItem('nothings') || 1) * 1, nGain = 0.003;
|
2025-03-05 01:00:00 -05:00
|
|
|
var getBonus = 0;
|
|
|
|
|
|
|
|
var mx = 0, my = 0;
|
2025-03-04 22:32:32 -05:00
|
|
|
|
|
|
|
let clicking = false;
|
|
|
|
|
2025-03-06 17:14:22 -05:00
|
|
|
let counts = JSON.parse(window.localStorage.getItem('counts')) || {};
|
|
|
|
|
|
|
|
var cubePos = [];
|
2025-03-04 22:32:32 -05:00
|
|
|
|
2025-03-05 01:00:00 -05:00
|
|
|
window.addEventListener('mousemove', (e) => {
|
|
|
|
mx = e.pageX;
|
|
|
|
my = e.pageY;
|
|
|
|
});
|
|
|
|
|
2025-03-05 13:24:24 -05:00
|
|
|
document.querySelector('canvas').addEventListener('click', (e) => {
|
2025-03-07 03:46:03 -05:00
|
|
|
let p1 = MDN.perspectiveMatrix(Math.PI * 100 / 180, ratio, 0.01, 1000)
|
|
|
|
|
2025-03-05 01:00:00 -05:00
|
|
|
for (let cubieI in cubePos) {
|
2025-03-07 10:47:05 -05:00
|
|
|
let bonus = 1 + counts.doNothing / (cubieI * .02 + 2);
|
2025-03-07 03:46:03 -05:00
|
|
|
|
2025-03-05 01:00:00 -05:00
|
|
|
let cubie = cubePos[cubieI];
|
2025-03-05 19:23:33 -05:00
|
|
|
let p2 = MDN.multiplyPoint(p1, [cubie[0], cubie[1], cubie[2], 0]);
|
2025-03-05 01:00:00 -05:00
|
|
|
|
2025-03-05 19:23:33 -05:00
|
|
|
p2[0] /= p2[3];
|
|
|
|
p2[1] /= p2[3];
|
2025-03-05 01:00:00 -05:00
|
|
|
|
2025-03-05 19:23:33 -05:00
|
|
|
p2[0] -= (mx - width / 2) / width * 2;
|
|
|
|
p2[1] += (my - height / 2) / height * 2;
|
2025-03-05 01:00:00 -05:00
|
|
|
|
2025-03-05 19:26:24 -05:00
|
|
|
let b = 1 / (Math.sqrt(p2[0] ** 2 + p2[1] ** 2) + .03);
|
2025-03-07 03:46:03 -05:00
|
|
|
b = (b * b) * 0.0001
|
|
|
|
b *= bonus;
|
2025-03-05 01:00:00 -05:00
|
|
|
|
|
|
|
getBonus += b;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2025-03-04 22:32:32 -05:00
|
|
|
setInterval(function () {
|
2025-03-05 01:00:00 -05:00
|
|
|
nothingness += nGain + getBonus;
|
2025-03-06 21:31:44 -05:00
|
|
|
nGain = 0.003 + 0.003 * cubePos.length;
|
2025-03-05 13:24:24 -05:00
|
|
|
getBonus *= 0.93;
|
2025-03-04 22:32:32 -05:00
|
|
|
|
2025-03-07 03:46:03 -05:00
|
|
|
for (let ab in cubePos) {
|
|
|
|
let a = cubePos[ab];
|
2025-03-07 10:47:05 -05:00
|
|
|
let bonus = 1 + counts.doNothing / (ab* .02 + 2);
|
2025-03-07 03:46:03 -05:00
|
|
|
bonus = (bonus) ** 0.05;
|
|
|
|
|
|
|
|
let f = (nGain + getBonus * bonus * 10000 + 10) / (nothingness + 10);
|
2025-03-10 05:14:15 -04:00
|
|
|
f /= (counts.intersectThings + 1);
|
2025-03-04 22:32:32 -05:00
|
|
|
|
2025-03-06 21:31:44 -05:00
|
|
|
let dist = Math.sqrt(a[0] ** 2 + a[1] ** 2)
|
2025-03-07 03:46:03 -05:00
|
|
|
dist = (f * 90 / dist) ** 0.1;
|
2025-03-04 22:32:32 -05:00
|
|
|
|
2025-03-06 21:31:44 -05:00
|
|
|
a[3] = a[3] * 0.9 + a[0] * (dist - 1);
|
|
|
|
a[4] = a[4] * 0.9 + a[1] * (dist - 1);
|
2025-03-05 13:24:24 -05:00
|
|
|
|
2025-03-06 21:31:44 -05:00
|
|
|
a[0] += a[3] * 0.01;
|
|
|
|
a[1] += a[4] * 0.01;
|
2025-03-05 13:24:24 -05:00
|
|
|
|
2025-03-07 03:46:03 -05:00
|
|
|
a[3] += Math.sin(f * 0.1) * a[1];
|
2025-03-04 22:32:32 -05:00
|
|
|
|
2025-03-07 03:46:03 -05:00
|
|
|
a[4] += -Math.sin(f * 0.1) * a[0];
|
2025-03-05 13:24:24 -05:00
|
|
|
}
|
2025-03-04 22:32:32 -05:00
|
|
|
}, 1000 / 60)
|
|
|
|
|
2025-03-05 01:00:00 -05:00
|
|
|
|
2025-03-05 13:24:24 -05:00
|
|
|
document.querySelector('canvas').addEventListener('click', async (e) => {
|
2025-03-04 22:32:32 -05:00
|
|
|
if (clicking) return;
|
|
|
|
clicking = true;
|
2025-03-05 13:24:24 -05:00
|
|
|
getBonus += 0.01;
|
2025-03-04 22:32:32 -05:00
|
|
|
clicking = false;
|
2025-03-05 01:00:00 -05:00
|
|
|
})
|
2025-03-05 20:16:34 -05:00
|
|
|
|
|
|
|
setInterval(function () {
|
|
|
|
window.localStorage.setItem('nothings', nothingness);
|
2025-03-06 17:14:22 -05:00
|
|
|
window.localStorage.setItem('counts', JSON.stringify(counts));
|
2025-03-05 20:16:34 -05:00
|
|
|
}, 1000)
|