melonjs 14.0.1 → 14.1.0
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 +2 -0
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
- package/dist/melonjs.mjs/_virtual/howler.js +10 -0
- package/dist/melonjs.mjs/_virtual/index.js +10 -0
- package/dist/melonjs.mjs/_virtual/index2.js +10 -0
- package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
- package/dist/melonjs.mjs/application/application.js +240 -0
- package/dist/melonjs.mjs/audio/audio.js +536 -0
- package/dist/melonjs.mjs/camera/camera2d.js +732 -0
- package/dist/melonjs.mjs/entity/entity.js +248 -0
- package/dist/melonjs.mjs/game.js +29 -0
- package/dist/melonjs.mjs/geometries/ellipse.js +275 -0
- package/dist/melonjs.mjs/geometries/line.js +116 -0
- package/dist/melonjs.mjs/geometries/path2d.js +319 -0
- package/dist/melonjs.mjs/geometries/point.js +89 -0
- package/dist/melonjs.mjs/geometries/poly.js +500 -0
- package/dist/melonjs.mjs/geometries/rectangle.js +375 -0
- package/dist/melonjs.mjs/geometries/roundrect.js +168 -0
- package/dist/melonjs.mjs/index.js +248 -0
- package/dist/melonjs.mjs/input/gamepad.js +501 -0
- package/dist/melonjs.mjs/input/input.js +26 -0
- package/dist/melonjs.mjs/input/keyboard.js +470 -0
- package/dist/melonjs.mjs/input/pointer.js +393 -0
- package/dist/melonjs.mjs/input/pointerevent.js +818 -0
- package/dist/melonjs.mjs/lang/deprecated.js +157 -0
- package/dist/melonjs.mjs/level/level.js +297 -0
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +448 -0
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +194 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +639 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +311 -0
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +83 -0
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +506 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +220 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +157 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +125 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +109 -0
- package/dist/melonjs.mjs/loader/loader.js +801 -0
- package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
- package/dist/melonjs.mjs/math/color.js +618 -0
- package/dist/melonjs.mjs/math/math.js +218 -0
- package/dist/melonjs.mjs/math/matrix2.js +503 -0
- package/dist/melonjs.mjs/math/matrix3.js +681 -0
- package/dist/melonjs.mjs/math/observable_vector2.js +471 -0
- package/dist/melonjs.mjs/math/observable_vector3.js +561 -0
- package/dist/melonjs.mjs/math/vector2.js +528 -0
- package/dist/melonjs.mjs/math/vector3.js +569 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
- package/dist/melonjs.mjs/particles/emitter.js +267 -0
- package/dist/melonjs.mjs/particles/particle.js +188 -0
- package/dist/melonjs.mjs/particles/settings.js +319 -0
- package/dist/melonjs.mjs/physics/body.js +704 -0
- package/dist/melonjs.mjs/physics/bounds.js +460 -0
- package/dist/melonjs.mjs/physics/collision.js +132 -0
- package/dist/melonjs.mjs/physics/detector.js +194 -0
- package/dist/melonjs.mjs/physics/quadtree.js +391 -0
- package/dist/melonjs.mjs/physics/response.js +57 -0
- package/dist/melonjs.mjs/physics/sat.js +483 -0
- package/dist/melonjs.mjs/physics/world.js +221 -0
- package/dist/melonjs.mjs/plugin/plugin.js +141 -0
- package/dist/melonjs.mjs/renderable/collectable.js +62 -0
- package/dist/melonjs.mjs/renderable/colorlayer.js +80 -0
- package/dist/melonjs.mjs/renderable/container.js +1018 -0
- package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
- package/dist/melonjs.mjs/renderable/imagelayer.js +306 -0
- package/dist/melonjs.mjs/renderable/light2d.js +156 -0
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +247 -0
- package/dist/melonjs.mjs/renderable/renderable.js +783 -0
- package/dist/melonjs.mjs/renderable/sprite.js +654 -0
- package/dist/melonjs.mjs/renderable/trigger.js +157 -0
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +213 -0
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +226 -0
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +128 -0
- package/dist/melonjs.mjs/state/stage.js +237 -0
- package/dist/melonjs.mjs/state/state.js +596 -0
- package/dist/melonjs.mjs/system/device.js +909 -0
- package/dist/melonjs.mjs/system/dom.js +78 -0
- package/dist/melonjs.mjs/system/event.js +537 -0
- package/dist/melonjs.mjs/system/platform.js +41 -0
- package/dist/melonjs.mjs/system/pooling.js +209 -0
- package/dist/melonjs.mjs/system/save.js +157 -0
- package/dist/melonjs.mjs/system/timer.js +286 -0
- package/dist/melonjs.mjs/text/bitmaptext.js +364 -0
- package/dist/melonjs.mjs/text/bitmaptextdata.js +199 -0
- package/dist/melonjs.mjs/text/glyph.js +66 -0
- package/dist/melonjs.mjs/text/text.js +453 -0
- package/dist/melonjs.mjs/text/textmetrics.js +176 -0
- package/dist/melonjs.mjs/text/textstyle.js +23 -0
- package/dist/melonjs.mjs/tweens/easing.js +336 -0
- package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
- package/dist/melonjs.mjs/tweens/tween.js +480 -0
- package/dist/melonjs.mjs/utils/agent.js +76 -0
- package/dist/melonjs.mjs/utils/array.js +63 -0
- package/dist/melonjs.mjs/utils/file.js +42 -0
- package/dist/melonjs.mjs/utils/function.js +70 -0
- package/dist/melonjs.mjs/utils/string.js +82 -0
- package/dist/melonjs.mjs/utils/utils.js +173 -0
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +807 -0
- package/dist/melonjs.mjs/video/renderer.js +411 -0
- package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
- package/dist/melonjs.mjs/video/texture/cache.js +143 -0
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
- package/dist/melonjs.mjs/video/video.js +462 -0
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +143 -0
- package/dist/melonjs.mjs/video/webgl/glshader.js +168 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
- package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
- package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +495 -0
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1036 -0
- package/dist/melonjs.module.d.ts +1163 -1163
- package/dist/melonjs.module.js +1903 -3274
- package/package.json +22 -17
- package/src/application/application.js +3 -3
- package/src/audio/audio.js +32 -32
- package/src/camera/camera2d.js +31 -31
- package/src/entity/entity.js +17 -17
- package/src/geometries/ellipse.js +16 -16
- package/src/geometries/line.js +5 -5
- package/src/geometries/path2d.js +32 -32
- package/src/geometries/poly.js +15 -15
- package/src/geometries/rectangle.js +18 -18
- package/src/geometries/roundrect.js +8 -8
- package/src/input/gamepad.js +15 -15
- package/src/input/keyboard.js +12 -12
- package/src/input/pointer.js +6 -6
- package/src/input/pointerevent.js +12 -12
- package/src/lang/deprecated.js +12 -12
- package/src/level/level.js +25 -25
- package/src/level/tiled/TMXLayer.js +22 -22
- package/src/level/tiled/TMXTile.js +5 -5
- package/src/level/tiled/TMXTileMap.js +6 -6
- package/src/level/tiled/TMXTileset.js +2 -2
- package/src/level/tiled/TMXUtils.js +5 -5
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +19 -19
- package/src/loader/loader.js +20 -20
- package/src/math/color.js +20 -20
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +16 -16
- package/src/math/matrix3.js +25 -25
- package/src/math/observable_vector2.js +14 -14
- package/src/math/observable_vector3.js +16 -16
- package/src/math/vector2.js +9 -9
- package/src/math/vector3.js +10 -10
- package/src/particles/emitter.js +6 -6
- package/src/particles/particle.js +2 -2
- package/src/physics/body.js +28 -28
- package/src/physics/bounds.js +8 -8
- package/src/physics/collision.js +2 -2
- package/src/physics/detector.js +6 -6
- package/src/physics/quadtree.js +11 -11
- package/src/physics/sat.js +31 -31
- package/src/physics/world.js +5 -5
- package/src/plugin/plugin.js +5 -5
- package/src/renderable/collectable.js +3 -3
- package/src/renderable/colorlayer.js +5 -5
- package/src/renderable/container.js +21 -21
- package/src/renderable/dragndrop.js +14 -14
- package/src/renderable/imagelayer.js +13 -13
- package/src/renderable/light2d.js +3 -3
- package/src/renderable/nineslicesprite.js +16 -16
- package/src/renderable/renderable.js +23 -23
- package/src/renderable/sprite.js +28 -28
- package/src/renderable/trigger.js +15 -15
- package/src/renderable/ui/uibaseelement.js +7 -7
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +13 -13
- package/src/state/stage.js +7 -7
- package/src/state/state.js +17 -17
- package/src/system/device.js +11 -11
- package/src/system/event.js +10 -10
- package/src/system/pooling.js +9 -9
- package/src/system/save.js +2 -2
- package/src/system/timer.js +10 -10
- package/src/text/bitmaptext.js +18 -18
- package/src/text/bitmaptextdata.js +2 -2
- package/src/text/text.js +23 -23
- package/src/text/textmetrics.js +8 -8
- package/src/tweens/tween.js +19 -19
- package/src/utils/agent.js +5 -5
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +2 -2
- package/src/utils/function.js +6 -6
- package/src/utils/string.js +5 -5
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +70 -70
- package/src/video/renderer.js +26 -26
- package/src/video/texture/atlas.js +22 -22
- package/src/video/texture/canvas_texture.js +9 -9
- package/src/video/video.js +17 -17
- package/src/video/webgl/glshader.js +10 -10
- package/src/video/webgl/webgl_compositor.js +41 -41
- package/src/video/webgl/webgl_renderer.js +75 -75
package/src/math/math.js
CHANGED
|
@@ -84,7 +84,7 @@ export function nextPowerOfTwo(val) {
|
|
|
84
84
|
* @public
|
|
85
85
|
* @memberof Math
|
|
86
86
|
* @name degToRad
|
|
87
|
-
* @param {number} angle angle in degrees
|
|
87
|
+
* @param {number} angle - angle in degrees
|
|
88
88
|
* @returns {number} corresponding angle in radians
|
|
89
89
|
* @example
|
|
90
90
|
* // convert a specific angle
|
|
@@ -99,7 +99,7 @@ export function degToRad(angle) {
|
|
|
99
99
|
* @public
|
|
100
100
|
* @memberof Math
|
|
101
101
|
* @name radToDeg
|
|
102
|
-
* @param {number} radians angle in radians
|
|
102
|
+
* @param {number} radians - angle in radians
|
|
103
103
|
* @returns {number} corresponding angle in degrees
|
|
104
104
|
* @example
|
|
105
105
|
* // convert a specific angle
|
|
@@ -114,9 +114,9 @@ export function radToDeg(radians) {
|
|
|
114
114
|
* @public
|
|
115
115
|
* @memberof Math
|
|
116
116
|
* @name clamp
|
|
117
|
-
* @param {number} val the value to clamp
|
|
118
|
-
* @param {number} low lower limit
|
|
119
|
-
* @param {number} high higher limit
|
|
117
|
+
* @param {number} val - the value to clamp
|
|
118
|
+
* @param {number} low - lower limit
|
|
119
|
+
* @param {number} high - higher limit
|
|
120
120
|
* @returns {number} clamped value
|
|
121
121
|
*/
|
|
122
122
|
export function clamp(val, low, high) {
|
|
@@ -128,8 +128,8 @@ export function clamp(val, low, high) {
|
|
|
128
128
|
* @public
|
|
129
129
|
* @memberof Math
|
|
130
130
|
* @name random
|
|
131
|
-
* @param {number} min minimum value.
|
|
132
|
-
* @param {number} max maximum value.
|
|
131
|
+
* @param {number} min - minimum value.
|
|
132
|
+
* @param {number} max - maximum value.
|
|
133
133
|
* @returns {number} random value
|
|
134
134
|
* @example
|
|
135
135
|
* // Print a random number; one of 5, 6, 7, 8, 9
|
|
@@ -144,8 +144,8 @@ export function random(min, max) {
|
|
|
144
144
|
* @public
|
|
145
145
|
* @memberof Math
|
|
146
146
|
* @name randomFloat
|
|
147
|
-
* @param {number} min minimum value.
|
|
148
|
-
* @param {number} max maximum value.
|
|
147
|
+
* @param {number} min - minimum value.
|
|
148
|
+
* @param {number} max - maximum value.
|
|
149
149
|
* @returns {number} random value
|
|
150
150
|
* @example
|
|
151
151
|
* // Print a random number; one of 5, 6, 7, 8, 9
|
|
@@ -160,8 +160,8 @@ export function randomFloat(min, max) {
|
|
|
160
160
|
* @public
|
|
161
161
|
* @memberof Math
|
|
162
162
|
* @name weightedRandom
|
|
163
|
-
* @param {number} min minimum value.
|
|
164
|
-
* @param {number} max maximum value.
|
|
163
|
+
* @param {number} min - minimum value.
|
|
164
|
+
* @param {number} max - maximum value.
|
|
165
165
|
* @returns {number} random value
|
|
166
166
|
* @example
|
|
167
167
|
* // Print a random number; one of 5, 6, 7, 8, 9
|
|
@@ -176,8 +176,8 @@ export function weightedRandom(min, max) {
|
|
|
176
176
|
* @public
|
|
177
177
|
* @memberof Math
|
|
178
178
|
* @name round
|
|
179
|
-
* @param {number} num value to be rounded.
|
|
180
|
-
* @param {number} [dec=0] number of decimal digit to be rounded to.
|
|
179
|
+
* @param {number} num - value to be rounded.
|
|
180
|
+
* @param {number} [dec=0] - number of decimal digit to be rounded to.
|
|
181
181
|
* @returns {number} rounded value
|
|
182
182
|
* @example
|
|
183
183
|
* // round a specific value to 2 digits
|
|
@@ -194,9 +194,9 @@ export function round(num, dec = 0) {
|
|
|
194
194
|
* @public
|
|
195
195
|
* @memberof Math
|
|
196
196
|
* @name toBeCloseTo
|
|
197
|
-
* @param {number} expected value to be compared with.
|
|
198
|
-
* @param {number} actual actual value to compare
|
|
199
|
-
* @param {number} [precision=2] float precision for the comparison
|
|
197
|
+
* @param {number} expected - value to be compared with.
|
|
198
|
+
* @param {number} actual - actual value to compare
|
|
199
|
+
* @param {number} [precision=2] - float precision for the comparison
|
|
200
200
|
* @returns {boolean} if close to
|
|
201
201
|
* @example
|
|
202
202
|
* // test if the given value is close to 10
|
package/src/math/matrix2.js
CHANGED
|
@@ -9,7 +9,7 @@ import Matrix3d from "./matrix3.js";
|
|
|
9
9
|
*/
|
|
10
10
|
class Matrix2d {
|
|
11
11
|
/**
|
|
12
|
-
* @param {(Matrix2d|Matrix3d|...number)} args an instance of me.Matrix2d or me.Matrix3d to copy from, or individual matrix components (See {@link Matrix2d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
12
|
+
* @param {(Matrix2d|Matrix3d|...number)} args - an instance of me.Matrix2d or me.Matrix3d to copy from, or individual matrix components (See {@link Matrix2d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
13
13
|
*/
|
|
14
14
|
constructor(...args) {
|
|
15
15
|
this.onResetEvent(...args);
|
|
@@ -126,7 +126,7 @@ class Matrix2d {
|
|
|
126
126
|
* Copies over the values from another me.Matrix2d.
|
|
127
127
|
* @name copy
|
|
128
128
|
* @memberof Matrix2d
|
|
129
|
-
* @param {Matrix2d} m the matrix object to copy from
|
|
129
|
+
* @param {Matrix2d} m - the matrix object to copy from
|
|
130
130
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
131
131
|
*/
|
|
132
132
|
copy(m) {
|
|
@@ -138,7 +138,7 @@ class Matrix2d {
|
|
|
138
138
|
* Copies over the upper-left 3x3 values from the given me.Matrix3d
|
|
139
139
|
* @name fromMat3d
|
|
140
140
|
* @memberof Matrix2d
|
|
141
|
-
* @param {Matrix3d} m the matrix object to copy from
|
|
141
|
+
* @param {Matrix3d} m - the matrix object to copy from
|
|
142
142
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
143
143
|
*/
|
|
144
144
|
fromMat3d(m) {
|
|
@@ -162,7 +162,7 @@ class Matrix2d {
|
|
|
162
162
|
* multiply both matrix
|
|
163
163
|
* @name multiply
|
|
164
164
|
* @memberof Matrix2d
|
|
165
|
-
* @param {Matrix2d} m the other matrix
|
|
165
|
+
* @param {Matrix2d} m - the other matrix
|
|
166
166
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
167
167
|
*/
|
|
168
168
|
multiply(m) {
|
|
@@ -249,7 +249,7 @@ class Matrix2d {
|
|
|
249
249
|
* apply the current transform to the given 2d or 3d vector
|
|
250
250
|
* @name apply
|
|
251
251
|
* @memberof Matrix2d
|
|
252
|
-
* @param {Vector2d|Vector3d} v the vector object to be transformed
|
|
252
|
+
* @param {Vector2d|Vector3d} v - the vector object to be transformed
|
|
253
253
|
* @returns {Vector2d|Vector3d} result vector object.
|
|
254
254
|
*/
|
|
255
255
|
apply(v) {
|
|
@@ -272,7 +272,7 @@ class Matrix2d {
|
|
|
272
272
|
* apply the inverted current transform to the given 2d vector
|
|
273
273
|
* @name applyInverse
|
|
274
274
|
* @memberof Matrix2d
|
|
275
|
-
* @param {Vector2d} v the vector object to be transformed
|
|
275
|
+
* @param {Vector2d} v - the vector object to be transformed
|
|
276
276
|
* @returns {Vector2d} result vector object.
|
|
277
277
|
*/
|
|
278
278
|
applyInverse(v) {
|
|
@@ -292,8 +292,8 @@ class Matrix2d {
|
|
|
292
292
|
* scale the matrix
|
|
293
293
|
* @name scale
|
|
294
294
|
* @memberof Matrix2d
|
|
295
|
-
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
296
|
-
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
295
|
+
* @param {number} x - a number representing the abscissa of the scaling vector.
|
|
296
|
+
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
297
297
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
298
298
|
*/
|
|
299
299
|
scale(x, y) {
|
|
@@ -313,7 +313,7 @@ class Matrix2d {
|
|
|
313
313
|
* adds a 2D scaling transformation.
|
|
314
314
|
* @name scaleV
|
|
315
315
|
* @memberof Matrix2d
|
|
316
|
-
* @param {Vector2d} v scaling vector
|
|
316
|
+
* @param {Vector2d} v - scaling vector
|
|
317
317
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
318
318
|
*/
|
|
319
319
|
scaleV(v) {
|
|
@@ -324,7 +324,7 @@ class Matrix2d {
|
|
|
324
324
|
* specifies a 2D scale operation using the [sx, 1] scaling vector
|
|
325
325
|
* @name scaleX
|
|
326
326
|
* @memberof Matrix2d
|
|
327
|
-
* @param {number} x x scaling vector
|
|
327
|
+
* @param {number} x - x scaling vector
|
|
328
328
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
329
329
|
*/
|
|
330
330
|
scaleX(x) {
|
|
@@ -335,7 +335,7 @@ class Matrix2d {
|
|
|
335
335
|
* specifies a 2D scale operation using the [1,sy] scaling vector
|
|
336
336
|
* @name scaleY
|
|
337
337
|
* @memberof Matrix2d
|
|
338
|
-
* @param {number} y y scaling vector
|
|
338
|
+
* @param {number} y - y scaling vector
|
|
339
339
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
340
340
|
*/
|
|
341
341
|
scaleY(y) {
|
|
@@ -346,7 +346,7 @@ class Matrix2d {
|
|
|
346
346
|
* rotate the matrix (counter-clockwise) by the specified angle (in radians).
|
|
347
347
|
* @name rotate
|
|
348
348
|
* @memberof Matrix2d
|
|
349
|
-
* @param {number} angle Rotation angle in radians.
|
|
349
|
+
* @param {number} angle - Rotation angle in radians.
|
|
350
350
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
351
351
|
*/
|
|
352
352
|
rotate(angle) {
|
|
@@ -377,15 +377,15 @@ class Matrix2d {
|
|
|
377
377
|
* @name translate
|
|
378
378
|
* @memberof Matrix2d
|
|
379
379
|
* @method
|
|
380
|
-
* @param {number} x the x coordindates to translate the matrix by
|
|
381
|
-
* @param {number} y the y coordindates to translate the matrix by
|
|
380
|
+
* @param {number} x - the x coordindates to translate the matrix by
|
|
381
|
+
* @param {number} y - the y coordindates to translate the matrix by
|
|
382
382
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
383
383
|
*/
|
|
384
384
|
/**
|
|
385
385
|
* translate the matrix by a vector on the horizontal and vertical axis
|
|
386
386
|
* @name translateV
|
|
387
387
|
* @memberof Matrix2d
|
|
388
|
-
* @param {Vector2d} v the vector to translate the matrix by
|
|
388
|
+
* @param {Vector2d} v - the vector to translate the matrix by
|
|
389
389
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
390
390
|
*/
|
|
391
391
|
translate() {
|
|
@@ -434,7 +434,7 @@ class Matrix2d {
|
|
|
434
434
|
* return true if the two matrices are identical
|
|
435
435
|
* @name equals
|
|
436
436
|
* @memberof Matrix2d
|
|
437
|
-
* @param {Matrix2d} m the other matrix
|
|
437
|
+
* @param {Matrix2d} m - the other matrix
|
|
438
438
|
* @returns {boolean} true if both are equals
|
|
439
439
|
*/
|
|
440
440
|
equals(m) {
|
package/src/math/matrix3.js
CHANGED
|
@@ -7,7 +7,7 @@ import { EPSILON } from "./math.js";
|
|
|
7
7
|
*/
|
|
8
8
|
class Matrix3d {
|
|
9
9
|
/**
|
|
10
|
-
* @param {(Matrix3d|...number)} args An instance of me.Matrix3d to copy from, or individual Matrix components (See {@link Matrix3d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
10
|
+
* @param {(Matrix3d|...number)} args - An instance of me.Matrix3d to copy from, or individual Matrix components (See {@link Matrix3d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
11
11
|
*/
|
|
12
12
|
constructor(...args) {
|
|
13
13
|
this.onResetEvent(...args);
|
|
@@ -131,7 +131,7 @@ class Matrix3d {
|
|
|
131
131
|
* Copies over the values from another me.Matrix3d.
|
|
132
132
|
* @name copy
|
|
133
133
|
* @memberof Matrix3d
|
|
134
|
-
* @param {Matrix3d} m the matrix object to copy from
|
|
134
|
+
* @param {Matrix3d} m - the matrix object to copy from
|
|
135
135
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
136
136
|
*/
|
|
137
137
|
copy(m) {
|
|
@@ -143,7 +143,7 @@ class Matrix3d {
|
|
|
143
143
|
* Copies over the upper-left 2x2 values from the given me.Matrix2d
|
|
144
144
|
* @name fromMat2d
|
|
145
145
|
* @memberof Matrix3d
|
|
146
|
-
* @param {Matrix2d} m the matrix object to copy from
|
|
146
|
+
* @param {Matrix2d} m - the matrix object to copy from
|
|
147
147
|
* @returns {Matrix2d} Reference to this object for method chaining
|
|
148
148
|
*/
|
|
149
149
|
fromMat2d(m) {
|
|
@@ -161,7 +161,7 @@ class Matrix3d {
|
|
|
161
161
|
* multiply both matrix
|
|
162
162
|
* @name multiply
|
|
163
163
|
* @memberof Matrix3d
|
|
164
|
-
* @param {Matrix3d} m Other matrix
|
|
164
|
+
* @param {Matrix3d} m - Other matrix
|
|
165
165
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
166
166
|
*/
|
|
167
167
|
multiply(m) {
|
|
@@ -306,7 +306,7 @@ class Matrix3d {
|
|
|
306
306
|
* apply the current transform to the given 2d or 3d vector
|
|
307
307
|
* @name apply
|
|
308
308
|
* @memberof Matrix3d
|
|
309
|
-
* @param {Vector2d|Vector3d} v the vector object to be transformed
|
|
309
|
+
* @param {Vector2d|Vector3d} v - the vector object to be transformed
|
|
310
310
|
* @returns {Vector2d|Vector3d} result vector object.
|
|
311
311
|
*/
|
|
312
312
|
apply(v) {
|
|
@@ -331,7 +331,7 @@ class Matrix3d {
|
|
|
331
331
|
* apply the inverted current transform to the given 2d or 3d vector
|
|
332
332
|
* @name applyInverse
|
|
333
333
|
* @memberof Matrix3d
|
|
334
|
-
* @param {Vector2d|Vector3d} v the vector object to be transformed
|
|
334
|
+
* @param {Vector2d|Vector3d} v - the vector object to be transformed
|
|
335
335
|
* @returns {Vector2d|Vector3d} result vector object.
|
|
336
336
|
*/
|
|
337
337
|
applyInverse(v) {
|
|
@@ -351,12 +351,12 @@ class Matrix3d {
|
|
|
351
351
|
* <img src="images/glOrtho.gif"/><br>
|
|
352
352
|
* @name ortho
|
|
353
353
|
* @memberof Matrix3d
|
|
354
|
-
* @param {number} left farthest left on the x-axis
|
|
355
|
-
* @param {number} right farthest right on the x-axis
|
|
356
|
-
* @param {number} bottom farthest down on the y-axis
|
|
357
|
-
* @param {number} top farthest up on the y-axis
|
|
358
|
-
* @param {number} near distance to the near clipping plane along the -Z axis
|
|
359
|
-
* @param {number} far distance to the far clipping plane along the -Z axis
|
|
354
|
+
* @param {number} left - farthest left on the x-axis
|
|
355
|
+
* @param {number} right - farthest right on the x-axis
|
|
356
|
+
* @param {number} bottom - farthest down on the y-axis
|
|
357
|
+
* @param {number} top - farthest up on the y-axis
|
|
358
|
+
* @param {number} near - distance to the near clipping plane along the -Z axis
|
|
359
|
+
* @param {number} far - distance to the far clipping plane along the -Z axis
|
|
360
360
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
361
361
|
*/
|
|
362
362
|
ortho(left, right, bottom, top, near, far) {
|
|
@@ -389,9 +389,9 @@ class Matrix3d {
|
|
|
389
389
|
* scale the matrix
|
|
390
390
|
* @name scale
|
|
391
391
|
* @memberof Matrix3d
|
|
392
|
-
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
393
|
-
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
394
|
-
* @param {number} [z=0] a number representing the depth vector
|
|
392
|
+
* @param {number} x - a number representing the abscissa of the scaling vector.
|
|
393
|
+
* @param {number} [y=x] - a number representing the ordinate of the scaling vector.
|
|
394
|
+
* @param {number} [z=0] - a number representing the depth vector
|
|
395
395
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
396
396
|
*/
|
|
397
397
|
scale(x, y, z) {
|
|
@@ -422,7 +422,7 @@ class Matrix3d {
|
|
|
422
422
|
* adds a 2D scaling transformation.
|
|
423
423
|
* @name scaleV
|
|
424
424
|
* @memberof Matrix3d
|
|
425
|
-
* @param {Vector2d|Vector3d} v scaling vector
|
|
425
|
+
* @param {Vector2d|Vector3d} v - scaling vector
|
|
426
426
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
427
427
|
*/
|
|
428
428
|
scaleV(v) {
|
|
@@ -433,7 +433,7 @@ class Matrix3d {
|
|
|
433
433
|
* specifies a 2D scale operation using the [sx, 1] scaling vector
|
|
434
434
|
* @name scaleX
|
|
435
435
|
* @memberof Matrix3d
|
|
436
|
-
* @param {number} x x scaling vector
|
|
436
|
+
* @param {number} x - x scaling vector
|
|
437
437
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
438
438
|
*/
|
|
439
439
|
scaleX(x) {
|
|
@@ -444,7 +444,7 @@ class Matrix3d {
|
|
|
444
444
|
* specifies a 2D scale operation using the [1,sy] scaling vector
|
|
445
445
|
* @name scaleY
|
|
446
446
|
* @memberof Matrix3d
|
|
447
|
-
* @param {number} y y scaling vector
|
|
447
|
+
* @param {number} y - y scaling vector
|
|
448
448
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
449
449
|
*/
|
|
450
450
|
scaleY(y) {
|
|
@@ -455,8 +455,8 @@ class Matrix3d {
|
|
|
455
455
|
* rotate this matrix (counter-clockwise) by the specified angle (in radians).
|
|
456
456
|
* @name rotate
|
|
457
457
|
* @memberof Matrix3d
|
|
458
|
-
* @param {number} angle Rotation angle in radians.
|
|
459
|
-
* @param {Vector3d} v the axis to rotate around
|
|
458
|
+
* @param {number} angle - Rotation angle in radians.
|
|
459
|
+
* @param {Vector3d} v - the axis to rotate around
|
|
460
460
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
461
461
|
*/
|
|
462
462
|
rotate(angle, v) {
|
|
@@ -535,16 +535,16 @@ class Matrix3d {
|
|
|
535
535
|
* @name translate
|
|
536
536
|
* @memberof Matrix3d
|
|
537
537
|
* @method
|
|
538
|
-
* @param {number} x a number representing the abscissa of the vector.
|
|
539
|
-
* @param {number} [y=x] a number representing the ordinate of the vector.
|
|
540
|
-
* @param {number} [z=0] a number representing the depth of the vector
|
|
538
|
+
* @param {number} x - a number representing the abscissa of the vector.
|
|
539
|
+
* @param {number} [y=x] - a number representing the ordinate of the vector.
|
|
540
|
+
* @param {number} [z=0] - a number representing the depth of the vector
|
|
541
541
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
542
542
|
*/
|
|
543
543
|
/**
|
|
544
544
|
* translate the matrix by a vector on the horizontal and vertical axis
|
|
545
545
|
* @name translateV
|
|
546
546
|
* @memberof Matrix3d
|
|
547
|
-
* @param {Vector2d|Vector3d} v the vector to translate the matrix by
|
|
547
|
+
* @param {Vector2d|Vector3d} v - the vector to translate the matrix by
|
|
548
548
|
* @returns {Matrix3d} Reference to this object for method chaining
|
|
549
549
|
*/
|
|
550
550
|
translate() {
|
|
@@ -604,7 +604,7 @@ class Matrix3d {
|
|
|
604
604
|
* return true if the two matrices are identical
|
|
605
605
|
* @name equals
|
|
606
606
|
* @memberof Matrix3d
|
|
607
|
-
* @param {Matrix3d} m the other matrix
|
|
607
|
+
* @param {Matrix3d} m - the other matrix
|
|
608
608
|
* @returns {boolean} true if both are equals
|
|
609
609
|
*/
|
|
610
610
|
equals(m) {
|
|
@@ -9,11 +9,11 @@ import {clamp} from "./math.js";
|
|
|
9
9
|
*/
|
|
10
10
|
class ObservableVector2d extends Vector2d {
|
|
11
11
|
/**
|
|
12
|
-
* @param {number} x x value of the vector
|
|
13
|
-
* @param {number} y y value of the vector
|
|
14
|
-
* @param {object} settings additional required parameters
|
|
15
|
-
* @param {Function} settings.onUpdate the callback to be executed when the vector is changed
|
|
16
|
-
* @param {Function} [settings.scope] the value to use as this when calling onUpdate
|
|
12
|
+
* @param {number} x - x value of the vector
|
|
13
|
+
* @param {number} y - y value of the vector
|
|
14
|
+
* @param {object} settings - additional required parameters
|
|
15
|
+
* @param {Function} settings.onUpdate - the callback to be executed when the vector is changed
|
|
16
|
+
* @param {Function} [settings.scope] - the value to use as this when calling onUpdate
|
|
17
17
|
*/
|
|
18
18
|
constructor(x = 0, y = 0, settings) {
|
|
19
19
|
super(x, y);
|
|
@@ -97,8 +97,8 @@ class ObservableVector2d extends Vector2d {
|
|
|
97
97
|
* set the vector value without triggering the callback
|
|
98
98
|
* @name setMuted
|
|
99
99
|
* @memberof ObservableVector2d
|
|
100
|
-
* @param {number} x x value of the vector
|
|
101
|
-
* @param {number} y y value of the vector
|
|
100
|
+
* @param {number} x - x value of the vector
|
|
101
|
+
* @param {number} y - y value of the vector
|
|
102
102
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
103
103
|
*/
|
|
104
104
|
setMuted(x, y) {
|
|
@@ -111,8 +111,8 @@ class ObservableVector2d extends Vector2d {
|
|
|
111
111
|
* set the callback to be executed when the vector is changed
|
|
112
112
|
* @name setCallback
|
|
113
113
|
* @memberof ObservableVector2d
|
|
114
|
-
* @param {Function} fn callback
|
|
115
|
-
* @param {Function} [scope=null] scope
|
|
114
|
+
* @param {Function} fn - callback
|
|
115
|
+
* @param {Function} [scope=null] - scope
|
|
116
116
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
117
117
|
*/
|
|
118
118
|
setCallback(fn, scope = null) {
|
|
@@ -175,7 +175,7 @@ class ObservableVector2d extends Vector2d {
|
|
|
175
175
|
* Divide this vector values by the passed value
|
|
176
176
|
* @name div
|
|
177
177
|
* @memberof ObservableVector2d
|
|
178
|
-
* @param {number} n the value to divide the vector by
|
|
178
|
+
* @param {number} n - the value to divide the vector by
|
|
179
179
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
180
180
|
*/
|
|
181
181
|
div(n) {
|
|
@@ -335,8 +335,8 @@ class ObservableVector2d extends Vector2d {
|
|
|
335
335
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians).
|
|
336
336
|
* @name rotate
|
|
337
337
|
* @memberof ObservableVector2d
|
|
338
|
-
* @param {number} angle The angle to rotate (in radians)
|
|
339
|
-
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
338
|
+
* @param {number} angle - The angle to rotate (in radians)
|
|
339
|
+
* @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around
|
|
340
340
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
341
341
|
*/
|
|
342
342
|
rotate(angle, v) {
|
|
@@ -384,7 +384,7 @@ class ObservableVector2d extends Vector2d {
|
|
|
384
384
|
* @name lerp
|
|
385
385
|
* @memberof ObservableVector2d
|
|
386
386
|
* @param {Vector2d|ObservableVector2d} v
|
|
387
|
-
* @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
387
|
+
* @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
388
388
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
389
389
|
*/
|
|
390
390
|
lerp(v, alpha) {
|
|
@@ -399,7 +399,7 @@ class ObservableVector2d extends Vector2d {
|
|
|
399
399
|
* @name moveTowards
|
|
400
400
|
* @memberof ObservableVector2d
|
|
401
401
|
* @param {Vector2d|ObservableVector2d} target
|
|
402
|
-
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
402
|
+
* @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
|
|
403
403
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
404
404
|
*/
|
|
405
405
|
moveTowards(target, step) {
|
|
@@ -9,12 +9,12 @@ import pool from "./../system/pooling.js";
|
|
|
9
9
|
*/
|
|
10
10
|
class ObservableVector3d extends Vector3d {
|
|
11
11
|
/**
|
|
12
|
-
* @param {number} x x value of the vector
|
|
13
|
-
* @param {number} y y value of the vector
|
|
14
|
-
* @param {number} z z value of the vector
|
|
15
|
-
* @param {object} settings additional required parameters
|
|
16
|
-
* @param {Function} settings.onUpdate the callback to be executed when the vector is changed
|
|
17
|
-
* @param {object} [settings.scope] the value to use as this when calling onUpdate
|
|
12
|
+
* @param {number} x - x value of the vector
|
|
13
|
+
* @param {number} y - y value of the vector
|
|
14
|
+
* @param {number} z - z value of the vector
|
|
15
|
+
* @param {object} settings - additional required parameters
|
|
16
|
+
* @param {Function} settings.onUpdate - the callback to be executed when the vector is changed
|
|
17
|
+
* @param {object} [settings.scope] - the value to use as this when calling onUpdate
|
|
18
18
|
*/
|
|
19
19
|
constructor(x = 0, y = 0, z = 0, settings) {
|
|
20
20
|
super(x, y, z);
|
|
@@ -124,9 +124,9 @@ class ObservableVector3d extends Vector3d {
|
|
|
124
124
|
* set the vector value without triggering the callback
|
|
125
125
|
* @name setMuted
|
|
126
126
|
* @memberof ObservableVector3d
|
|
127
|
-
* @param {number} x x value of the vector
|
|
128
|
-
* @param {number} y y value of the vector
|
|
129
|
-
* @param {number} [z=0] z value of the vector
|
|
127
|
+
* @param {number} x - x value of the vector
|
|
128
|
+
* @param {number} y - y value of the vector
|
|
129
|
+
* @param {number} [z=0] - z value of the vector
|
|
130
130
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
131
131
|
*/
|
|
132
132
|
setMuted(x, y, z) {
|
|
@@ -140,8 +140,8 @@ class ObservableVector3d extends Vector3d {
|
|
|
140
140
|
* set the callback to be executed when the vector is changed
|
|
141
141
|
* @name setCallback
|
|
142
142
|
* @memberof ObservableVector3d
|
|
143
|
-
* @param {Function} fn callback
|
|
144
|
-
* @param {Function} [scope=null] scope
|
|
143
|
+
* @param {Function} fn - callback
|
|
144
|
+
* @param {Function} [scope=null] - scope
|
|
145
145
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
146
146
|
*/
|
|
147
147
|
setCallback(fn, scope = null) {
|
|
@@ -206,7 +206,7 @@ class ObservableVector3d extends Vector3d {
|
|
|
206
206
|
* Divide this vector values by the passed value
|
|
207
207
|
* @name div
|
|
208
208
|
* @memberof ObservableVector3d
|
|
209
|
-
* @param {number} n the value to divide the vector by
|
|
209
|
+
* @param {number} n - the value to divide the vector by
|
|
210
210
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
211
211
|
*/
|
|
212
212
|
div(n) {
|
|
@@ -404,8 +404,8 @@ class ObservableVector3d extends Vector3d {
|
|
|
404
404
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians).
|
|
405
405
|
* @name rotate
|
|
406
406
|
* @memberof ObservableVector3d
|
|
407
|
-
* @param {number} angle The angle to rotate (in radians)
|
|
408
|
-
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around (on the same z axis)
|
|
407
|
+
* @param {number} angle - The angle to rotate (in radians)
|
|
408
|
+
* @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around (on the same z axis)
|
|
409
409
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
410
410
|
*/
|
|
411
411
|
rotate(angle, v) {
|
|
@@ -461,7 +461,7 @@ class ObservableVector3d extends Vector3d {
|
|
|
461
461
|
* @name lerp
|
|
462
462
|
* @memberof ObservableVector3d
|
|
463
463
|
* @param {Vector3d|ObservableVector3d} v
|
|
464
|
-
* @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
464
|
+
* @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
465
465
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
466
466
|
*/
|
|
467
467
|
lerp(v, alpha) {
|
|
@@ -477,7 +477,7 @@ class ObservableVector3d extends Vector3d {
|
|
|
477
477
|
* @name moveTowards
|
|
478
478
|
* @memberof ObservableVector3d
|
|
479
479
|
* @param {Vector2d|ObservableVector2d|Vector3d|ObservableVector3d} target
|
|
480
|
-
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
480
|
+
* @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
|
|
481
481
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
482
482
|
*/
|
|
483
483
|
moveTowards(target, step) {
|
package/src/math/vector2.js
CHANGED
|
@@ -7,8 +7,8 @@ import pool from "./../system/pooling.js";
|
|
|
7
7
|
*/
|
|
8
8
|
class Vector2d {
|
|
9
9
|
/**
|
|
10
|
-
* @param {number} [x=0] x value of the vector
|
|
11
|
-
* @param {number} [y=0] y value of the vector
|
|
10
|
+
* @param {number} [x=0] - x value of the vector
|
|
11
|
+
* @param {number} [y=0] - y value of the vector
|
|
12
12
|
*/
|
|
13
13
|
constructor(x = 0, y = 0) {
|
|
14
14
|
this.onResetEvent(x, y);
|
|
@@ -159,7 +159,7 @@ class Vector2d {
|
|
|
159
159
|
* Divide this vector values by the passed value
|
|
160
160
|
* @name div
|
|
161
161
|
* @memberof Vector2d
|
|
162
|
-
* @param {number} n the value to divide the vector by
|
|
162
|
+
* @param {number} n - the value to divide the vector by
|
|
163
163
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
164
164
|
*/
|
|
165
165
|
div(n) {
|
|
@@ -348,8 +348,8 @@ class Vector2d {
|
|
|
348
348
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians).
|
|
349
349
|
* @name rotate
|
|
350
350
|
* @memberof Vector2d
|
|
351
|
-
* @param {number} angle The angle to rotate (in radians)
|
|
352
|
-
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
351
|
+
* @param {number} angle - The angle to rotate (in radians)
|
|
352
|
+
* @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around
|
|
353
353
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
354
354
|
*/
|
|
355
355
|
rotate(angle, v) {
|
|
@@ -417,7 +417,7 @@ class Vector2d {
|
|
|
417
417
|
* @name lerp
|
|
418
418
|
* @memberof Vector2d
|
|
419
419
|
* @param {Vector2d} v
|
|
420
|
-
* @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
420
|
+
* @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
421
421
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
422
422
|
*/
|
|
423
423
|
lerp(v, alpha) {
|
|
@@ -431,7 +431,7 @@ class Vector2d {
|
|
|
431
431
|
* @name moveTowards
|
|
432
432
|
* @memberof Vector2d
|
|
433
433
|
* @param {Vector2d} target
|
|
434
|
-
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
434
|
+
* @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
|
|
435
435
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
436
436
|
*/
|
|
437
437
|
moveTowards(target, step) {
|
|
@@ -476,7 +476,7 @@ class Vector2d {
|
|
|
476
476
|
* project this vector on to another vector.
|
|
477
477
|
* @name project
|
|
478
478
|
* @memberof Vector2d
|
|
479
|
-
* @param {Vector2d} v The vector to project onto.
|
|
479
|
+
* @param {Vector2d} v - The vector to project onto.
|
|
480
480
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
481
481
|
*/
|
|
482
482
|
project(v) {
|
|
@@ -488,7 +488,7 @@ class Vector2d {
|
|
|
488
488
|
* This is slightly more efficient than `project` when dealing with unit vectors.
|
|
489
489
|
* @name projectN
|
|
490
490
|
* @memberof Vector2d
|
|
491
|
-
* @param {Vector2d} v The unit vector to project onto.
|
|
491
|
+
* @param {Vector2d} v - The unit vector to project onto.
|
|
492
492
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
493
493
|
*/
|
|
494
494
|
projectN(v) {
|
package/src/math/vector3.js
CHANGED
|
@@ -7,9 +7,9 @@ import pool from "./../system/pooling.js";
|
|
|
7
7
|
*/
|
|
8
8
|
class Vector3d {
|
|
9
9
|
/**
|
|
10
|
-
* @param {number} [x=0] x value of the vector
|
|
11
|
-
* @param {number} [y=0] y value of the vector
|
|
12
|
-
* @param {number} [z=0] z value of the vector
|
|
10
|
+
* @param {number} [x=0] - x value of the vector
|
|
11
|
+
* @param {number} [y=0] - y value of the vector
|
|
12
|
+
* @param {number} [z=0] - z value of the vector
|
|
13
13
|
*/
|
|
14
14
|
constructor(x = 0, y = 0, z = 0) {
|
|
15
15
|
this.onResetEvent(x, y, z);
|
|
@@ -174,7 +174,7 @@ class Vector3d {
|
|
|
174
174
|
* Divide this vector values by the passed value
|
|
175
175
|
* @name div
|
|
176
176
|
* @memberof Vector3d
|
|
177
|
-
* @param {number} n the value to divide the vector by
|
|
177
|
+
* @param {number} n - the value to divide the vector by
|
|
178
178
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
179
179
|
*/
|
|
180
180
|
div(n) {
|
|
@@ -373,8 +373,8 @@ class Vector3d {
|
|
|
373
373
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
|
|
374
374
|
* @name rotate
|
|
375
375
|
* @memberof Vector3d
|
|
376
|
-
* @param {number} angle The angle to rotate (in radians)
|
|
377
|
-
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around (on the same z axis)
|
|
376
|
+
* @param {number} angle - The angle to rotate (in radians)
|
|
377
|
+
* @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around (on the same z axis)
|
|
378
378
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
379
379
|
*/
|
|
380
380
|
rotate(angle, v) {
|
|
@@ -450,7 +450,7 @@ class Vector3d {
|
|
|
450
450
|
* @name lerp
|
|
451
451
|
* @memberof Vector3d
|
|
452
452
|
* @param {Vector3d} v
|
|
453
|
-
* @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
453
|
+
* @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
454
454
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
455
455
|
*/
|
|
456
456
|
lerp(v, alpha) {
|
|
@@ -465,7 +465,7 @@ class Vector3d {
|
|
|
465
465
|
* @name moveTowards
|
|
466
466
|
* @memberof Vector3d
|
|
467
467
|
* @param {Vector2d|Vector3d} target
|
|
468
|
-
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
468
|
+
* @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
|
|
469
469
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
470
470
|
*/
|
|
471
471
|
moveTowards(target, step) {
|
|
@@ -515,7 +515,7 @@ class Vector3d {
|
|
|
515
515
|
* project this vector on to another vector.
|
|
516
516
|
* @name project
|
|
517
517
|
* @memberof Vector3d
|
|
518
|
-
* @param {Vector2d|Vector3d} v The vector to project onto.
|
|
518
|
+
* @param {Vector2d|Vector3d} v - The vector to project onto.
|
|
519
519
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
520
520
|
*/
|
|
521
521
|
project(v) {
|
|
@@ -528,7 +528,7 @@ class Vector3d {
|
|
|
528
528
|
* This is slightly more efficient than `project` when dealing with unit vectors.
|
|
529
529
|
* @name projectN
|
|
530
530
|
* @memberof Vector3d
|
|
531
|
-
* @param {Vector2d|Vector3d} v The unit vector to project onto.
|
|
531
|
+
* @param {Vector2d|Vector3d} v - The unit vector to project onto.
|
|
532
532
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
533
533
|
*/
|
|
534
534
|
projectN(v) {
|