* @description 创建随机点 * @param bounds 范围 * @returns
(bounds)
| 2264 | * @returns |
| 2265 | */ |
| 2266 | function createRandomPoint(bounds) { |
| 2267 | // 范围 |
| 2268 | const { x, y, width, height } = bounds; |
| 2269 | // 横坐标 |
| 2270 | const randX = x + Math.random() * width * 0.5 + width * 0.25; |
| 2271 | // 纵坐标 |
| 2272 | const randY = y + Math.random() * height * 0.5 + height * 0.25; |
| 2273 | return { |
| 2274 | x: randX, |
| 2275 | y: randY, |
| 2276 | }; |
| 2277 | } |
| 2278 | /** |
| 2279 | * @description 生成随机路径 |
| 2280 | * @param start |