litecanvas 0.75.0 → 0.75.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/dist/dist.js CHANGED
@@ -106,11 +106,6 @@
106
106
  * @tutorial https://gamedev.net/tutorials/programming/general-and-gameplay-programming/a-brief-introduction-to-lerp-r4954/
107
107
  */
108
108
  lerp: (start, end, t) => {
109
- if (false) {
110
- assert(isFinite(start), "lerp: 1st param must be a number");
111
- assert(isFinite(end), "lerp: 2nd param must be a number");
112
- assert(isFinite(t), "lerp: 3rd param must be a number");
113
- }
114
109
  return t * (end - start) + start;
115
110
  },
116
111
  /**
@@ -120,9 +115,6 @@
120
115
  * @returns {number} the value in radians
121
116
  */
122
117
  deg2rad: (degs) => {
123
- if (false) {
124
- assert(isFinite(degs), "deg2rad: 1st param must be a number");
125
- }
126
118
  return PI / 180 * degs;
127
119
  },
128
120
  /**
@@ -132,9 +124,6 @@
132
124
  * @returns {number} the value in degrees
133
125
  */
134
126
  rad2deg: (rads) => {
135
- if (false) {
136
- assert(isFinite(rads), "rad2deg: 1st param must be a number");
137
- }
138
127
  return 180 / PI * rads;
139
128
  },
140
129
  /**
@@ -146,15 +135,6 @@
146
135
  * @returns {number}
147
136
  */
