Skip to content

Commit

Permalink
添加:vector2 静态方法
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightre committed Apr 20, 2024
1 parent d7650ed commit 381d66c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"tslib": "^2.6.2",
"typedoc": "^0.25.7",
"typedoc-theme-category-nav": "^0.0.3",
"typescript": "^5.3.3",
"vite": "^5.0.10"
"vite": "^5.0.10",
"typescript": "^5.3.3"
},
"author": "nightscra",
"license": "MIT"
Expand Down
15 changes: 15 additions & 0 deletions src/math/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ class Vector2 implements IPoolable, ICopyable<Vector2> {
static fromAngle(angle: number): Vector2 {
return new Vector2(Math.cos(angle), Math.sin(angle));
}
static get DOWN() {
return new Vector2(0, -1)
}
static get UP() {
return new Vector2(0, -1)
}
static get LEFT() {
return new Vector2(1, 0)
}
static get RIGHT() {
return new Vector2(-1, 0)
}
static get ZERO(){
return new Vector2(0, 0)
}
}

export default Vector2

0 comments on commit 381d66c

Please sign in to comment.