@bettergi/utils 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/game.js +3 -2
- package/package.json +3 -2
package/README.md
CHANGED
package/dist/game.js
CHANGED
|
@@ -92,13 +92,14 @@ export const setTimeTo = async (hour, minute, options) => {
|
|
|
92
92
|
// 1.打开时间页面
|
|
93
93
|
await openMenu("时间", true);
|
|
94
94
|
// 2.计算调整时钟的路径点
|
|
95
|
-
const { centerX = 1440, centerY = 502, offsetHours = 6, radius =
|
|
95
|
+
const { centerX = 1440, centerY = 502, offsetHours = 6, radius = 150, smooth = 4 } = options || {};
|
|
96
96
|
const radian = ((((hour + offsetHours) * 60 + minute) % 1440) / 1440) * Math.PI * 2;
|
|
97
|
+
const trackRadius = radius + 150; // 增加拨动半径,提高准确度
|
|
97
98
|
const waypoints = [{ x: centerX, y: centerY }].concat(Array.from({ length: Math.max(smooth, 3) })
|
|
98
99
|
// 计算弧度
|
|
99
100
|
.map((_, i) => radian + (1 + i / (Math.max(smooth, 3) - 1)) * Math.PI)
|
|
100
101
|
// 计算相对圆点坐标
|
|
101
|
-
.map(rad => ({ x:
|
|
102
|
+
.map(rad => ({ x: trackRadius * Math.cos(rad), y: trackRadius * Math.sin(rad) }))
|
|
102
103
|
// 计算绝对坐标
|
|
103
104
|
.map(p => ({ x: Math.round(p.x + centerX), y: Math.round(p.y + centerY) })));
|
|
104
105
|
// 3.调整时间
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettergi/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "开发 BetterGI 脚本常用工具集",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Bread Grocery<https://github.com/breadgrocery>",
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
32
|
"dev": "tsc --watch",
|
|
33
|
-
"build": "tsc"
|
|
33
|
+
"build": "rimraf dist && tsc"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@bettergi/types": "^0.1.3",
|
|
37
|
+
"rimraf": "^6.0.1",
|
|
37
38
|
"typescript": "^5.9.3"
|
|
38
39
|
}
|
|
39
40
|
}
|