litecanvas 0.86.0 → 0.88.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/dist/dist.dev.js +242 -187
- package/dist/dist.js +58 -56
- package/dist/dist.min.js +1 -1
- package/package.json +42 -25
- package/src/index.js +254 -201
- package/types/index.d.ts +22 -21
- package/types/types.d.ts +23 -20
package/types/index.d.ts
CHANGED
|
@@ -444,35 +444,24 @@ declare global {
|
|
|
444
444
|
*/
|
|
445
445
|
function alpha(value: number): void
|
|
446
446
|
/**
|
|
447
|
-
*
|
|
448
|
-
* path as an argument (creates a copy), or optionally with a string
|
|
449
|
-
* consisting of SVG path data.
|
|
450
|
-
*
|
|
451
|
-
* @param [arg]
|
|
452
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D
|
|
453
|
-
*/
|
|
454
|
-
function path(arg?: Path2D | string): Path2D
|
|
455
|
-
/**
|
|
456
|
-
* Fills the current or given path with a given color.
|
|
447
|
+
* Fills the current path with a given color.
|
|
457
448
|
*
|
|
458
449
|
* @param color
|
|
459
|
-
* @param [path]
|
|
460
450
|
*/
|
|
461
|
-
function fill(color: number
|
|
451
|
+
function fill(color: number): void
|
|
462
452
|
/**
|
|
463
|
-
* Outlines the current
|
|
453
|
+
* Outlines the current path with a given color.
|
|
464
454
|
*
|
|
465
455
|
* @param color
|
|
466
|
-
* @param [path]
|
|
467
456
|
*/
|
|
468
|
-
function stroke(color: number
|
|
457
|
+
function stroke(color: number): void
|
|
469
458
|
/**
|
|
470
|
-
*
|
|
459
|
+
* Turns a path (in the callback) into the current clipping region.
|
|
471
460
|
*
|
|
472
|
-
* @param
|
|
461
|
+
* @param callback
|
|
473
462
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
|
|
474
463
|
*/
|
|
475
|
-
function clip(
|
|
464
|
+
function clip(callback: clipCallback): void
|
|
476
465
|
|
|
477
466
|
/** SOUND API */
|
|
478
467
|
/**
|
|
@@ -578,7 +567,7 @@ declare global {
|
|
|
578
567
|
*
|
|
579
568
|
* - n = 0: the settings passed to that instance
|
|
580
569
|
* - n = 1: returns true if the "init" event has already been emitted
|
|
581
|
-
* - n = 2: the current
|
|
570
|
+
* - n = 2: the current delta time (dt)
|
|
582
571
|
* - n = 3: the current canvas element scale (not the context 2D scale)
|
|
583
572
|
* - n = 4: the attached event callbacks
|
|
584
573
|
* - n = 5: the current color palette
|
|
@@ -588,13 +577,25 @@ declare global {
|
|
|
588
577
|
* - n = 9: the current RNG state
|
|
589
578
|
* - n = 10: the current font size
|
|
590
579
|
* - n = 11: the current font family
|
|
591
|
-
* - n = *any other value*: returns undefined
|
|
580
|
+
* - n = *any other value*: probably returns undefined
|
|
592
581
|
*
|
|
593
582
|
* @param n
|
|
594
583
|
*/
|
|
595
584
|
function stat(n: number): any
|
|
596
585
|
/**
|
|
597
|
-
*
|
|
586
|
+
* Shutdown the litecanvas instance and remove all event listeners.
|
|
598
587
|
*/
|
|
599
588
|
function quit(): void
|
|
589
|
+
/**
|
|
590
|
+
* Pauses the engine loop (update & draw).
|
|
591
|
+
*/
|
|
592
|
+
function pause(): void
|
|
593
|
+
/**
|
|
594
|
+
* Resumes (if paused) the engine loop.
|
|
595
|
+
*/
|
|
596
|
+
function resume(): void
|
|
597
|
+
/**
|
|
598
|
+
* Returns `true` if the engine loop is paused.
|
|
599
|
+
*/
|
|
600
|
+
function paused(): boolean
|
|
600
601
|
}
|
package/types/types.d.ts
CHANGED
|
@@ -435,35 +435,24 @@ type LitecanvasInstance = {
|
|
|
435
435
|
*/
|
|
436
436
|
alpha(value: number): void
|
|
437
437
|
/**
|
|
438
|
-
*
|
|
439
|
-
* path as an argument (creates a copy), or optionally with a string
|
|
440
|
-
* consisting of SVG path data.
|
|
441
|
-
*
|
|
442
|
-
* @param [arg]
|
|
443
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D
|
|
444
|
-
*/
|
|
445
|
-
path(arg?: Path2D | string): Path2D
|
|
446
|
-
/**
|
|
447
|
-
* Fills the current or given path with a given color.
|
|
438
|
+
* Fills the current path with a given color.
|
|
448
439
|
*
|
|
449
440
|
* @param color
|
|
450
|
-
* @param [path]
|
|
451
441
|
*/
|
|
452
|
-
fill(color: number
|
|
442
|
+
fill(color: number): void
|
|
453
443
|
/**
|
|
454
|
-
* Outlines the current
|
|
444
|
+
* Outlines the current path with a given color.
|
|
455
445
|
*
|
|
456
446
|
* @param color
|
|
457
|
-
* @param [path]
|
|
458
447
|
*/
|
|
459
|
-
stroke(color: number
|
|
448
|
+
stroke(color: number): void
|
|
460
449
|
/**
|
|
461
|
-
*
|
|
450
|
+
* Turns a path (in the callback) into the current clipping region.
|
|
462
451
|
*
|
|
463
|
-
* @param
|
|
452
|
+
* @param callback
|
|
464
453
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
|
|
465
454
|
*/
|
|
466
|
-
clip(
|
|
455
|
+
clip(callback: clipCallback): void
|
|
467
456
|
|
|
468
457
|
/** SOUND API */
|
|
469
458
|
/**
|
|
@@ -565,7 +554,7 @@ type LitecanvasInstance = {
|
|
|
565
554
|
*
|
|
566
555
|
* - n = 0: the settings passed to that instance
|
|
567
556
|
* - n = 1: returns true if the "init" event has already been emitted
|
|
568
|
-
* - n = 2: the current
|
|
557
|
+
* - n = 2: the current delta time (dt)
|
|
569
558
|
* - n = 3: the current canvas element scale (not the context 2D scale)
|
|
570
559
|
* - n = 4: the attached event callbacks
|
|
571
560
|
* - n = 5: the current color palette
|
|
@@ -575,7 +564,7 @@ type LitecanvasInstance = {
|
|
|
575
564
|
* - n = 9: the current RNG state
|
|
576
565
|
* - n = 10: the current font size
|
|
577
566
|
* - n = 11: the current font family
|
|
578
|
-
* - n = *any other value*: returns undefined
|
|
567
|
+
* - n = *any other value*: probably returns undefined
|
|
579
568
|
*
|
|
580
569
|
* @param n
|
|
581
570
|
*/
|
|
@@ -584,6 +573,18 @@ type LitecanvasInstance = {
|
|
|
584
573
|
* Stops the litecanvas instance and remove all event listeners.
|
|
585
574
|
*/
|
|
586
575
|
quit(): void
|
|
576
|
+
/**
|
|
577
|
+
* Pauses the engine loop (update & draw).
|
|
578
|
+
*/
|
|
579
|
+
pause(): void
|
|
580
|
+
/**
|
|
581
|
+
* Resumes (if paused) the engine loop.
|
|
582
|
+
*/
|
|
583
|
+
resume(): void
|
|
584
|
+
/**
|
|
585
|
+
* Returns `true` if the engine loop is paused.
|
|
586
|
+
*/
|
|
587
|
+
paused(): boolean
|
|
587
588
|
}
|
|
588
589
|
|
|
589
590
|
type LitecanvasOptions = {
|
|
@@ -667,3 +668,5 @@ type LitecanvasGameLoop = {
|
|
|
667
668
|
type drawCallback = (context: OffscreenCanvasRenderingContext2D) => void
|
|
668
669
|
|
|
669
670
|
type pluginCallback = (instance: LitecanvasInstance, config?: any) => any
|
|
671
|
+
|
|
672
|
+
type clipCallback = (ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D) => void
|