melonjs 10.2.0 → 10.3.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.
Files changed (95) hide show
  1. package/README.md +1 -1
  2. package/dist/melonjs.js +4435 -4283
  3. package/dist/melonjs.min.js +4 -4
  4. package/dist/melonjs.module.d.ts +3348 -3833
  5. package/dist/melonjs.module.js +4025 -3920
  6. package/package.json +13 -14
  7. package/src/audio/audio.js +45 -45
  8. package/src/camera/camera2d.js +78 -101
  9. package/src/entity/draggable.js +21 -29
  10. package/src/entity/droptarget.js +24 -31
  11. package/src/entity/entity.js +34 -38
  12. package/src/game.js +8 -8
  13. package/src/{shapes → geometries}/ellipse.js +46 -46
  14. package/src/{shapes → geometries}/line.js +14 -14
  15. package/src/{shapes → geometries}/poly.js +103 -54
  16. package/src/{shapes → geometries}/rectangle.js +73 -120
  17. package/src/index.js +18 -19
  18. package/src/input/gamepad.js +20 -20
  19. package/src/input/input.js +3 -3
  20. package/src/input/keyboard.js +122 -124
  21. package/src/input/pointer.js +102 -62
  22. package/src/input/pointerevent.js +97 -42
  23. package/src/lang/deprecated.js +29 -18
  24. package/src/level/level.js +34 -26
  25. package/src/level/tiled/TMXGroup.js +12 -13
  26. package/src/level/tiled/TMXLayer.js +41 -42
  27. package/src/level/tiled/TMXObject.js +76 -70
  28. package/src/level/tiled/TMXTile.js +13 -15
  29. package/src/level/tiled/TMXTileMap.js +26 -25
  30. package/src/level/tiled/TMXTileset.js +14 -15
  31. package/src/level/tiled/TMXTilesetGroup.js +5 -6
  32. package/src/level/tiled/TMXUtils.js +13 -11
  33. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
  34. package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
  35. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
  36. package/src/level/tiled/renderer/TMXRenderer.js +18 -19
  37. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
  38. package/src/loader/loader.js +46 -40
  39. package/src/loader/loadingscreen.js +7 -7
  40. package/src/math/color.js +68 -88
  41. package/src/math/math.js +33 -33
  42. package/src/math/matrix2.js +70 -71
  43. package/src/math/matrix3.js +90 -91
  44. package/src/math/observable_vector2.js +91 -92
  45. package/src/math/observable_vector3.js +110 -106
  46. package/src/math/vector2.js +116 -104
  47. package/src/math/vector3.js +129 -110
  48. package/src/particles/emitter.js +116 -126
  49. package/src/particles/particle.js +4 -5
  50. package/src/particles/particlecontainer.js +2 -3
  51. package/src/physics/body.js +82 -83
  52. package/src/physics/bounds.js +64 -66
  53. package/src/physics/collision.js +21 -22
  54. package/src/physics/detector.js +13 -13
  55. package/src/physics/quadtree.js +26 -25
  56. package/src/physics/sat.js +21 -21
  57. package/src/physics/world.js +23 -22
  58. package/src/plugin/plugin.js +12 -13
  59. package/src/renderable/GUI.js +20 -26
  60. package/src/renderable/collectable.js +6 -7
  61. package/src/renderable/colorlayer.js +11 -12
  62. package/src/renderable/container.js +98 -81
  63. package/src/renderable/imagelayer.js +33 -35
  64. package/src/renderable/nineslicesprite.js +15 -16
  65. package/src/renderable/renderable.js +112 -111
  66. package/src/renderable/sprite.js +71 -58
  67. package/src/renderable/trigger.js +17 -19
  68. package/src/state/stage.js +14 -15
  69. package/src/state/state.js +78 -78
  70. package/src/system/device.js +137 -180
  71. package/src/system/event.js +116 -104
  72. package/src/system/pooling.js +15 -15
  73. package/src/system/save.js +9 -6
  74. package/src/system/timer.js +33 -33
  75. package/src/text/bitmaptext.js +39 -46
  76. package/src/text/bitmaptextdata.js +14 -15
  77. package/src/text/text.js +55 -58
  78. package/src/tweens/easing.js +5 -5
  79. package/src/tweens/interpolation.js +5 -5
  80. package/src/tweens/tween.js +49 -40
  81. package/src/utils/agent.js +12 -11
  82. package/src/utils/array.js +8 -8
  83. package/src/utils/file.js +7 -7
  84. package/src/utils/function.js +8 -8
  85. package/src/utils/string.js +19 -19
  86. package/src/utils/utils.js +23 -23
  87. package/src/video/canvas/canvas_renderer.js +127 -128
  88. package/src/video/renderer.js +69 -69
  89. package/src/video/texture.js +80 -82
  90. package/src/video/texture_cache.js +2 -4
  91. package/src/video/video.js +38 -38
  92. package/src/video/webgl/buffer/vertex.js +11 -3
  93. package/src/video/webgl/glshader.js +31 -32
  94. package/src/video/webgl/webgl_compositor.js +145 -127
  95. package/src/video/webgl/webgl_renderer.js +196 -175