148
137
  clamp: (value, min, max) => {
149
- if (false) {
150
- assert(isFinite(value), "clamp: 1st param must be a number");
151
- assert(isFinite(min), "clamp: 2nd param must be a number");
152
- assert(isFinite(max), "clamp: 3rd param must be a number");
153
- assert(
154
- max > min,
155
- "randi: the 2nd param must be less than the 3rd param"
156
- );
157
- }
158
138
  if (value < min) return min;
159
139
  if (value > max) return max;
160
140
  return value;
@@ -168,19 +148,6 @@
168
148
  * @returns {number}
169
149
  */
170
150
  wrap: (value, min, max) => {
171
- if (false) {
172
- assert(isFinite(value), "wrap: 1st param must be a number");
173
- assert(isFinite(min), "wrap: 2nd param must be a number");
174
- assert(isFinite(max), "wrap: 3rd param must be a number");
175
- assert(
176
- max > min,
177
- "randi: the 2nd param must be less than the 3rd param"
178
- );
179
- assert(
180
- max !== min,
181
- "randi: the 2nd param must be not equal to the 3rd param"
182
- );
183
- }
184
151
  return value - (max - min) * Math.floor((value - min) / (max - min));
185
152
  },
186
153
  /**
@@ -195,13 +162,6 @@
195
162
  * @returns {number} the remapped number
196
163
  */
197
164
  map(value, start1, stop1, start2, stop2, withinBounds) {
198
- if (false) {
199
- assert(isFinite(value), "map: 1st param must be a number");
200
- assert(isFinite(start1), "map: 2nd param must be a number");
201
- assert(isFinite(stop1), "map: 3rd param must be a number");
202
- assert(isFinite(start2), "map: 4th param must be a number");
203
- assert(isFinite(stop2), "map: 5th param must be a number");
204
- }
205
165
  const result = (value - start1) / (stop1 - start1) * (stop2 - start2) + start2;
206
166
  return withinBounds ? instance.clamp(result, start2, stop2) : result;
207
167
  },
@@ -216,11 +176,6 @@
216
176
  * @returns {number} the normalized number.
217
177
  */
218
178
  norm: (value, start, stop) => {
219
- if (false) {
220
- assert(isFinite(value), "norm: 1st param must be a number");
221
- assert(isFinite(start), "norm: 2nd param must be a number");
222
- assert(isFinite(stop), "norm: 3rd param must be a number");
223
- }
224
179
  return instance.map(value, start, stop, 0, 1);
225
180
  },
226
181
  /** RNG API */
@@ -233,14 +188,6 @@
233
188
  * @returns {number} the random number
234
189
  */
235
190
  rand: (min = 0, max = 1) => {
236
- if (false) {
237
- assert(isFinite(min), "rand: 1st param must be a number");
238
- assert(isFinite(max), "rand: 2nd param must be a number");
239
- assert(
240
- max > min,
241
- "rand: the 1st param must be less than the 2nd param"
242
- );
243
- }
244
191
  const a = 1664525;
245
192
  const c = 1013904223;
246
193
  const m = 4294967296;
@@ -255,14 +202,6 @@
255
202
  * @returns {number} the random number
256
203
  */
257
204
  randi: (min = 0, max = 1) => {
258
- if (false) {
259
- assert(isFinite(min), "randi: 1st param must be a number");
260
- assert(isFinite(max), "randi: 2nd param must be a number");
261
- assert(
262
- max > min,
263
- "randi: the 1st param must be less than the 2nd param"
264
- );
265
- }
266
205
  return Math.floor(instance.rand(min, max + 1));
267
206
  },
268
207
  /**
@@ -273,12 +212,6 @@
273
212
  * @returns {number} the seed state
274
213
  */
275
214
  seed: (value) => {
276
- if (false) {
277
- assert(
278
- null == value || isFinite(value) && value >= 0,
279
- "seed: 1st param must be a positive number or zero"
280
- );
281
- }
282
215
  return null == value ? _rng_seed : _rng_seed = ~~value;
283
216
  },
284
217
  /** BASIC GRAPHICS API */
@@ -288,12 +221,6 @@
288
221
  * @param {number?} color The background color (index) or null (for transparent)
289
222
  */
290
223
  cls(color) {
291
- if (false) {
292
- assert(
293
- null == color || isFinite(color) && color >= 0,
294
- "cls: 1st param must be a positive number or zero or null"
295
- );
296
- }
297
224
  if (null == color) {
298
225
  _ctx.clearRect(0, 0, _ctx.canvas.width, _ctx.canvas.height);
299
226
  } else {
@@ -317,26 +244,6 @@
317
244
  * @param {number|number[]} [radii] A number or list specifying the radii used to draw a rounded-borders rectangle
318
245
  */
319
246
  rect(x, y, width, height, color, radii = null) {
320
- if (false) {
321
- assert(isFinite(x), "rect: 1st param must be a number");
322
- assert(isFinite(y), "rect: 2nd param must be a number");
323
- assert(
324
- isFinite(width) && width > 0,
325
- "rect: 3rd param must be a positive number"
326
- );
327
- assert(
328
- isFinite(height) && height >= 0,
329
- "rect: 4th param must be a positive number or zero"
330
- );
331
- assert(
332
- null == color || isFinite(color) && color >= 0,
333
- "rect: 5th param must be a positive number or zero"
334
- );
335
- assert(
336
- null == radii || isFinite(radii) || Array.isArray(radii) && radii.length >= 1,
337
- "rect: 6th param must be a number or array of numbers"
338
- );
339
- }
340
247
  _ctx.beginPath();
341
248
  _ctx[radii ? "roundRect" : "rect"](
342
249
  ~~x - _outline_fix,
@@ -358,26 +265,6 @@
358
265
  * @param {number|number[]} [radii] A number or list specifying the radii used to draw a rounded-borders rectangle
359
266
  */
360
267
  rectfill(x, y, width, height, color, radii = null) {
361
- if (false) {
362
- assert(isFinite(x), "rectfill: 1st param must be a number");
363
- assert(isFinite(y), "rectfill: 2nd param must be a number");
364
- assert(
365
- isFinite(width) && width >= 0,
366
- "rectfill: 3rd param must be a positive number or zero"
367
- );
368
- assert(
369
- isFinite(height) && height >= 0,
370
- "rectfill: 4th param must be a positive number or zero"
371
- );
372
- assert(
373
- null == color || isFinite(color) && color >= 0,
374
- "rectfill: 5th param must be a positive number or zero"
375
- );
376
- assert(
377
- null == radii || isFinite(radii) || Array.isArray(radii) && radii.length >= 1,
378
- "rectfill: 6th param must be a number or array of at least 2 numbers"
379
- );
380
- }
381
268
  _ctx.beginPath();
382
269
  _ctx[radii ? "roundRect" : "rect"](
383
270
  ~~x,
@@ -397,18 +284,6 @@
397
284
  * @param {number} [color=0] the color index
398
285
  */
399
286
  circ(x, y, radius, color) {
400
- if (false) {
401
- assert(isFinite(x), "circ: 1st param must be a number");
402
- assert(isFinite(y), "circ: 2nd param must be a number");
403
- assert(
404
- isFinite(radius) && radius >= 0,
405
- "circ: 3rd param must be a positive number or zero"
406
- );
407
- assert(
408
- null == color || isFinite(color) && color >= 0,
409
- "circ: 4th param must be a positive number or zero"
410
- );
411
- }
412
287
  _ctx.beginPath();
413
288
  _ctx.arc(~~x, ~~y, ~~radius, 0, TWO_PI);
414
289
  instance.stroke(color);
@@ -422,18 +297,6 @@
422
297
  * @param {number} [color=0] the color index
423
298
  */
424
299
  circfill(x, y, radius, color) {
425
- if (false) {
426
- assert(isFinite(x), "circfill: 1st param must be a number");
427
- assert(isFinite(y), "circfill: 2nd param must be a number");
428
- assert(
429
- isFinite(radius) && radius >= 0,
430
- "circfill: 3rd param must be a positive number or zero"
431
- );
432
- assert(
433
- null == color || isFinite(color) && color >= 0,
434
- "circfill: 4th param must be a positive number or zero"
435
- );
436
- }
437
300
  _ctx.beginPath();
438
301
  _ctx.arc(~~x, ~~y, ~~radius, 0, TWO_PI);
439
302
  instance.fill(color);
@@ -448,22 +311,6 @@
448
311
  * @param {number} [color=0] the color index
449
312
  */
450
313
  line(x1, y1, x2, y2, color) {
451
- if (false) {
452
- assert(isFinite(x1), "line: 1st param must be a number");
453
- assert(isFinite(y1), "line: 2nd param must be a number");
454
- assert(
455
- isFinite(x2),
456
- "line: 3rd param must be a positive number or zero"
457
- );
458
- assert(
459
- isFinite(y2),
460
- "line: 4th param must be a positive number or zero"
461
- );
462
- assert(
463
- null == color || isFinite(color) && color >= 0,
464
- "line: 5th param must be a positive number or zero"
465
- );
466
- }
467
314
  _ctx.beginPath();
468
315
  let xfix = _outline_fix !== 0 && ~~x1 === ~~x2 ? 0.5 : 0;
469
316
  let yfix = _outline_fix !== 0 && ~~y1 === ~~y2 ? 0.5 : 0;
@@ -478,12 +325,6 @@
478
325
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineWidth
479
326
  */
480
327
  linewidth(value) {
481
- if (false) {
482
- assert(
483
- isFinite(value) && ~~value > 0,
484
- "linewidth: 1st param must be a positive number"
485
- );
486
- }
487
328
  _ctx.lineWidth = ~~value;
488
329
  _outline_fix = ~~value % 2 === 0 ? 0 : 0.5;
489
330
  },
@@ -496,13 +337,6 @@
496
337
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset
497
338
  */
498
339
  linedash(segments, offset = 0) {
499
- if (false) {
500
- assert(
501
- Array.isArray(segments) && segments.length > 0,
502
- "linedash: 1st param must be an array of numbers"
503
- );
504
- assert(isFinite(offset), "linedash: 2nd param must be a number");
505
- }
506
340
  _ctx.setLineDash(segments);
507
341
  _ctx.lineDashOffset = offset;
508
342
  },
@@ -517,18 +351,6 @@
517
351
  * @param {string} [fontStyle] can be "normal" (default), "italic" and/or "bold".
518
352
  */
519
353
  text(x, y, message, color = 3, fontStyle = "normal") {
520
- if (false) {
521
- assert(isFinite(x), "text: 1st param must be a number");
522
- assert(isFinite(y), "text: 2nd param must be a number");
523
- assert(
524
- null == color || isFinite(color) && color >= 0,
525
- "text: 4th param must be a positive number or zero"
526
- );
527
- assert(
528
- "string" === typeof fontStyle,
529
- "text: 5th param must be a string"
530
- );
531
- }
532
354
  _ctx.font = `${fontStyle} ${_fontSize}px ${_fontFamily}`;
533
355
  _ctx.fillStyle = instance.getcolor(color);
534
356
  _ctx.fillText(message, ~~x, ~~y);
@@ -539,12 +361,6 @@
539
361
  * @param {string} family
540
362
  */
541
363
  textfont(family) {
542
- if (false) {
543
- assert(
544
- "string" === typeof family,
545
- "textfont: 1st param must be a string"
546
- );
547
- }
548
364
  _fontFamily = family;
549
365
  },
550
366
  /**
@@ -553,9 +369,6 @@
553
369
  * @param {number} size
554
370
  */
555
371
  textsize(size) {
556
- if (false) {
557
- assert(isFinite(size), "textsize: 1st param must be a number");
558
- }
559
372
  _fontSize = size;
560
373
  },
561
374
  /**
@@ -567,25 +380,6 @@
567
380
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textAlign
568
381
  */
569
382
  textalign(align, baseline) {
570
- if (false) {
571
- assert(
572
- null == align || ["left", "right", "center", "start", "end"].includes(
573
- align
574
- ),
575
- "textalign: 1st param must be a string"
576
- );
577
- assert(
578
- null == baseline || [
579
- "top",
580
- "bottom",
581
- "middle",
582
- "hanging",
583
- "alphabetic",
584
- "ideographic"
585
- ].includes(baseline),
586
- "textalign: 2nd param must be a string"
587
- );
588
- }
589
383
  if (align) _ctx.textAlign = align;
590
384
  if (baseline) _ctx.textBaseline = baseline;
591
385
  },
@@ -598,10 +392,6 @@
598
392
  * @param {OffscreenCanvas|HTMLImageElement|HTMLCanvasElement} source
599
393
  */
600
394
  image(x, y, source) {
601
- if (false) {
602
- assert(isFinite(x), "image: 1st param must be a number");
603
- assert(isFinite(y), "image: 2nd param must be a number");
604
- }
605
395
  _ctx.drawImage(source, ~~x, ~~y);
606
396
  },
607
397
  /**
@@ -617,18 +407,6 @@
617
407
  * @see https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
618
408
  */
619
409
  paint(width, height, drawing, options = {}) {
620
- if (false) {
621
- assert(isFinite(width), "paint: 1st param must be a number");
622
- assert(isFinite(height), "paint: 2nd param must be a number");
623
- assert(
624
- "function" === typeof drawing || Array.isArray(drawing),
625
- "paint: 3rd param must be a function or array"
626
- );
627
- assert(
628
- options && !options.scale || isFinite(options.scale),
629
- "paint: 4th param (options.scale) must be a number"
630
- );
631
- }
632
410
  const canvas = options.canvas || new OffscreenCanvas(1, 1), scale = options.scale || 1, contextOriginal = _ctx;
633
411
  canvas.width = width * scale;
634
412
  canvas.height = height * scale;
@@ -662,8 +440,6 @@
662
440
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
663
441
  */
664
442
  ctx(context) {
665
- if (false) {
666
- }
667
443
  if (context) {
668
444
  _ctx = context;
669
445
  }
@@ -688,10 +464,6 @@
688
464
  * @param {number} y
689
465
  */
690
466
  translate: (x, y) => {
691
- if (false) {
692
- assert(isFinite(x), "translate: 1st param must be a number");
693
- assert(isFinite(y), "translate: 2nd param must be a number");
694
- }
695
467
  return _ctx.translate(~~x, ~~y);
696
468
  },
697
469
  /**
@@ -701,13 +473,6 @@
701
473
  * @param {number} [y]
702
474
  */
703
475
  scale: (x, y) => {
704
- if (false) {
705
- assert(isFinite(x), "scale: 1st param must be a number");
706
- assert(
707
- y == null || isFinite(y),
708
- "scale: 2nd param must be a number"
709
- );
710
- }
711
476
  return _ctx.scale(x, y || x);
712
477
  },
713
478
  /**
@@ -716,9 +481,6 @@
716
481
  * @param {number} radians
717
482
  */
718
483
  rotate: (radians) => {
719
- if (false) {
720
- assert(isFinite(radians), "rotate: 1st param must be a number");
721
- }
722
484
  return _ctx.rotate(radians);
723
485
  },
724
486
  /**
@@ -728,9 +490,6 @@
728
490
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalAlpha
729
491
  */
730
492
  alpha(value) {
731
- if (false) {
732
- assert(isFinite(value), "alpha: 1st param must be a number");
733
- }
734
493
  _ctx.globalAlpha = instance.clamp(value, 0, 1);
735
494
  },
736
495
  /**
@@ -743,12 +502,6 @@
743
502
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D
744
503
  */
745
504
  path: (arg) => {
746
- if (false) {
747
- assert(
748
- null == arg || "string" === typeof arg || arg instanceof Path2D,
749
- "path: 1st param must be a string or a Path2D instance"
750
- );
751
- }
752
505
  return new Path2D(arg);
753
506
  },
754
507
  /**
@@ -758,16 +511,6 @@
758
511
  * @param {Path2D} [path]
759
512
  */
760
513
  fill(color, path) {
761
- if (false) {
762
- assert(
763
- null == color || isFinite(color) && color >= 0,
764
- "fill: 1st param must be a positive number or zero"
765
- );
766
- assert(
767
- null == path || path instanceof Path2D,
768
- "fill: 2nd param must be a Path2D instance"
769
- );
770
- }
771
514
  _ctx.fillStyle = instance.getcolor(color);
772
515
  if (path) {
773
516
  _ctx.fill(path);
@@ -782,16 +525,6 @@
782
525
  * @param {Path2D} [path]
783
526
  */
784
527
  stroke(color, path) {
785
- if (false) {
786
- assert(
787
- null == color || isFinite(color) && color >= 0,
788
- "stroke: 1st param must be a positive number or zero"
789
- );
790
- assert(
791
- null == path || path instanceof Path2D,
792
- "stroke: 2nd param must be a Path2D instance"
793
- );
794
- }
795
528
  _ctx.strokeStyle = instance.getcolor(color);
796
529
  if (path) {
797
530
  _ctx.stroke(path);
@@ -806,12 +539,6 @@
806
539
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
807
540
  */
808
541
  clip(path) {
809
- if (false) {
810
- assert(
811
- path instanceof Path2D,
812
- "clip: 1st param must be a Path2D instance"
813
- );
814
- }
815
542
  _ctx.clip(path);
816
543
  },
817
544
  /** SOUND API */
@@ -827,17 +554,6 @@
827
554
  * @see https://github.com/KilledByAPixel/ZzFX
828
555
  */
829
556
  sfx(zzfxParams, pitchSlide = 0, volumeFactor = 1) {
830
- if (false) {
831
- assert(
832
- null == zzfxParams || Array.isArray(zzfxParams),
833
- "sfx: 1st param must be an array"
834
- );
835
- assert(isFinite(pitchSlide), "sfx: 2nd param must be a number");
836
- assert(
837
- isFinite(volumeFactor),
838
- "sfx: 3rd param must be a number"
839
- );
840
- }
841
557
  if (root.zzfxV <= 0 || navigator.userActivation && !navigator.userActivation.hasBeenActive) {
842
558
  return false;
843
559
  }
@@ -857,9 +573,6 @@
857
573
  * @param {number} value
858
574
  */
859
575
  volume(value) {
860
- if (false) {
861
- assert(isFinite(value), "volume: 1st param must be a number");
862
- }
863
576
  root.zzfxV = value;
864
577
  },
865
578
  /** UTILS API */
@@ -877,16 +590,6 @@
877
590
  * @returns {boolean}
878
591
  */
879
592
  colrect: (x1, y1, w1, h1, x2, y2, w2, h2) => {
880
- if (false) {
881
- assert(isFinite(x1), "colrect: 1st param must be a number");
882
- assert(isFinite(y1), "colrect: 2nd param must be a number");
883
- assert(isFinite(w1), "colrect: 3rd param must be a number");
884
- assert(isFinite(h1), "colrect: 4th param must be a number");
885
- assert(isFinite(x2), "colrect: 5th param must be a number");
886
- assert(isFinite(y2), "colrect: 6th param must be a number");
887
- assert(isFinite(w2), "colrect: 7th param must be a number");
888
- assert(isFinite(h2), "colrect: 8th param must be a number");
889
- }
890
593
  return x1 < x2 + w2 && x1 + w1 > x2 && y1 < y2 + h2 && y1 + h1 > y2;
891
594
  },
892
595
  /**
@@ -901,14 +604,6 @@
901
604
  * @returns {boolean}
902
605
  */
903
606
  colcirc: (x1, y1, r1, x2, y2, r2) => {
904
- if (false) {
905
- assert(isFinite(x1), "colcirc: 1st param must be a number");
906
- assert(isFinite(y1), "colcirc: 2nd param must be a number");
907
- assert(isFinite(r1), "colcirc: 3rd param must be a number");
908
- assert(isFinite(x2), "colcirc: 4th param must be a number");
909
- assert(isFinite(y2), "colcirc: 5th param must be a number");
910
- assert(isFinite(r2), "colcirc: 6th param must be a number");
911
- }
912
607
  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) <= (r1 + r2) * (r1 + r2);
913
608
  },
914
609
  /** PLUGINS API */
@@ -918,16 +613,6 @@
918
613
  * @param {pluginCallback} callback
919
614
  */
920
615
  use(callback, config = {}) {
921
- if (false) {
922
- assert(
923
- "function" === typeof callback,
924
- "use: 1st param must be a function"
925
- );
926
- assert(
927
- "object" === typeof config,
928
- "use: 2nd param must be an object"
929
- );
930
- }
931
616
  _initialized ? loadPlugin(callback, config) : _plugins.push([callback, config]);
932
617
  },
933
618
  /**
@@ -938,16 +623,6 @@
938
623
  * @returns {Function} a function to remove the listener
939
624
  */
940
625
  listen(eventName, callback) {
941
- if (false) {
942
- assert(
943
- "string" === typeof eventName,
944
- "listen: 1st param must be a string"
945
- );
946
- assert(
947
- "function" === typeof callback,
948
- "listen: 2nd param must be a function"
949
- );
950
- }
951
626
  _events[eventName] = _events[eventName] || /* @__PURE__ */ new Set();
952
627
  _events[eventName].add(callback);
953
628
  return () => _events[eventName].delete(callback);
@@ -962,12 +637,6 @@
962
637
  * @param {*} [arg4] any data to be passed over the listeners
963
638
  */
964
639
  emit(eventName, arg1, arg2, arg3, arg4) {
965
- if (false) {
966
- assert(
967
- "string" === typeof eventName,
968
- "emit: 1st param must be a string"
969
- );
970
- }
971
640
  triggerEvent("before:" + eventName, arg1, arg2, arg3, arg4);
972
641
  triggerEvent(eventName, arg1, arg2, arg3, arg4);
973
642
  triggerEvent("after:" + eventName, arg1, arg2, arg3, arg4);
@@ -979,12 +648,6 @@
979
648
  * @returns {string} the color code
980
649
  */
981
650
  getcolor: (index) => {
982
- if (false) {
983
- assert(
984
- null == index || isFinite(index) && index >= 0,
985
- "getcolor: 1st param must be a number"
986
- );
987
- }
988
651
  return colors[~~index % colors.length];
989
652
  },
990
653
  /**
@@ -994,13 +657,7 @@
994
657
  * @param {*} value
995
658
  */
996
659
  setvar(key, value) {
997
- if (false) {
998
- assert(
999
- "string" === typeof key,
1000
- "setvar: 1st param must be a string"
1001
- );
1002
- if (value == null) {
1003
- }
660
+ if (value == null) {
1004
661
  }
1005
662
  instance[key] = value;
1006
663
  if (_global) {
@@ -1014,10 +671,6 @@
1014
671
  * @param {number} height
1015
672
  */
1016
673
  resize(width, height) {
1017
- if (false) {
1018
- assert(isFinite(width), "resize: 1st param must be a number");
1019
- assert(isFinite(height), "resize: 2nd param must be a number");
1020
- }
1021
674
  instance.setvar("WIDTH", _canvas.width = width);
1022
675
  instance.setvar("HEIGHT", _canvas.height = height);
1023
676
  pageResized();
@@ -1030,9 +683,6 @@
1030
683
  * @param {number} value
1031
684
  */
1032
685
  timescale(value) {
1033
- if (false) {
1034
- assert(isFinite(value), "timescale: 1st param must be a number");
1035
- }
1036
686
  _timeScale = value;
1037
687
  },
1038
688
  /**
@@ -1041,12 +691,6 @@
1041
691
  * @param {number} value
1042
692
  */
1043
693
  setfps(value) {
1044
- if (false) {
1045
- assert(
1046
- isFinite(value) && value >= 1,
1047
- "setfps: 1st param must be a positive number"
1048
- );
1049
- }
1050
694
  _deltaTime = 1 / ~~value;
1051
695
  },
1052
696
  /**
@@ -1183,12 +827,6 @@
1183
827
  if (settings.keyboardEvents) {
1184
828
  const _keys = /* @__PURE__ */ new Set();
1185
829
  const iskeydown = (key) => {
1186
- if (false) {
1187
- assert(
1188
- "string" === typeof key,
1189
- "iskeydown: 1st param must be a string"
1190
- );
1191
- }
1192
830
  return "any" === key ? _keys.size > 0 : _keys.has(key.toLowerCase());
1193
831
  };
1194
832
  instance.setvar("iskeydown", iskeydown);
@@ -1242,20 +880,6 @@
1242
880
  }
1243
881
  function setupCanvas() {
1244
882
  _canvas = "string" === typeof _canvas ? document.querySelector(_canvas) : _canvas;
1245
- if (false) {
1246
- assert(
1247
- _canvas && _canvas.tagName === "CANVAS",
1248
- "Invalid canvas element"
1249
- );
1250
- assert(
1251
- null === instance.WIDTH || instance.WIDTH > 0,
1252
- `Litecanvas' "width" option should be null or a positive number`
1253
- );
1254
- assert(
1255
- null === instance.HEIGHT || instance.HEIGHT > 0,
1256
- `Litecanvas' "width" option should be null or a positive number`
1257
- );
1258
- }
1259
883
  instance.setvar("CANVAS", _canvas);
1260
884
  _ctx = _canvas.getContext("2d");
1261
885
  on(_canvas, "click", () => root.focus());
@@ -1304,12 +928,6 @@
1304
928
  }
1305
929
  function loadPlugin(callback, config) {
1306
930
  const pluginData = callback(instance, _helpers, config);
1307
- if (false) {
1308
- assert(
1309
- null == pluginData || "object" === typeof pluginData,
1310
- "Litecanvas plugins should return an object or nothing"
1311
- );
1312
- }
1313
931
  for (const key in pluginData) {
1314
932
  instance.setvar(key, pluginData[key]);
1315
933
  }