melonjs 10.3.0 → 10.5.1
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 +6 -6
- package/dist/melonjs.js +3147 -3293
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3411 -3852
- package/dist/melonjs.module.js +3448 -3210
- package/package.json +18 -17
- package/src/audio/audio.js +29 -30
- package/src/camera/camera2d.js +46 -56
- package/src/entity/entity.js +30 -36
- package/src/game.js +21 -22
- package/src/geometries/ellipse.js +40 -46
- package/src/geometries/line.js +9 -11
- package/src/geometries/poly.js +53 -53
- package/src/geometries/rectangle.js +42 -44
- package/src/index.js +9 -26
- package/src/input/gamepad.js +11 -10
- package/src/input/input.js +2 -3
- package/src/input/keyboard.js +113 -113
- package/src/input/pointer.js +30 -31
- package/src/input/pointerevent.js +26 -26
- package/src/lang/deprecated.js +65 -6
- package/src/level/level.js +23 -24
- package/src/level/tiled/TMXGroup.js +7 -8
- package/src/level/tiled/TMXLayer.js +30 -32
- package/src/level/tiled/TMXObject.js +21 -21
- package/src/level/tiled/TMXTile.js +18 -18
- package/src/level/tiled/TMXTileMap.js +39 -44
- package/src/level/tiled/TMXTileset.js +12 -15
- package/src/level/tiled/TMXTilesetGroup.js +9 -9
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +7 -8
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +4 -5
- package/src/level/tiled/renderer/TMXRenderer.js +24 -25
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -4
- package/src/loader/loader.js +14 -15
- package/src/loader/loadingscreen.js +2 -4
- package/src/math/color.js +47 -66
- package/src/math/math.js +15 -16
- package/src/math/matrix2.js +53 -58
- package/src/math/matrix3.js +56 -62
- package/src/math/observable_vector2.js +75 -76
- package/src/math/observable_vector3.js +79 -80
- package/src/math/vector2.js +91 -92
- package/src/math/vector3.js +94 -96
- package/src/particles/emitter.js +38 -40
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +46 -143
- package/src/physics/bounds.js +47 -47
- package/src/physics/collision.js +13 -14
- package/src/physics/detector.js +18 -17
- package/src/physics/quadtree.js +17 -19
- package/src/physics/sat.js +26 -26
- package/src/physics/world.js +24 -28
- package/src/plugin/plugin.js +11 -14
- package/src/renderable/GUI.js +41 -46
- package/src/renderable/collectable.js +4 -8
- package/src/renderable/colorlayer.js +6 -10
- package/src/renderable/container.js +87 -72
- package/src/renderable/dragndrop.js +224 -0
- package/src/renderable/imagelayer.js +25 -31
- package/src/renderable/nineslicesprite.js +41 -41
- package/src/renderable/renderable.js +114 -125
- package/src/renderable/sprite.js +62 -68
- package/src/renderable/trigger.js +25 -30
- package/src/state/stage.js +13 -17
- package/src/state/state.js +26 -27
- package/src/system/device.js +74 -75
- package/src/system/event.js +71 -72
- package/src/system/pooling.js +11 -12
- package/src/system/save.js +3 -4
- package/src/system/timer.js +19 -20
- package/src/text/bitmaptext.js +57 -54
- package/src/text/bitmaptextdata.js +10 -10
- package/src/text/glyph.js +3 -0
- package/src/text/text.js +44 -49
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +1 -1
- package/src/tweens/tween.js +43 -44
- package/src/utils/agent.js +3 -4
- package/src/utils/array.js +4 -5
- package/src/utils/file.js +3 -4
- package/src/utils/function.js +4 -5
- package/src/utils/string.js +7 -9
- package/src/utils/utils.js +4 -5
- package/src/video/canvas/canvas_renderer.js +58 -59
- package/src/video/renderer.js +49 -53
- package/src/video/texture.js +98 -111
- package/src/video/texture_cache.js +24 -6
- package/src/video/video.js +16 -17
- package/src/video/webgl/glshader.js +37 -38
- package/src/video/webgl/webgl_compositor.js +31 -32
- package/src/video/webgl/webgl_renderer.js +79 -80
- package/src/entity/draggable.js +0 -130
- package/src/entity/droptarget.js +0 -101
|
@@ -5,17 +5,16 @@ import {clamp} from "./math.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @classdesc
|
|
7
7
|
* A Vector2d object that provide notification by executing the given callback when the vector is changed.
|
|
8
|
-
* @
|
|
9
|
-
* @augments me.Vector2d
|
|
10
|
-
* @memberof me
|
|
11
|
-
* @param {number} [x=0] x value of the vector
|
|
12
|
-
* @param {number} [y=0] y value of the vector
|
|
13
|
-
* @param {object} settings additional required parameters
|
|
14
|
-
* @param {Function} settings.onUpdate the callback to be executed when the vector is changed
|
|
15
|
-
* @param {Function} [settings.scope] the value to use as this when calling onUpdate
|
|
8
|
+
* @augments Vector2d
|
|
16
9
|
*/
|
|
17
10
|
class ObservableVector2d extends Vector2d {
|
|
18
|
-
|
|
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
|
|
17
|
+
*/
|
|
19
18
|
constructor(x = 0, y = 0, settings) {
|
|
20
19
|
super(x, y);
|
|
21
20
|
if (typeof(settings) === "undefined") {
|
|
@@ -43,7 +42,7 @@ class ObservableVector2d extends Vector2d {
|
|
|
43
42
|
* @public
|
|
44
43
|
* @type {number}
|
|
45
44
|
* @name x
|
|
46
|
-
* @memberof
|
|
45
|
+
* @memberof ObservableVector2d
|
|
47
46
|
*/
|
|
48
47
|
|
|
49
48
|
get x() {
|
|
@@ -65,7 +64,7 @@ class ObservableVector2d extends Vector2d {
|
|
|
65
64
|
* @public
|
|
66
65
|
* @type {number}
|
|
67
66
|
* @name y
|
|
68
|
-
* @memberof
|
|
67
|
+
* @memberof ObservableVector2d
|
|
69
68
|
*/
|
|
70
69
|
|
|
71
70
|
get y() {
|
|
@@ -97,11 +96,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
97
96
|
/**
|
|
98
97
|
* set the vector value without triggering the callback
|
|
99
98
|
* @name setMuted
|
|
100
|
-
* @memberof
|
|
99
|
+
* @memberof ObservableVector2d
|
|
101
100
|
* @function
|
|
102
101
|
* @param {number} x x value of the vector
|
|
103
102
|
* @param {number} y y value of the vector
|
|
104
|
-
* @returns {
|
|
103
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
105
104
|
*/
|
|
106
105
|
setMuted(x, y) {
|
|
107
106
|
this._x = x;
|
|
@@ -112,11 +111,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
112
111
|
/**
|
|
113
112
|
* set the callback to be executed when the vector is changed
|
|
114
113
|
* @name setCallback
|
|
115
|
-
* @memberof
|
|
114
|
+
* @memberof ObservableVector2d
|
|
116
115
|
* @function
|
|
117
116
|
* @param {Function} fn callback
|
|
118
117
|
* @param {Function} [scope=null] scope
|
|
119
|
-
* @returns {
|
|
118
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
120
119
|
*/
|
|
121
120
|
setCallback(fn, scope = null) {
|
|
122
121
|
if (typeof(fn) !== "function") {
|
|
@@ -132,10 +131,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
132
131
|
/**
|
|
133
132
|
* Add the passed vector to this vector
|
|
134
133
|
* @name add
|
|
135
|
-
* @memberof
|
|
134
|
+
* @memberof ObservableVector2d
|
|
136
135
|
* @function
|
|
137
|
-
* @param {
|
|
138
|
-
* @returns {
|
|
136
|
+
* @param {ObservableVector2d} v
|
|
137
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
139
138
|
*/
|
|
140
139
|
add(v) {
|
|
141
140
|
return this._set(this._x + v.x, this._y + v.y);
|
|
@@ -144,10 +143,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
144
143
|
/**
|
|
145
144
|
* Substract the passed vector to this vector
|
|
146
145
|
* @name sub
|
|
147
|
-
* @memberof
|
|
146
|
+
* @memberof ObservableVector2d
|
|
148
147
|
* @function
|
|
149
|
-
* @param {
|
|
150
|
-
* @returns {
|
|
148
|
+
* @param {ObservableVector2d} v
|
|
149
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
151
150
|
*/
|
|
152
151
|
sub(v) {
|
|
153
152
|
return this._set(this._x - v.x, this._y - v.y);
|
|
@@ -156,11 +155,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
156
155
|
/**
|
|
157
156
|
* Multiply this vector values by the given scalar
|
|
158
157
|
* @name scale
|
|
159
|
-
* @memberof
|
|
158
|
+
* @memberof ObservableVector2d
|
|
160
159
|
* @function
|
|
161
160
|
* @param {number} x
|
|
162
161
|
* @param {number} [y=x]
|
|
163
|
-
* @returns {
|
|
162
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
164
163
|
*/
|
|
165
164
|
scale(x, y) {
|
|
166
165
|
return this._set(this._x * x, this._y * (typeof (y) !== "undefined" ? y : x));
|
|
@@ -169,10 +168,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
169
168
|
/**
|
|
170
169
|
* Multiply this vector values by the passed vector
|
|
171
170
|
* @name scaleV
|
|
172
|
-
* @memberof
|
|
171
|
+
* @memberof ObservableVector2d
|
|
173
172
|
* @function
|
|
174
|
-
* @param {
|
|
175
|
-
* @returns {
|
|
173
|
+
* @param {ObservableVector2d} v
|
|
174
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
176
175
|
*/
|
|
177
176
|
scaleV(v) {
|
|
178
177
|
return this._set(this._x * v.x, this._y * v.y);
|
|
@@ -181,10 +180,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
181
180
|
/**
|
|
182
181
|
* Divide this vector values by the passed value
|
|
183
182
|
* @name div
|
|
184
|
-
* @memberof
|
|
183
|
+
* @memberof ObservableVector2d
|
|
185
184
|
* @function
|
|
186
185
|
* @param {number} n the value to divide the vector by
|
|
187
|
-
* @returns {
|
|
186
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
188
187
|
*/
|
|
189
188
|
div(n) {
|
|
190
189
|
return this._set(this._x / n, this._y / n);
|
|
@@ -193,9 +192,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
193
192
|
/**
|
|
194
193
|
* Update this vector values to absolute values
|
|
195
194
|
* @name abs
|
|
196
|
-
* @memberof
|
|
195
|
+
* @memberof ObservableVector2d
|
|
197
196
|
* @function
|
|
198
|
-
* @returns {
|
|
197
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
199
198
|
*/
|
|
200
199
|
abs() {
|
|
201
200
|
return this._set((this._x < 0) ? -this._x : this._x, (this._y < 0) ? -this._y : this._y);
|
|
@@ -204,11 +203,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
204
203
|
/**
|
|
205
204
|
* Clamp the vector value within the specified value range
|
|
206
205
|
* @name clamp
|
|
207
|
-
* @memberof
|
|
206
|
+
* @memberof ObservableVector2d
|
|
208
207
|
* @function
|
|
209
208
|
* @param {number} low
|
|
210
209
|
* @param {number} high
|
|
211
|
-
* @returns {
|
|
210
|
+
* @returns {ObservableVector2d} new me.ObservableVector2d
|
|
212
211
|
*/
|
|
213
212
|
clamp(low, high) {
|
|
214
213
|
return new ObservableVector2d(clamp(this.x, low, high), clamp(this.y, low, high), {onUpdate: this.onUpdate, scope: this.scope});
|
|
@@ -217,11 +216,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
217
216
|
/**
|
|
218
217
|
* Clamp this vector value within the specified value range
|
|
219
218
|
* @name clampSelf
|
|
220
|
-
* @memberof
|
|
219
|
+
* @memberof ObservableVector2d
|
|
221
220
|
* @function
|
|
222
221
|
* @param {number} low
|
|
223
222
|
* @param {number} high
|
|
224
|
-
* @returns {
|
|
223
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
225
224
|
*/
|
|
226
225
|
clampSelf(low, high) {
|
|
227
226
|
return this._set(clamp(this._x, low, high), clamp(this._y, low, high));
|
|
@@ -230,10 +229,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
230
229
|
/**
|
|
231
230
|
* Update this vector with the minimum value between this and the passed vector
|
|
232
231
|
* @name minV
|
|
233
|
-
* @memberof
|
|
232
|
+
* @memberof ObservableVector2d
|
|
234
233
|
* @function
|
|
235
|
-
* @param {
|
|
236
|
-
* @returns {
|
|
234
|
+
* @param {ObservableVector2d} v
|
|
235
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
237
236
|
*/
|
|
238
237
|
minV(v) {
|
|
239
238
|
return this._set((this._x < v.x) ? this._x : v.x, (this._y < v.y) ? this._y : v.y);
|
|
@@ -242,10 +241,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
242
241
|
/**
|
|
243
242
|
* Update this vector with the maximum value between this and the passed vector
|
|
244
243
|
* @name maxV
|
|
245
|
-
* @memberof
|
|
244
|
+
* @memberof ObservableVector2d
|
|
246
245
|
* @function
|
|
247
|
-
* @param {
|
|
248
|
-
* @returns {
|
|
246
|
+
* @param {ObservableVector2d} v
|
|
247
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
249
248
|
*/
|
|
250
249
|
maxV(v) {
|
|
251
250
|
return this._set((this._x > v.x) ? this._x : v.x, (this._y > v.y) ? this._y : v.y);
|
|
@@ -254,9 +253,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
254
253
|
/**
|
|
255
254
|
* Floor the vector values
|
|
256
255
|
* @name floor
|
|
257
|
-
* @memberof
|
|
256
|
+
* @memberof ObservableVector2d
|
|
258
257
|
* @function
|
|
259
|
-
* @returns {
|
|
258
|
+
* @returns {ObservableVector2d} new me.ObservableVector2d
|
|
260
259
|
*/
|
|
261
260
|
floor() {
|
|
262
261
|
return new ObservableVector2d(Math.floor(this._x), Math.floor(this._y), {onUpdate: this.onUpdate, scope: this.scope});
|
|
@@ -265,9 +264,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
265
264
|
/**
|
|
266
265
|
* Floor this vector values
|
|
267
266
|
* @name floorSelf
|
|
268
|
-
* @memberof
|
|
267
|
+
* @memberof ObservableVector2d
|
|
269
268
|
* @function
|
|
270
|
-
* @returns {
|
|
269
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
271
270
|
*/
|
|
272
271
|
floorSelf() {
|
|
273
272
|
return this._set(Math.floor(this._x), Math.floor(this._y));
|
|
@@ -276,9 +275,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
276
275
|
/**
|
|
277
276
|
* Ceil the vector values
|
|
278
277
|
* @name ceil
|
|
279
|
-
* @memberof
|
|
278
|
+
* @memberof ObservableVector2d
|
|
280
279
|
* @function
|
|
281
|
-
* @returns {
|
|
280
|
+
* @returns {ObservableVector2d} new me.ObservableVector2d
|
|
282
281
|
*/
|
|
283
282
|
ceil() {
|
|
284
283
|
return new ObservableVector2d(Math.ceil(this._x), Math.ceil(this._y), {onUpdate: this.onUpdate, scope: this.scope});
|
|
@@ -287,9 +286,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
287
286
|
/**
|
|
288
287
|
* Ceil this vector values
|
|
289
288
|
* @name ceilSelf
|
|
290
|
-
* @memberof
|
|
289
|
+
* @memberof ObservableVector2d
|
|
291
290
|
* @function
|
|
292
|
-
* @returns {
|
|
291
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
293
292
|
*/
|
|
294
293
|
ceilSelf() {
|
|
295
294
|
return this._set(Math.ceil(this._x), Math.ceil(this._y));
|
|
@@ -298,9 +297,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
298
297
|
/**
|
|
299
298
|
* Negate the vector values
|
|
300
299
|
* @name negate
|
|
301
|
-
* @memberof
|
|
300
|
+
* @memberof ObservableVector2d
|
|
302
301
|
* @function
|
|
303
|
-
* @returns {
|
|
302
|
+
* @returns {ObservableVector2d} new me.ObservableVector2d
|
|
304
303
|
*/
|
|
305
304
|
negate() {
|
|
306
305
|
return new ObservableVector2d(-this._x, -this._y, {onUpdate: this.onUpdate, scope: this.scope});
|
|
@@ -309,9 +308,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
309
308
|
/**
|
|
310
309
|
* Negate this vector values
|
|
311
310
|
* @name negateSelf
|
|
312
|
-
* @memberof
|
|
311
|
+
* @memberof ObservableVector2d
|
|
313
312
|
* @function
|
|
314
|
-
* @returns {
|
|
313
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
315
314
|
*/
|
|
316
315
|
negateSelf() {
|
|
317
316
|
return this._set(-this._x, -this._y);
|
|
@@ -320,10 +319,10 @@ class ObservableVector2d extends Vector2d {
|
|
|
320
319
|
/**
|
|
321
320
|
* Copy the x,y values of the passed vector to this one
|
|
322
321
|
* @name copy
|
|
323
|
-
* @memberof
|
|
322
|
+
* @memberof ObservableVector2d
|
|
324
323
|
* @function
|
|
325
|
-
* @param {
|
|
326
|
-
* @returns {
|
|
324
|
+
* @param {ObservableVector2d} v
|
|
325
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
327
326
|
*/
|
|
328
327
|
copy(v) {
|
|
329
328
|
return this._set(v.x, v.y);
|
|
@@ -332,9 +331,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
332
331
|
/**
|
|
333
332
|
* return true if the two vectors are the same
|
|
334
333
|
* @name equals
|
|
335
|
-
* @memberof
|
|
334
|
+
* @memberof ObservableVector2d
|
|
336
335
|
* @function
|
|
337
|
-
* @param {
|
|
336
|
+
* @param {ObservableVector2d} v
|
|
338
337
|
* @returns {boolean}
|
|
339
338
|
*/
|
|
340
339
|
equals(v) {
|
|
@@ -345,9 +344,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
345
344
|
* change this vector to be perpendicular to what it was before.<br>
|
|
346
345
|
* (Effectively rotates it 90 degrees in a clockwise direction)
|
|
347
346
|
* @name perp
|
|
348
|
-
* @memberof
|
|
347
|
+
* @memberof ObservableVector2d
|
|
349
348
|
* @function
|
|
350
|
-
* @returns {
|
|
349
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
351
350
|
*/
|
|
352
351
|
perp() {
|
|
353
352
|
return this._set(this._y, -this._x);
|
|
@@ -356,11 +355,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
356
355
|
/**
|
|
357
356
|
* Rotate this vector (counter-clockwise) by the specified angle (in radians).
|
|
358
357
|
* @name rotate
|
|
359
|
-
* @memberof
|
|
358
|
+
* @memberof ObservableVector2d
|
|
360
359
|
* @function
|
|
361
360
|
* @param {number} angle The angle to rotate (in radians)
|
|
362
|
-
* @param {
|
|
363
|
-
* @returns {
|
|
361
|
+
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
362
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
364
363
|
*/
|
|
365
364
|
rotate(angle, v) {
|
|
366
365
|
var cx = 0;
|
|
@@ -383,9 +382,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
383
382
|
/**
|
|
384
383
|
* return the dot product of this vector and the passed one
|
|
385
384
|
* @name dot
|
|
386
|
-
* @memberof
|
|
385
|
+
* @memberof ObservableVector2d
|
|
387
386
|
* @function
|
|
388
|
-
* @param {
|
|
387
|
+
* @param {Vector2d|ObservableVector2d} v
|
|
389
388
|
* @returns {number} The dot product.
|
|
390
389
|
*/
|
|
391
390
|
dot(v) {
|
|
@@ -395,9 +394,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
395
394
|
/**
|
|
396
395
|
* return the cross product of this vector and the passed one
|
|
397
396
|
* @name cross
|
|
398
|
-
* @memberof
|
|
397
|
+
* @memberof ObservableVector2d
|
|
399
398
|
* @function
|
|
400
|
-
* @param {
|
|
399
|
+
* @param {Vector2d|ObservableVector2d} v
|
|
401
400
|
* @returns {number} The cross product.
|
|
402
401
|
*/
|
|
403
402
|
cross(v) {
|
|
@@ -407,11 +406,11 @@ class ObservableVector2d extends Vector2d {
|
|
|
407
406
|
/**
|
|
408
407
|
* Linearly interpolate between this vector and the given one.
|
|
409
408
|
* @name lerp
|
|
410
|
-
* @memberof
|
|
409
|
+
* @memberof ObservableVector2d
|
|
411
410
|
* @function
|
|
412
|
-
* @param {
|
|
411
|
+
* @param {Vector2d|ObservableVector2d} v
|
|
413
412
|
* @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
|
|
414
|
-
* @returns {
|
|
413
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
415
414
|
*/
|
|
416
415
|
lerp(v, alpha) {
|
|
417
416
|
this._x += ( v.x - this._x ) * alpha;
|
|
@@ -422,9 +421,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
422
421
|
/**
|
|
423
422
|
* return the distance between this vector and the passed one
|
|
424
423
|
* @name distance
|
|
425
|
-
* @memberof
|
|
424
|
+
* @memberof ObservableVector2d
|
|
426
425
|
* @function
|
|
427
|
-
* @param {
|
|
426
|
+
* @param {ObservableVector2d} v
|
|
428
427
|
* @returns {number}
|
|
429
428
|
*/
|
|
430
429
|
distance(v) {
|
|
@@ -434,9 +433,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
434
433
|
/**
|
|
435
434
|
* return a clone copy of this vector
|
|
436
435
|
* @name clone
|
|
437
|
-
* @memberof
|
|
436
|
+
* @memberof ObservableVector2d
|
|
438
437
|
* @function
|
|
439
|
-
* @returns {
|
|
438
|
+
* @returns {ObservableVector2d} new me.ObservableVector2d
|
|
440
439
|
*/
|
|
441
440
|
clone() {
|
|
442
441
|
return pool.pull("ObservableVector2d", this._x, this._y, {onUpdate: this.onUpdate, scope: this.scope});
|
|
@@ -445,9 +444,9 @@ class ObservableVector2d extends Vector2d {
|
|
|
445
444
|
/**
|
|
446
445
|
* return a `me.Vector2d` copy of this `me.ObservableVector2d` object
|
|
447
446
|
* @name toVector2d
|
|
448
|
-
* @memberof
|
|
447
|
+
* @memberof ObservableVector2d
|
|
449
448
|
* @function
|
|
450
|
-
* @returns {
|
|
449
|
+
* @returns {Vector2d} new me.Vector2d
|
|
451
450
|
*/
|
|
452
451
|
toVector2d() {
|
|
453
452
|
return pool.pull("Vector2d", this._x, this._y);
|
|
@@ -456,7 +455,7 @@ class ObservableVector2d extends Vector2d {
|
|
|
456
455
|
/**
|
|
457
456
|
* convert the object to a string representation
|
|
458
457
|
* @name toString
|
|
459
|
-
* @memberof
|
|
458
|
+
* @memberof ObservableVector2d
|
|
460
459
|
* @function
|
|
461
460
|
* @returns {string}
|
|
462
461
|
*/
|