littlejsengine 1.9.4 → 1.9.6
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/littlejs.d.ts +73 -63
- package/dist/littlejs.esm.js +405 -245
- package/dist/littlejs.esm.min.js +1 -1
- package/dist/littlejs.js +403 -245
- package/dist/littlejs.min.js +1 -1
- package/dist/littlejs.release.js +399 -240
- package/examples/breakout/index.html +3 -3
- package/examples/breakoutTutorial/index.html +2 -2
- package/examples/electron/index.html +2 -2
- package/examples/js13k/build.js +1 -0
- package/examples/js13k/index.html +13 -13
- package/examples/module/index.html +1 -1
- package/examples/particles/index.html +1 -1
- package/examples/platformer/gameEffects.js +2 -3
- package/examples/platformer/index.html +8 -8
- package/examples/puzzle/index.html +2 -2
- package/examples/starter/index.html +13 -13
- package/examples/stress/index.html +1 -1
- package/examples/typescript/index.html +1 -1
- package/package.json +1 -1
- package/reference.md +11 -11
- package/src/engine.js +127 -71
- package/src/engineAudio.js +20 -16
- package/src/engineBuild.js +4 -4
- package/src/engineDebug.js +4 -5
- package/src/engineDraw.js +13 -10
- package/src/engineExport.js +2 -0
- package/src/engineInput.js +80 -64
- package/src/engineObject.js +27 -18
- package/src/engineParticles.js +14 -13
- package/src/engineSettings.js +13 -2
- package/src/engineTileLayer.js +20 -6
- package/src/engineUtilities.js +65 -22
- package/src/engineWebGL.js +20 -18
package/dist/littlejs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module "
|
|
1
|
+
declare module "littlejsengine" {
|
|
2
2
|
/**
|
|
3
3
|
* LittleJS - The Tiny Fast JavaScript Game Engine
|
|
4
4
|
* MIT License - Copyright 2021 Frank Force
|
|
@@ -79,7 +79,7 @@ declare module "littlejs.esm" {
|
|
|
79
79
|
* @memberof Engine */
|
|
80
80
|
export function engineObjectsDestroy(): void;
|
|
81
81
|
/** Triggers a callback for each object within a given area
|
|
82
|
-
* @param {Vector2} [pos] - Center of test area
|
|
82
|
+
* @param {Vector2} [pos] - Center of test area, or undefined for all objects
|
|
83
83
|
* @param {Number|Vector2} [size] - Radius of circle if float, rectangle size if Vector2
|
|
84
84
|
* @param {Function} [callbackFunction] - Calls this function on every object that passes the test
|
|
85
85
|
* @param {Array} [objects=engineObjects] - List of objects to check
|
|
@@ -214,6 +214,11 @@ declare module "littlejs.esm" {
|
|
|
214
214
|
* @default
|
|
215
215
|
* @memberof Settings */
|
|
216
216
|
export let showSplashScreen: boolean;
|
|
217
|
+
/** Disables all rendering, audio, and input for servers
|
|
218
|
+
* @type {Boolean}
|
|
219
|
+
* @default
|
|
220
|
+
* @memberof Settings */
|
|
221
|
+
export let headlessMode: boolean;
|
|
217
222
|
/** Default size of tiles in pixels
|
|
218
223
|
* @type {Vector2}
|
|
219
224
|
* @default Vector2(16,16)
|
|
@@ -389,6 +394,10 @@ declare module "littlejs.esm" {
|
|
|
389
394
|
* @param {Boolean} show
|
|
390
395
|
* @memberof Settings */
|
|
391
396
|
export function setShowSplashScreen(show: boolean): void;
|
|
397
|
+
/** Set to disalbe rendering, audio, and input for servers
|
|
398
|
+
* @param {Boolean} headless
|
|
399
|
+
* @memberof Settings */
|
|
400
|
+
export function setHeadlessMode(headless: boolean): void;
|
|
392
401
|
/** Set if webgl rendering is enabled
|
|
393
402
|
* @param {Boolean} enable
|
|
394
403
|
* @memberof Settings */
|
|
@@ -619,13 +628,13 @@ declare module "littlejs.esm" {
|
|
|
619
628
|
* @memberof Utilities */
|
|
620
629
|
export function nearestPowerOfTwo(value: number): number;
|
|
621
630
|
/** Returns true if two axis aligned bounding boxes are overlapping
|
|
622
|
-
* @param {Vector2}
|
|
623
|
-
* @param {Vector2} sizeA
|
|
624
|
-
* @param {Vector2}
|
|
625
|
-
* @param {Vector2} [sizeB=(0,0)]
|
|
626
|
-
* @return {Boolean}
|
|
631
|
+
* @param {Vector2} posA - Center of box A
|
|
632
|
+
* @param {Vector2} sizeA - Size of box A
|
|
633
|
+
* @param {Vector2} posB - Center of box B
|
|
634
|
+
* @param {Vector2} [sizeB=(0,0)] - Size of box B, a point if undefined
|
|
635
|
+
* @return {Boolean} - True if overlapping
|
|
627
636
|
* @memberof Utilities */
|
|
628
|
-
export function isOverlapping(
|
|
637
|
+
export function isOverlapping(posA: Vector2, sizeA: Vector2, posB: Vector2, sizeB?: Vector2): boolean;
|
|
629
638
|
/** Returns an oscillating wave between 0 and amplitude with frequency of 1 Hz by default
|
|
630
639
|
* @param {Number} [frequency] - Frequency of the wave in Hz
|
|
631
640
|
* @param {Number} [amplitude] - Amplitude (max height) of the wave
|
|
@@ -888,7 +897,7 @@ declare module "littlejs.esm" {
|
|
|
888
897
|
* @param {Number} [alphaAmount]
|
|
889
898
|
* @return {Color} */
|
|
890
899
|
mutate(amount?: number, alphaAmount?: number): Color;
|
|
891
|
-
/** Returns this color expressed as a
|
|
900
|
+
/** Returns this color expressed as a rgb color code
|
|
892
901
|
* @param {Boolean} [useAlpha] - if alpha should be included in result
|
|
893
902
|
* @return {String} */
|
|
894
903
|
toString(useAlpha?: boolean): string;
|
|
@@ -1103,9 +1112,9 @@ declare module "littlejs.esm" {
|
|
|
1103
1112
|
* @param {Color} [additiveColor=(0,0,0,0)] - Additive color to be applied
|
|
1104
1113
|
* @param {Boolean} [useWebGL=glEnable] - Use accelerated WebGL rendering
|
|
1105
1114
|
* @param {Boolean} [screenSpace=false] - If true the pos and size are in screen space
|
|
1106
|
-
* @param {CanvasRenderingContext2D} [context] - Canvas 2D context to draw to
|
|
1115
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context] - Canvas 2D context to draw to
|
|
1107
1116
|
* @memberof Draw */
|
|
1108
|
-
export function drawTile(pos: Vector2, size?: Vector2, tileInfo?: TileInfo, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1117
|
+
export function drawTile(pos: Vector2, size?: Vector2, tileInfo?: TileInfo, color?: Color, angle?: number, mirror?: boolean, additiveColor?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1109
1118
|
/** Draw colored rect centered on pos
|
|
1110
1119
|
* @param {Vector2} pos
|
|
1111
1120
|
* @param {Vector2} [size=(1,1)]
|
|
@@ -1113,9 +1122,9 @@ declare module "littlejs.esm" {
|
|
|
1113
1122
|
* @param {Number} [angle]
|
|
1114
1123
|
* @param {Boolean} [useWebGL=glEnable]
|
|
1115
1124
|
* @param {Boolean} [screenSpace=false]
|
|
1116
|
-
* @param {CanvasRenderingContext2D} [context]
|
|
1125
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1117
1126
|
* @memberof Draw */
|
|
1118
|
-
export function drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1127
|
+
export function drawRect(pos: Vector2, size?: Vector2, color?: Color, angle?: number, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1119
1128
|
/** Draw colored line between two points
|
|
1120
1129
|
* @param {Vector2} posA
|
|
1121
1130
|
* @param {Vector2} posB
|
|
@@ -1123,9 +1132,9 @@ declare module "littlejs.esm" {
|
|
|
1123
1132
|
* @param {Color} [color=(1,1,1,1)]
|
|
1124
1133
|
* @param {Boolean} [useWebGL=glEnable]
|
|
1125
1134
|
* @param {Boolean} [screenSpace=false]
|
|
1126
|
-
* @param {CanvasRenderingContext2D} [context]
|
|
1135
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context]
|
|
1127
1136
|
* @memberof Draw */
|
|
1128
|
-
export function drawLine(posA: Vector2, posB: Vector2, thickness?: number, color?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1137
|
+
export function drawLine(posA: Vector2, posB: Vector2, thickness?: number, color?: Color, useWebGL?: boolean, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1129
1138
|
/** Draw directly to a 2d canvas context in world space
|
|
1130
1139
|
* @param {Vector2} pos
|
|
1131
1140
|
* @param {Vector2} size
|
|
@@ -1133,15 +1142,15 @@ declare module "littlejs.esm" {
|
|
|
1133
1142
|
* @param {Boolean} mirror
|
|
1134
1143
|
* @param {Function} drawFunction
|
|
1135
1144
|
* @param {Boolean} [screenSpace=false]
|
|
1136
|
-
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1145
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1137
1146
|
* @memberof Draw */
|
|
1138
|
-
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, screenSpace?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1147
|
+
export function drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function, screenSpace?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1139
1148
|
/** Enable normal or additive blend mode
|
|
1140
1149
|
* @param {Boolean} [additive]
|
|
1141
1150
|
* @param {Boolean} [useWebGL=glEnable]
|
|
1142
|
-
* @param {CanvasRenderingContext2D} [context=mainContext]
|
|
1151
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
|
|
1143
1152
|
* @memberof Draw */
|
|
1144
|
-
export function setBlendMode(additive?: boolean, useWebGL?: boolean, context?: CanvasRenderingContext2D): void;
|
|
1153
|
+
export function setBlendMode(additive?: boolean, useWebGL?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1145
1154
|
/** Draw text on overlay canvas in screen space
|
|
1146
1155
|
* Automatically splits new lines into rows
|
|
1147
1156
|
* @param {String} text
|
|
@@ -1152,9 +1161,9 @@ declare module "littlejs.esm" {
|
|
|
1152
1161
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1153
1162
|
* @param {CanvasTextAlign} [textAlign]
|
|
1154
1163
|
* @param {String} [font=fontDefault]
|
|
1155
|
-
* @param {CanvasRenderingContext2D} [context=overlayContext]
|
|
1164
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
|
|
1156
1165
|
* @memberof Draw */
|
|
1157
|
-
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, context?: CanvasRenderingContext2D): void;
|
|
1166
|
+
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1158
1167
|
/** Draw text on overlay canvas in world space
|
|
1159
1168
|
* Automatically splits new lines into rows
|
|
1160
1169
|
* @param {String} text
|
|
@@ -1165,9 +1174,9 @@ declare module "littlejs.esm" {
|
|
|
1165
1174
|
* @param {Color} [lineColor=(0,0,0,1)]
|
|
1166
1175
|
* @param {CanvasTextAlign} [textAlign='center']
|
|
1167
1176
|
* @param {String} [font=fontDefault]
|
|
1168
|
-
* @param {CanvasRenderingContext2D} [context=overlayContext]
|
|
1177
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
|
|
1169
1178
|
* @memberof Draw */
|
|
1170
|
-
export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, context?: CanvasRenderingContext2D): void;
|
|
1179
|
+
export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1171
1180
|
export let engineFontImage: any;
|
|
1172
1181
|
/**
|
|
1173
1182
|
* Font Image Object - Draw text on a 2D canvas by using characters in an image
|
|
@@ -1186,13 +1195,13 @@ declare module "littlejs.esm" {
|
|
|
1186
1195
|
* @param {HTMLImageElement} [image] - Image for the font, if undefined default font is used
|
|
1187
1196
|
* @param {Vector2} [tileSize=(8,8)] - Size of the font source tiles
|
|
1188
1197
|
* @param {Vector2} [paddingSize=(0,1)] - How much extra space to add between characters
|
|
1189
|
-
* @param {CanvasRenderingContext2D} [context=overlayContext] - context to draw to
|
|
1198
|
+
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext] - context to draw to
|
|
1190
1199
|
*/
|
|
1191
|
-
constructor(image?: HTMLImageElement, tileSize?: Vector2, paddingSize?: Vector2, context?: CanvasRenderingContext2D);
|
|
1200
|
+
constructor(image?: HTMLImageElement, tileSize?: Vector2, paddingSize?: Vector2, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D);
|
|
1192
1201
|
image: any;
|
|
1193
1202
|
tileSize: Vector2;
|
|
1194
1203
|
paddingSize: Vector2;
|
|
1195
|
-
context: CanvasRenderingContext2D;
|
|
1204
|
+
context: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
1196
1205
|
/** Draw text in world space using the image font
|
|
1197
1206
|
* @param {String} text
|
|
1198
1207
|
* @param {Vector2} pos
|
|
@@ -1637,7 +1646,11 @@ declare module "littlejs.esm" {
|
|
|
1637
1646
|
collideSolidObjects: boolean;
|
|
1638
1647
|
/** @property {Boolean} - Object collides with and blocks other objects */
|
|
1639
1648
|
isSolid: boolean;
|
|
1640
|
-
/**
|
|
1649
|
+
/** @property {Boolean} - Object collides with raycasts */
|
|
1650
|
+
collideRaycast: boolean;
|
|
1651
|
+
/** Update the object transform, called automatically by engine even when paused */
|
|
1652
|
+
updateTransforms(): void;
|
|
1653
|
+
/** Update the object physics, called automatically by engine once each frame */
|
|
1641
1654
|
update(): void;
|
|
1642
1655
|
groundObject: any;
|
|
1643
1656
|
/** Render the object, draws a tile by default, automatically called each frame, sorted by renderOrder */
|
|
@@ -1650,11 +1663,6 @@ declare module "littlejs.esm" {
|
|
|
1650
1663
|
* @param {Vector2} pos - tile where the collision occured
|
|
1651
1664
|
* @return {Boolean} - true if the collision should be resolved */
|
|
1652
1665
|
collideWithTile(tileData: number, pos: Vector2): boolean;
|
|
1653
|
-
/** Called to check if a tile raycast hit
|
|
1654
|
-
* @param {Number} tileData - the value of the tile at the position
|
|
1655
|
-
* @param {Vector2} pos - tile where the raycast is
|
|
1656
|
-
* @return {Boolean} - true if the raycast should hit */
|
|
1657
|
-
collideWithTileRaycast(tileData: number, pos: Vector2): boolean;
|
|
1658
1666
|
/** Called to check if a object collision should be resolved
|
|
1659
1667
|
* @param {EngineObject} object - the object to test against
|
|
1660
1668
|
* @return {Boolean} - true if the collision should be resolved
|
|
@@ -1681,10 +1689,11 @@ declare module "littlejs.esm" {
|
|
|
1681
1689
|
* @param {EngineObject} child */
|
|
1682
1690
|
removeChild(child: EngineObject): void;
|
|
1683
1691
|
/** Set how this object collides
|
|
1684
|
-
* @param {Boolean} [collideSolidObjects] - Does it collide with solid objects
|
|
1685
|
-
* @param {Boolean} [isSolid] - Does it collide with and block other objects (expensive in large numbers)
|
|
1686
|
-
* @param {Boolean} [collideTiles] - Does it collide with the tile collision
|
|
1687
|
-
|
|
1692
|
+
* @param {Boolean} [collideSolidObjects] - Does it collide with solid objects?
|
|
1693
|
+
* @param {Boolean} [isSolid] - Does it collide with and block other objects? (expensive in large numbers)
|
|
1694
|
+
* @param {Boolean} [collideTiles] - Does it collide with the tile collision?
|
|
1695
|
+
* @param {Boolean} [collideRaycast] - Does it collide with raycasts? */
|
|
1696
|
+
setCollision(collideSolidObjects?: boolean, isSolid?: boolean, collideTiles?: boolean, collideRaycast?: boolean): void;
|
|
1688
1697
|
/** Returns string containg info about this object for debugging
|
|
1689
1698
|
* @return {String} */
|
|
1690
1699
|
toString(): string;
|
|
@@ -1729,7 +1738,7 @@ declare module "littlejs.esm" {
|
|
|
1729
1738
|
* @return {Boolean}
|
|
1730
1739
|
* @memberof TileCollision */
|
|
1731
1740
|
export function tileCollisionTest(pos: Vector2, size?: Vector2, object?: EngineObject): boolean;
|
|
1732
|
-
/** Return the center of tile
|
|
1741
|
+
/** Return the center of first tile hit (does not return the exact intersection)
|
|
1733
1742
|
* @param {Vector2} posStart
|
|
1734
1743
|
* @param {Vector2} posEnd
|
|
1735
1744
|
* @param {EngineObject} [object]
|
|
@@ -1787,22 +1796,13 @@ declare module "littlejs.esm" {
|
|
|
1787
1796
|
constructor(position?: Vector2, size?: Vector2, tileInfo?: TileInfo, scale?: Vector2, renderOrder?: number);
|
|
1788
1797
|
/** @property {HTMLCanvasElement} - The canvas used by this tile layer */
|
|
1789
1798
|
canvas: HTMLCanvasElement;
|
|
1790
|
-
/** @property {CanvasRenderingContext2D} - The 2D canvas context used by this tile layer */
|
|
1799
|
+
/** @property {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} - The 2D canvas context used by this tile layer */
|
|
1791
1800
|
context: CanvasRenderingContext2D;
|
|
1792
1801
|
/** @property {Vector2} - How much to scale this layer when rendered */
|
|
1793
1802
|
scale: Vector2;
|
|
1794
1803
|
/** @property {Boolean} - If true this layer will render to overlay canvas and appear above all objects */
|
|
1795
1804
|
isOverlay: boolean;
|
|
1796
1805
|
data: TileLayerData[];
|
|
1797
|
-
/** Set data at a given position in the array
|
|
1798
|
-
* @param {Vector2} layerPos - Local position in array
|
|
1799
|
-
* @param {TileLayerData} data - Data to set
|
|
1800
|
-
* @param {Boolean} [redraw] - Force the tile to redraw if true */
|
|
1801
|
-
setData(layerPos: Vector2, data: TileLayerData, redraw?: boolean): void;
|
|
1802
|
-
/** Get data at a given position in the array
|
|
1803
|
-
* @param {Vector2} layerPos - Local position in array
|
|
1804
|
-
* @return {TileLayerData} */
|
|
1805
|
-
getData(layerPos: Vector2): TileLayerData;
|
|
1806
1806
|
/** Draw all the tile data to an offscreen canvas
|
|
1807
1807
|
* - This may be slow in some browsers but only needs to be done once */
|
|
1808
1808
|
redraw(): void;
|
|
@@ -1810,8 +1810,6 @@ declare module "littlejs.esm" {
|
|
|
1810
1810
|
* - This can be used to manually update small parts of the level
|
|
1811
1811
|
* @param {Boolean} [clear] - Should it clear the canvas before drawing */
|
|
1812
1812
|
redrawStart(clear?: boolean): void;
|
|
1813
|
-
/** @type {[HTMLCanvasElement, CanvasRenderingContext2D, Vector2, Vector2, number]} */
|
|
1814
|
-
savedRenderSettings: [HTMLCanvasElement, CanvasRenderingContext2D, Vector2, Vector2, number];
|
|
1815
1813
|
/** Call to end the redraw process */
|
|
1816
1814
|
redrawEnd(): void;
|
|
1817
1815
|
/** Draw the tile at a given position in the tile grid
|
|
@@ -1828,6 +1826,17 @@ declare module "littlejs.esm" {
|
|
|
1828
1826
|
* @param {Boolean} mirror
|
|
1829
1827
|
* @param {Function} drawFunction */
|
|
1830
1828
|
drawCanvas2D(pos: Vector2, size: Vector2, angle: number, mirror: boolean, drawFunction: Function): void;
|
|
1829
|
+
/** Set data at a given position in the array
|
|
1830
|
+
* @param {Vector2} layerPos - Local position in array
|
|
1831
|
+
* @param {TileLayerData} data - Data to set
|
|
1832
|
+
* @param {Boolean} [redraw] - Force the tile to redraw if true */
|
|
1833
|
+
setData(layerPos: Vector2, data: TileLayerData, redraw?: boolean): void;
|
|
1834
|
+
/** Get data at a given position in the array
|
|
1835
|
+
* @param {Vector2} layerPos - Local position in array
|
|
1836
|
+
* @return {TileLayerData} */
|
|
1837
|
+
getData(layerPos: Vector2): TileLayerData;
|
|
1838
|
+
/** @type {[HTMLCanvasElement, CanvasRenderingContext2D, Vector2, Vector2, number]} */
|
|
1839
|
+
savedRenderSettings: [HTMLCanvasElement, CanvasRenderingContext2D, Vector2, Vector2, number];
|
|
1831
1840
|
/** Draw a tile directly onto the layer canvas in world space
|
|
1832
1841
|
* @param {Vector2} pos
|
|
1833
1842
|
* @param {Vector2} [size=(1,1)]
|
|
@@ -1950,22 +1959,23 @@ declare module "littlejs.esm" {
|
|
|
1950
1959
|
*/
|
|
1951
1960
|
export class Particle extends EngineObject {
|
|
1952
1961
|
/**
|
|
1953
|
-
* Create a particle with the
|
|
1954
|
-
*
|
|
1955
|
-
* @param {
|
|
1956
|
-
* @param {
|
|
1957
|
-
* @param {
|
|
1958
|
-
* @param {Color}
|
|
1959
|
-
* @param {
|
|
1960
|
-
* @param {Number}
|
|
1961
|
-
* @param {Number}
|
|
1962
|
-
* @param {Number}
|
|
1963
|
-
* @param {
|
|
1964
|
-
* @param {
|
|
1962
|
+
* Create a particle with the passed in settings
|
|
1963
|
+
* Typically this is created automatically by a ParticleEmitter
|
|
1964
|
+
* @param {Vector2} position - World space position of the particle
|
|
1965
|
+
* @param {TileInfo} tileInfo - Tile info to render particles
|
|
1966
|
+
* @param {Number} angle - Angle to rotate the particle
|
|
1967
|
+
* @param {Color} colorStart - Color at start of life
|
|
1968
|
+
* @param {Color} colorEnd - Color at end of life
|
|
1969
|
+
* @param {Number} lifeTime - How long to live for
|
|
1970
|
+
* @param {Number} sizeStart - Size at start of life
|
|
1971
|
+
* @param {Number} sizeEnd - Size at end of life
|
|
1972
|
+
* @param {Number} fadeRate - How quick to fade in/out
|
|
1973
|
+
* @param {Boolean} additive - Does it use additive blend mode
|
|
1974
|
+
* @param {Number} trailScale - If a trail, how long to make it
|
|
1965
1975
|
* @param {ParticleEmitter} [localSpaceEmitter] - Parent emitter if local space
|
|
1966
|
-
* @param {Function}
|
|
1976
|
+
* @param {Function} [destroyCallback] - Callback when particle dies
|
|
1967
1977
|
*/
|
|
1968
|
-
constructor(position: Vector2, tileInfo
|
|
1978
|
+
constructor(position: Vector2, tileInfo: TileInfo, angle: number, colorStart: Color, colorEnd: Color, lifeTime: number, sizeStart: number, sizeEnd: number, fadeRate: number, additive: boolean, trailScale: number, localSpaceEmitter?: ParticleEmitter, destroyCallback?: Function);
|
|
1969
1979
|
/** @property {Color} - Color at start of life */
|
|
1970
1980
|
colorStart: Color;
|
|
1971
1981
|
/** @property {Color} - Calculated change in color */
|