package/src/text/text.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import Color from "./../math/color.js";
2
- import Renderer from "./../video/renderer.js";
3
2
  import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
4
3
  import { renderer, createCanvas } from "./../video/video.js";
5
4
  import * as stringUtil from "./../utils/string.js";
@@ -39,23 +38,22 @@ var setContextStyle = function(context, font, stroke = false) {
39
38
  * @classdesc
40
39
  * a generic system font object.
41
40
  * @class Text
42
- * @extends me.Renderable
43
- * @memberOf me
44
- * @constructor
45
- * @param {Number} x position of the text object
46
- * @param {Number} y position of the text object
47
- * @param {Object} settings the text configuration
48
- * @param {String} settings.font a CSS family font name
49
- * @param {Number|String} settings.size size, or size + suffix (px, em, pt)
50
- * @param {me.Color|String} [settings.fillStyle="#000000"] a CSS color value
51
- * @param {me.Color|String} [settings.strokeStyle="#000000"] a CSS color value
52
- * @param {Number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
53
- * @param {String} [settings.textAlign="left"] horizontal text alignment
54
- * @param {String} [settings.textBaseline="top"] the text baseline
55
- * @param {Number} [settings.lineHeight=1.0] line spacing height
41
+ * @augments me.Renderable
42
+ * @memberof me
43
+ * @param {number} x position of the text object
44
+ * @param {number} y position of the text object
45
+ * @param {object} settings the text configuration
46
+ * @param {string} settings.font a CSS family font name
47
+ * @param {number|string} settings.size size, or size + suffix (px, em, pt)
48
+ * @param {me.Color|string} [settings.fillStyle="#000000"] a CSS color value
49
+ * @param {me.Color|string} [settings.strokeStyle="#000000"] a CSS color value
50
+ * @param {number} [settings.lineWidth=1] line width, in pixels, when drawing stroke
51
+ * @param {string} [settings.textAlign="left"] horizontal text alignment
52
+ * @param {string} [settings.textBaseline="top"] the text baseline
53
+ * @param {number} [settings.lineHeight=1.0] line spacing height
56
54
  * @param {me.Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] anchor point to draw the text at
57
- * @param {Boolean} [settings.offScreenCanvas=false] whether to draw the font to an individual "cache" texture first
58
- * @param {(String|String[])} [settings.text=""] a string, or an array of strings
55
+ * @param {boolean} [settings.offScreenCanvas=false] whether to draw the font to an individual "cache" texture first
56
+ * @param {(string|string[])} [settings.text=""] a string, or an array of strings
59
57
  * @example
60
58
  * var font = new me.Text(0, 0, {font: "Arial", size: 8, fillStyle: this.color});
61
59
  */
@@ -74,7 +72,7 @@ class Text extends Renderable {
74
72
  /**
75
73
  * defines the color used to draw the font.<br>
76
74
  * @public
77
- * @type me.Color
75
+ * @type {me.Color}
78
76
  * @default black
79
77
  * @name me.Text#fillStyle
80
78
  */
@@ -92,7 +90,7 @@ class Text extends Renderable {
92
90
  /**
93
91
  * defines the color used to draw the font stroke.<br>
94
92
  * @public
95
- * @type me.Color
93
+ * @type {me.Color}
96
94
  * @default black
97
95
  * @name me.Text#strokeStyle
98
96
  */
@@ -110,7 +108,7 @@ class Text extends Renderable {
110
108
  /**
111
109
  * sets the current line width, in pixels, when drawing stroke
112
110
  * @public
113
- * @type Number
111
+ * @type {number}
114
112
  * @default 1
115
113
  * @name me.Text#lineWidth
116
114
  */
@@ -120,7 +118,7 @@ class Text extends Renderable {
120
118
  * Set the default text alignment (or justification),<br>
121
119
  * possible values are "left", "right", and "center".<br>
122
120
  * @public
123
- * @type String
121
+ * @type {string}
124
122
  * @default "left"
125
123
  * @name me.Text#textAlign
126
124
  */
@@ -130,7 +128,7 @@ class Text extends Renderable {
130
128
  * Set the text baseline (e.g. the Y-coordinate for the draw operation), <br>
131
129
  * possible values are "top", "hanging, "middle, "alphabetic, "ideographic, "bottom"<br>
132
130
  * @public
133
- * @type String
131
+ * @type {string}
134
132
  * @default "top"
135
133
  * @name me.Text#textBaseline
136
134
  */
@@ -140,7 +138,7 @@ class Text extends Renderable {
140
138
  * Set the line spacing height (when displaying multi-line strings). <br>
141
139
  * Current font height will be multiplied with this value to set the line height.
142
140
  * @public
143
- * @type Number
141
+ * @type {number}
144
142
  * @default 1.0
145
143
  * @name me.Text#lineHeight
146
144
  */
@@ -151,7 +149,7 @@ class Text extends Renderable {
151
149
  * Note: this will improve performances when using WebGL, but will impact
152
150
  * memory consumption as every text element will have its own canvas texture
153
151
  * @public
154
- * @type Boolean
152
+ * @type {boolean}
155
153
  * @default false
156
154
  * @name me.Text#offScreenCanvas
157
155
  */
@@ -160,20 +158,20 @@ class Text extends Renderable {
160
158
  /**
161
159
  * the text to be displayed
162
160
  * @private
163
- * @type {String[]}
161
+ * @type {string[]}
164
162
  * @name _text
165
- * @memberOf me.Text
163
+ * @memberof me.Text
166
164
  */
167
165
  this._text = [];
168
166
 
169
167
  /**
170
168
  * the font size (in px)
171
169
  * @public
172
- * @type {Number}
170
+ * @type {number}
173
171
  * @name fontSize
174
172
  * @default 10
175
- * @memberOf me.Text
176
- */
173
+ * @memberof me.Text
174
+ */
177
175
  this.fontSize = 10;
178
176
 
179
177
  // anchor point
@@ -216,22 +214,21 @@ class Text extends Renderable {
216
214
  onDeactivateEvent() {
217
215
  // free the canvas and potential corresponding texture when deactivated
218
216
  if (this.offScreenCanvas === true) {
219
- if (renderer instanceof WebGLRenderer) {
220
- renderer.currentCompositor.unbindTexture2D(renderer.cache.get(this.canvas));
221
- renderer.cache.remove(this.canvas);
222
- }
217
+ renderer.currentCompositor.deleteTexture2D(renderer.currentCompositor.getTexture2D(this.glTextureUnit));
218
+ renderer.cache.delete(this.canvas);
223
219
  this.canvas.width = this.canvas.height = 0;
224
220
  this.context = undefined;
225
221
  this.canvas = undefined;
222
+ this.glTextureUnit = undefined;
226
223
  }
227
224
  }
228
225
 
229
226
  /**
230
227
  * make the font bold
231
228
  * @name bold
232
- * @memberOf me.Text.prototype
229
+ * @memberof me.Text.prototype
233
230
  * @function
234
- * @return this object for chaining
231
+ * @returns {me.Text} this object for chaining
235
232
  */
236
233
  bold() {
237
234
  this.font = "bold " + this.font;
@@ -242,9 +239,9 @@ class Text extends Renderable {
242
239
  /**
243
240
  * make the font italic
244
241
  * @name italic
245
- * @memberOf me.Text.prototype
242
+ * @memberof me.Text.prototype
246
243
  * @function
247
- * @return this object for chaining
244
+ * @returns {me.Text} this object for chaining
248
245
  */
249
246
  italic() {
250
247
  this.font = "italic " + this.font;
@@ -255,11 +252,11 @@ class Text extends Renderable {
255
252
  /**
256
253
  * set the font family and size
257
254
  * @name setFont
258
- * @memberOf me.Text.prototype
255
+ * @memberof me.Text.prototype
259
256
  * @function
260
- * @param {String} font a CSS font name
261
- * @param {Number|String} [size=10] size in px, or size + suffix (px, em, pt)
262
- * @return this object for chaining
257
+ * @param {string} font a CSS font name
258
+ * @param {number|string} [size=10] size in px, or size + suffix (px, em, pt)
259
+ * @returns {me.Text} this object for chaining
263
260
  * @example
264
261
  * font.setFont("Arial", 20);
265
262
  * font.setFont("Arial", "1.5em");
@@ -299,10 +296,10 @@ class Text extends Renderable {
299
296
  /**
300
297
  * change the text to be displayed
301
298
  * @name setText
302
- * @memberOf me.Text.prototype
299
+ * @memberof me.Text.prototype
303
300
  * @function
304
- * @param {Number|String|String[]} value a string, or an array of strings
305
- * @return this object for chaining
301
+ * @param {number|string|string[]} value a string, or an array of strings
302
+ * @returns {me.Text} this object for chaining
306
303
  */
307
304
  setText(value = "") {
308
305
  if (this._text.toString() !== value.toString()) {
@@ -320,14 +317,14 @@ class Text extends Renderable {
320
317
  /**
321
318
  * measure the given text size in pixels
322
319
  * @name measureText
323
- * @memberOf me.Text.prototype
320
+ * @memberof me.Text.prototype
324
321
  * @function
325
322
  * @param {me.CanvasRenderer|me.WebGLRenderer} [renderer] reference to the active renderer
326
- * @param {String} [text] the text to be measured
323
+ * @param {string} [text] the text to be measured
327
324
  * @param {me.Rect|me.Bounds} [ret] a object in which to store the text metrics
328
325
  * @returns {TextMetrics} a TextMetrics object with two properties: `width` and `height`, defining the output dimensions
329
326
  */
330
- measureText(_renderer, text, ret) {
327
+ measureText(renderer, text, ret) {
331
328
  var context;
332
329
  var textMetrics = ret || this.getBounds();
333
330
  var lineHeight = this.fontSize * this.lineHeight;
@@ -335,8 +332,6 @@ class Text extends Renderable {
335
332
 
336
333
  if (this.offScreenCanvas === true) {
337
334
  context = this.context;
338
- } else if (_renderer instanceof Renderer) {
339
- context = _renderer.getFontContext();
340
335
  } else {
341
336
  context = renderer.getFontContext();
342
337
  }
@@ -383,7 +378,8 @@ class Text extends Renderable {
383
378
 
384
379
  if (renderer instanceof WebGLRenderer) {
385
380
  // invalidate the previous corresponding texture so that it can reuploaded once changed
386
- renderer.currentCompositor.unbindTexture2D(renderer.cache.get(this.canvas));
381
+ this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvas));
382
+ renderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
387
383
 
388
384
  if (renderer.WebGLVersion === 1) {
389
385
  // round size to next Pow2
@@ -410,12 +406,13 @@ class Text extends Renderable {
410
406
  /**
411
407
  * draw a text at the specified coord
412
408
  * @name draw
413
- * @memberOf me.Text.prototype
409
+ * @memberof me.Text.prototype
414
410
  * @function
415
411
  * @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
416
- * @param {String} [text]
417
- * @param {Number} [x]
418
- * @param {Number} [y]
412
+ * @param {string} [text]
413
+ * @param {number} [x]
414
+ * @param {number} [y]
415
+ * @param {boolean} [stroke=false] draw stroke the the text if true
419
416
  */
420
417
  draw(renderer, text, x, y, stroke) {
421
418
  // "hacky patch" for backward compatibilty
@@ -475,12 +472,12 @@ class Text extends Renderable {
475
472
  * by the `lineWidth` and `fillStroke` properties. <br>
476
473
  * Note : using drawStroke is not recommended for performance reasons
477
474
  * @name drawStroke
478
- * @memberOf me.Text.prototype
475
+ * @memberof me.Text.prototype
479
476
  * @function
480
477
  * @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
481
- * @param {String} text
482
- * @param {Number} x
483
- * @param {Number} y
478
+ * @param {string} text
479
+ * @param {number} x
480
+ * @param {number} y
484
481
  */
485
482
  drawStroke(renderer, text, x, y) {
486
483
  this.draw(renderer, text, x, y, true);
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Tween.js - Licensed under the MIT license
3
- * https://github.com/tweenjs/tween.js
4
- */
2
+ * Tween.js - Licensed under the MIT license
3
+ * https://github.com/tweenjs/tween.js
4
+ */
5
5
 
6
6
  /* eslint-disable quotes, keyword-spacing, comma-spacing, no-return-assign */
7
7
 
@@ -42,9 +42,9 @@
42
42
  * </p>
43
43
  * @public
44
44
  * @constant
45
- * @type enum
45
+ * @enum {Function}
46
46
  * @name Easing
47
- * @memberOf me.Tween
47
+ * @memberof me.Tween
48
48
  */
49
49
  export let Easing = {
50
50
 
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Tween.js - Licensed under the MIT license
3
- * https://github.com/tweenjs/tween.js
4
- */
2
+ * Tween.js - Licensed under the MIT license
3
+ * https://github.com/tweenjs/tween.js
4
+ */
5
5
 
6
6
  /**
7
7
  * Interpolation Function :<br>
@@ -12,9 +12,9 @@
12
12
  * </p>
13
13
  * @public
14
14
  * @constant
15
- * @type enum
15
+ * @enum {Function}
16
16
  * @name Interpolation
17
- * @memberOf me.Tween
17
+ * @memberof me.Tween
18
18
  */
19
19
  export let Interpolation = {
20
20
  /** @ignore */
@@ -5,9 +5,9 @@ import { Easing } from "./easing.js";
5
5
  import { Interpolation } from "./interpolation.js";
6
6
 
7
7
  /**
8
- * Tween.js - Licensed under the MIT license
9
- * https://github.com/tweenjs/tween.js
10
- */
8
+ * Tween.js - Licensed under the MIT license
9
+ * https://github.com/tweenjs/tween.js
10
+ */
11
11
 
12
12
  /**
13
13
  * @classdesc
@@ -23,9 +23,8 @@ import { Interpolation } from "./interpolation.js";
23
23
  * author lechecacharro<br>
24
24
  * author Josh Faul / http://jocafa.com/
25
25
  * @class Tween
26
- * @memberOf me
27
- * @constructor
28
- * @param {Object} object object on which to apply the tween
26
+ * @memberof me
27
+ * @param {object} object object on which to apply the tween
29
28
  * @example
30
29
  * // add a tween to change the object pos.x and pos.y variable to 200 in 3 seconds
31
30
  * tween = new me.Tween(myObject.pos).to({
@@ -121,18 +120,19 @@ class Tween {
121
120
  /**
122
121
  * object properties to be updated and duration
123
122
  * @name to
124
- * @memberOf me.Tween
123
+ * @memberof me.Tween
125
124
  * @public
126
125
  * @function
127
- * @param {Object} properties hash of properties
128
- * @param {Object|Number} [options] object of tween properties, or a duration if a numeric value is passed
129
- * @param {Number} [options.duration] tween duration
126
+ * @param {object} properties hash of properties
127
+ * @param {object|number} [options] object of tween properties, or a duration if a numeric value is passed
128
+ * @param {number} [options.duration] tween duration
130
129
  * @param {me.Tween.Easing} [options.easing] easing function
131
- * @param {Number} [options.delay] delay amount expressed in milliseconds
132
- * @param {Boolean} [options.yoyo] allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
133
- * @param {Number} [options.repeat] amount of times the tween should be repeated
130
+ * @param {number} [options.delay] delay amount expressed in milliseconds
131
+ * @param {boolean} [options.yoyo] allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
132
+ * @param {number} [options.repeat] amount of times the tween should be repeated
134
133
  * @param {me.Tween.Interpolation} [options.interpolation] interpolation function
135
- * @param {Boolean} [options.autoStart] allow this tween to start automatically. Otherwise call me.Tween.start().
134
+ * @param {boolean} [options.autoStart] allow this tween to start automatically. Otherwise call me.Tween.start().
135
+ * @returns {me.Tween} this instance for object chaining
136
136
  */
137
137
  to( properties, options ) {
138
138
 
@@ -157,15 +157,16 @@ class Tween {
157
157
  }
158
158
 
159
159
  return this;
160
-
161
160
  }
162
161
 
163
162
  /**
164
163
  * start the tween
165
164
  * @name start
166
- * @memberOf me.Tween
165
+ * @memberof me.Tween
167
166
  * @public
168
167
  * @function
168
+ * @param {number} [time] the current time when the tween was started
169
+ * @returns {me.Tween} this instance for object chaining
169
170
  */
170
171
  start( time = timer.getTime() ) {
171
172
 
@@ -203,15 +204,15 @@ class Tween {
203
204
  }
204
205
 
205
206
  return this;
206
-
207
207
  }
208
208
 
209
209
  /**
210
210
  * stop the tween
211
211
  * @name stop
212
- * @memberOf me.Tween
212
+ * @memberof me.Tween
213
213
  * @public
214
214
  * @function
215
+ * @returns {me.Tween} this instance for object chaining
215
216
  */
216
217
  stop() {
217
218
  // remove the tween from the world container
@@ -222,10 +223,11 @@ class Tween {
222
223
  /**
223
224
  * delay the tween
224
225
  * @name delay
225
- * @memberOf me.Tween
226
+ * @memberof me.Tween
226
227
  * @public
227
228
  * @function
228
- * @param {Number} amount delay amount expressed in milliseconds
229
+ * @param {number} amount delay amount expressed in milliseconds
230
+ * @returns {me.Tween} this instance for object chaining
229
231
  */
230
232
  delay( amount ) {
231
233
 
@@ -237,10 +239,11 @@ class Tween {
237
239
  /**
238
240
  * Repeat the tween
239
241
  * @name repeat
240
- * @memberOf me.Tween
242
+ * @memberof me.Tween
241
243
  * @public
242
244
  * @function
243
- * @param {Number} times amount of times the tween should be repeated
245
+ * @param {number} times amount of times the tween should be repeated
246
+ * @returns {me.Tween} this instance for object chaining
244
247
  */
245
248
  repeat( times ) {
246
249
 
@@ -253,11 +256,12 @@ class Tween {
253
256
  * Allows the tween to bounce back to their original value when finished.
254
257
  * To be used together with repeat to create endless loops.
255
258
  * @name yoyo
256
- * @memberOf me.Tween
259
+ * @memberof me.Tween
257
260
  * @public
258
261
  * @function
259
262
  * @see me.Tween#repeat
260
- * @param {Boolean} yoyo
263
+ * @param {boolean} yoyo
264
+ * @returns {me.Tween} this instance for object chaining
261
265
  */
262
266
  yoyo( yoyo ) {
263
267
 
@@ -269,10 +273,11 @@ class Tween {
269
273
  /**
270
274
  * set the easing function
271
275
  * @name easing
272
- * @memberOf me.Tween
276
+ * @memberof me.Tween
273
277
  * @public
274
278
  * @function
275
- * @param {me.Tween.Easing} fn easing function
279
+ * @param {me.Tween.Easing} easing easing function
280
+ * @returns {me.Tween} this instance for object chaining
276
281
  */
277
282
  easing( easing ) {
278
283
  if (typeof easing !== "function") {
@@ -280,16 +285,16 @@ class Tween {
280
285
  }
281
286
  this._easingFunction = easing;
282
287
  return this;
283
-
284
288
  }
285
289
 
286
290
  /**
287
291
  * set the interpolation function
288
292
  * @name interpolation
289
- * @memberOf me.Tween
293
+ * @memberof me.Tween
290
294
  * @public
291
295
  * @function
292
- * @param {me.Tween.Interpolation} fn interpolation function
296
+ * @param {me.Tween.Interpolation} interpolation interpolation function
297
+ * @returns {me.Tween} this instance for object chaining
293
298
  */
294
299
  interpolation( interpolation ) {
295
300
  this._interpolationFunction = interpolation;
@@ -299,10 +304,11 @@ class Tween {
299
304
  /**
300
305
  * chain the tween
301
306
  * @name chain
302
- * @memberOf me.Tween
307
+ * @memberof me.Tween
303
308
  * @public
304
309
  * @function
305
- * @param {me.Tween} chainedTween Tween to be chained
310
+ * @param {...me.Tween} chainedTween Tween(s) to be chained
311
+ * @returns {me.Tween} this instance for object chaining
306
312
  */
307
313
  chain() {
308
314
  this._chainedTweens = arguments;
@@ -312,39 +318,42 @@ class Tween {
312
318
  /**
313
319
  * onStart callback
314
320
  * @name onStart
315
- * @memberOf me.Tween
321
+ * @memberof me.Tween
316
322
  * @public
317
323
  * @function
318
324
  * @param {Function} onStartCallback callback
325
+ * @returns {me.Tween} this instance for object chaining
319
326
  */
320
- onStart( callback ) {
321
- this._onStartCallback = callback;
327
+ onStart( onStartCallback ) {
328
+ this._onStartCallback = onStartCallback;
322
329
  return this;
323
330
  }
324
331
 
325
332
  /**
326
333
  * onUpdate callback
327
334
  * @name onUpdate
328
- * @memberOf me.Tween
335
+ * @memberof me.Tween
329
336
  * @public
330
337
  * @function
331
338
  * @param {Function} onUpdateCallback callback
339
+ * @returns {me.Tween} this instance for object chaining
332
340
  */
333
- onUpdate( callback ) {
334
- this._onUpdateCallback = callback;
341
+ onUpdate( onUpdateCallback ) {
342
+ this._onUpdateCallback = onUpdateCallback;
335
343
  return this;
336
344
  }
337
345
 
338
346
  /**
339
347
  * onComplete callback
340
348
  * @name onComplete
341
- * @memberOf me.Tween
349
+ * @memberof me.Tween
342
350
  * @public
343
351
  * @function
344
352
  * @param {Function} onCompleteCallback callback
353
+ * @returns {me.Tween} this instance for object chaining
345
354
  */
346
- onComplete( callback ) {
347
- this._onCompleteCallback = callback;
355
+ onComplete( onCompleteCallback ) {
356
+ this._onCompleteCallback = onCompleteCallback;
348
357
  return this;
349
358
  };
350
359
 
@@ -3,7 +3,7 @@ import { capitalize } from "./string.js";
3
3
  /**
4
4
  * a collection of utility functons to ease porting between different user agents.
5
5
  * @namespace me.utils.agent
6
- * @memberOf me
6
+ * @memberof me
7
7
  */
8
8
 
9
9
  /**
@@ -17,10 +17,10 @@ var vendors = [ "ms", "MS", "moz", "webkit", "o" ];
17
17
  * @public
18
18
  * @name prefixed
19
19
  * @function
20
- * @param {String} name Property name
21
- * @param {Object} [obj=window] Object or element reference to access
22
- * @return {Mixed} Value of property
23
- * @memberOf me.utils.agent
20
+ * @param {string} name Property name
21
+ * @param {object} [obj=window] Object or element reference to access
22
+ * @returns {string} Value of property
23
+ * @memberof me.utils.agent
24
24
  */
25
25
  export function prefixed(name, obj) {
26
26
  obj = obj || window;
@@ -43,11 +43,11 @@ export function prefixed(name, obj) {
43
43
  * @public
44
44
  * @name setPrefixed
45
45
  * @function
46
- * @param {String} name Property name
47
- * @param {Mixed} value Property value
48
- * @param {Object} [obj=window] Object or element reference to access
49
- * @return true if one of the vendor-prefixed property was found
50
- * @memberOf me.utils.agent
46
+ * @param {string} name Property name
47
+ * @param {string} value Property value
48
+ * @param {object} [obj=window] Object or element reference to access
49
+ * @returns {boolean} true if one of the vendor-prefixed property was found
50
+ * @memberof me.utils.agent
51
51
  */
52
52
  export function setPrefixed(name, value, obj) {
53
53
  obj = obj || window;
@@ -64,6 +64,7 @@ export function setPrefixed(name, value, obj) {
64
64
  obj[name] = value;
65
65
  return true;
66
66
  }
67
- return false;
68
67
  });
68
+
69
+ return false;
69
70
  };
@@ -3,18 +3,18 @@ import {random as mathRandom, weightedRandom as mathWeightedRandom} from "./../m
3
3
  /**
4
4
  * a collection of array utility functions
5
5
  * @namespace me.utils.array
6
- * @memberOf me
6
+ * @memberof me
7
7
  */
8
8
 
9
9
  /**
10
10
  * Remove the specified object from the given Array
11
11
  * @public
12
12
  * @function
13
- * @memberOf me.utils.array
13
+ * @memberof me.utils.array
14
14
  * @name remove
15
15
  * @param {Array} arr array from which to remove an object
16
- * @param {Object} object to be removed
17
- * @return {Array} the modified Array
16
+ * @param {object} obj to be removed
17
+ * @returns {Array} the modified Array
18
18
  * var arr = [ "foo", "bar", "baz" ];
19
19
  * // remove "foo" from the array
20
20
  * me.utils.array.remove(arr, "foo");
@@ -31,10 +31,10 @@ export function remove(arr, obj) {
31
31
  * return a random array element
32
32
  * @public
33
33
  * @function
34
- * @memberOf me.utils.array
34
+ * @memberof me.utils.array
35
35
  * @name random
36
36
  * @param {Array} arr array to pick a element
37
- * @return {any} random member of array
37
+ * @returns {any} random member of array
38
38
  * @example
39
39
  * // Select a random array element
40
40
  * var arr = [ "foo", "bar", "baz" ];
@@ -48,10 +48,10 @@ export function random(arr) {
48
48
  * return a weighted random array element, favoring the earlier entries
49
49
  * @public
50
50
  * @function
51
- * @memberOf me.utils.array
51
+ * @memberof me.utils.array
52
52
  * @name weightedRandom
53
53
  * @param {Array} arr array to pick a element
54
- * @return {any} random member of array
54
+ * @returns {any} random member of array
55
55
  */
56
56
  export function weightedRandom(arr) {
57
57
  return arr[mathWeightedRandom(0, arr.length)];