diff --git a/docs/js/idle.js b/docs/js/idle.js index 49a6d4f..7525a5f 100644 --- a/docs/js/idle.js +++ b/docs/js/idle.js @@ -17,15 +17,16 @@ document.querySelector('canvas').addEventListener('click', (e) => { let p1 = MDN.perspectiveMatrix(Math.PI * 100 / 180, ratio, 0.01, 1000); for (let cubieI in cubePos) { let cubie = cubePos[cubieI]; - let p2 = MDN.multiplyPoint(p1, [cubie[0], cubie[1], cubie[2], 1]); + let p2 = MDN.multiplyPoint(p1, [cubie[0], cubie[1], cubie[2], 0]); - p2[0] /= width; - p2[1] /= height; + p2[0] /= p2[3]; + p2[1] /= p2[3]; - p2[0] += (mx - width / 2) / width * 2; - p2[1] -= (my - height / 2) / height * 2; + p2[0] -= (mx - width / 2) / width * 2; + p2[1] += (my - height / 2) / height * 2; - let b = 0.001 / (Math.sqrt(p2[0] ** 2 + p2[1] ** 2) + .003); + let b = 1 / (Math.sqrt(p2[0] ** 2 + p2[1] ** 2) + .003); + b = (b * b) * 0.001; getBonus += b; }