melonjs 20.12.0 → 20.14.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/README.md +66 -22
- package/build/application/application.d.ts +6 -1
- package/build/application/application.d.ts.map +1 -1
- package/build/application/header.d.ts.map +1 -1
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/settings.d.ts +13 -8
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +8 -4
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend/engine.d.ts.map +1 -1
- package/build/audio/playback.d.ts +2 -2
- package/build/audio/playback.d.ts.map +1 -1
- package/build/audio/spatial.d.ts.map +1 -1
- package/build/audio/types.d.ts +15 -5
- package/build/audio/types.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +12 -9
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +11 -8
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/camera/effects/fade_effect.d.ts.map +1 -1
- package/build/geometries/ellipse.d.ts +3 -0
- package/build/geometries/ellipse.d.ts.map +1 -1
- package/build/geometries/line.d.ts.map +1 -1
- package/build/geometries/path2d.d.ts +9 -8
- package/build/geometries/path2d.d.ts.map +1 -1
- package/build/geometries/polygon.d.ts +2 -1
- package/build/geometries/polygon.d.ts.map +1 -1
- package/build/index.d.ts +14 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +50215 -45051
- package/build/index.js.map +4 -4
- package/build/input/gamepad.d.ts.map +1 -1
- package/build/input/keyboard.d.ts.map +1 -1
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/level.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +50 -15
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts +14 -4
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/TMXUtils.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +1 -0
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXRenderer.d.ts +7 -3
- package/build/level/tiled/renderer/TMXRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXStaggeredRenderer.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +55 -0
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/cache.d.ts +146 -97
- package/build/loader/cache.d.ts.map +1 -1
- package/build/loader/internal-types.d.ts +69 -0
- package/build/loader/internal-types.d.ts.map +1 -0
- package/build/loader/loader.d.ts +589 -253
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/audio.d.ts.map +1 -1
- package/build/loader/parsers/fontface.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/tmx.d.ts.map +1 -1
- package/build/math/color.d.ts +4 -0
- package/build/math/color.d.ts.map +1 -1
- package/build/math/math.d.ts +6 -1
- package/build/math/math.d.ts.map +1 -1
- package/build/math/noise.d.ts +16 -16
- package/build/math/noise.d.ts.map +1 -1
- package/build/math/observableVector2d.d.ts +6 -6
- package/build/math/observableVector2d.d.ts.map +1 -1
- package/build/math/observableVector3d.d.ts +8 -8
- package/build/math/observableVector3d.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +15 -3
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +6 -0
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +22 -5
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +64 -25
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +23 -4
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts +25 -3
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/world.d.ts +40 -10
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +41 -6
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/draggable.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/instanced_mesh.d.ts +16 -14
- package/build/renderable/instanced_mesh.d.ts.map +1 -1
- package/build/renderable/mesh.d.ts +62 -5
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +4 -2
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +12 -3
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +147 -4
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/text/textmetrics.d.ts +10 -2
- package/build/renderable/text/textmetrics.d.ts.map +1 -1
- package/build/renderable/text/textstyle.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +5 -0
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/panelpaint.d.ts +5 -1
- package/build/renderable/ui/panelpaint.d.ts.map +1 -1
- package/build/renderable/ui/progressbar.d.ts +267 -95
- package/build/renderable/ui/progressbar.d.ts.map +1 -1
- package/build/renderable/ui/uibaseelement.d.ts +443 -50
- package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
- package/build/renderable/ui/uicheckbox.d.ts +383 -0
- package/build/renderable/ui/uicheckbox.d.ts.map +1 -0
- package/build/renderable/ui/uifocus.d.ts +6 -0
- package/build/renderable/ui/uifocus.d.ts.map +1 -0
- package/build/renderable/ui/uilabel.d.ts +31 -0
- package/build/renderable/ui/uilabel.d.ts.map +1 -0
- package/build/renderable/ui/uipanel.d.ts +589 -116
- package/build/renderable/ui/uipanel.d.ts.map +1 -1
- package/build/renderable/ui/uiskin.d.ts +25 -0
- package/build/renderable/ui/uiskin.d.ts.map +1 -0
- package/build/renderable/ui/uislider.d.ts +518 -0
- package/build/renderable/ui/uislider.d.ts.map +1 -0
- package/build/renderable/ui/uispriteelement.d.ts +161 -85
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/renderable/ui/uitextbutton.d.ts +369 -63
- package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -2
- package/build/system/device.d.ts.map +1 -1
- package/build/system/fullscreen.d.ts.map +1 -1
- package/build/system/pool.d.ts.map +1 -1
- package/build/system/save.d.ts +2 -1
- package/build/system/save.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +5 -2
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/utils/fetchdata.d.ts.map +1 -1
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +16 -19
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/canvas_factory.d.ts.map +1 -1
- package/build/video/effects/shadereffect.d.ts +127 -0
- package/build/video/effects/shadereffect.d.ts.map +1 -1
- package/build/video/renderer.d.ts +20 -4
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +26 -3
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/utils/tessellation.d.ts +11 -0
- package/build/video/utils/tessellation.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +3 -6
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgpu/webgpu_renderer.d.ts +3 -6
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/skills/melonjs/SKILL.md +41 -17
- package/skills/melonjs-20-migration/SKILL.md +50 -7
- package/skills/melonjs-3d/SKILL.md +138 -38
- package/skills/melonjs-3d-assets/SKILL.md +83 -33
- package/skills/melonjs-audio/SKILL.md +62 -19
- package/skills/melonjs-camera-and-drawing/SKILL.md +135 -8
- package/skills/melonjs-deployment/SKILL.md +92 -14
- package/skills/melonjs-display-and-scaling/SKILL.md +8 -3
- package/skills/melonjs-effects-and-shaders/SKILL.md +47 -15
- package/skills/melonjs-events/SKILL.md +6 -3
- package/skills/melonjs-getting-started/SKILL.md +6 -2
- package/skills/melonjs-input/SKILL.md +102 -16
- package/skills/melonjs-lighting/SKILL.md +13 -1
- package/skills/melonjs-loading-assets/SKILL.md +255 -39
- package/skills/melonjs-math/SKILL.md +26 -8
- package/skills/melonjs-particles-and-trails/SKILL.md +77 -9
- package/skills/melonjs-performance/SKILL.md +18 -8
- package/skills/melonjs-physics/SKILL.md +435 -128
- package/skills/melonjs-plugins/SKILL.md +50 -11
- package/skills/melonjs-renderables/SKILL.md +31 -7
- package/skills/melonjs-renderer-backends/SKILL.md +38 -17
- package/skills/melonjs-scenes-and-state/SKILL.md +45 -5
- package/skills/melonjs-sprites-and-animation/SKILL.md +37 -2
- package/skills/melonjs-tilemaps/SKILL.md +149 -17
- package/skills/melonjs-ui-and-text/SKILL.md +674 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderable.d.ts","sourceRoot":"","sources":["../../src/renderable/renderable.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderable.d.ts","sourceRoot":"","sources":["../../src/renderable/renderable.js"],"names":[],"mappings":"AA8pDA;;;;;;;;;;;;;;;;;GAiBG;AACH,iDAJW,UAAU,QAiCpB;AAvpDD;;;GAGG;AAC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;;;;;;OAiDG;IACH,uBAfW,QAAQ,GAEN,QAAQ,CAsCpB;IAED;;;;;;OAMG;IACH,kBAFW,QAAQ,QAsGlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IAEH,eATW,QAAQ,aACR,QAAQ,GAAC,SAAS,QAU5B;IAED;;;;;OAKG;IACH,mBAFW,QAAQ,QAqBlB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IAEH,sBAfW,OAAO,wBAAwB,EAAE,OAAO,SACxC,UAAU,GACR,OAAO,CAqBnB;IAkCD;;;;OAIG;IACH,8BA0EC;IAED;;;;;;;OAOG;IACH,yBAFc,GAAC,EAAA,QAId;IAED;;;;;;;;OAQG;IACH,0BAHc,GAAC,EAAA,QAKd;IAED;;;;;;;OAOG;IACH,4BAHc,GAAC,EAAA,QAKd;CACD;qBA3pDoB,8BAA8B;gCADnB,kCAAkC;yBAKzC,qBAAqB;iCAwBhB,uBAAuB;2BAd3B,gBAAgB;wBADnB,oBAAoB;+BAKf,8BAA8B;6BADhC,0BAA0B;0BAF7B,yBAAyB;6BACtB,4BAA4B;0BAU7B,4BAA4B;8BAGxB,kCAAkC;8BAEpC,qBAAqB;2BANxB,kBAAkB;6BANd,iCAAiC;8BAQlC,qBAAqB;8BAGrB,qBAAqB;4BAPvB,sBAAsB;0BAStB,sBAAsB;0BARtB,uBAAuB"}
|
|
@@ -244,13 +244,15 @@ export default class Sprite extends Renderable {
|
|
|
244
244
|
/**
|
|
245
245
|
* make the object flicker
|
|
246
246
|
* @param {number} duration - expressed in milliseconds
|
|
247
|
-
* @param {Function} [callback] - Function to call when flickering ends
|
|
247
|
+
* @param {Function} [callback] - Function to call when flickering ends,
|
|
248
|
+
* with `this` set to the sprite. The flicker has already stopped when it
|
|
249
|
+
* runs, so the callback can start another one.
|
|
248
250
|
* @returns {Sprite} Reference to this object for method chaining
|
|
249
251
|
* @example
|
|
250
252
|
* // make the object flicker for 1 second
|
|
251
253
|
* // and then remove it
|
|
252
254
|
* this.flicker(1000, function () {
|
|
253
|
-
*
|
|
255
|
+
* this.ancestor.removeChild(this);
|
|
254
256
|
* });
|
|
255
257
|
*/
|
|
256
258
|
flicker(duration: number, callback?: Function): Sprite;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprite.d.ts","sourceRoot":"","sources":["../../src/renderable/sprite.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AAEH;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,eA5CW,MAAM,KACN,MAAM,YAEd;QAAoH,KAAK,EAAjH,gBAAgB,GAAC,iBAAiB,GAAC,gBAAgB,GAAC,SAAS,GAAC,YAAY,GAAC,eAAe,GAAC,MAAM;QAC/E,IAAI;QACJ,MAAM;QACN,UAAU;QACV,WAAW;QACL,IAAI;QACV,KAAK;QACL,KAAK;QACwB,WAAW;eAAvC,MAAM;eAAG,MAAM;;QACyD,SAAS;QAClF,OAAO;QACP,SAAS;KACnC,EAyaF;IAzXA;;;OAGG;IACH,2BAEE;IAEF;;;;OAIG;IACH,QAHU,QAAQ,CAGkB;IAEpC;;;;OAIG;IACH,SAHU,OAAO,CAGG;IAEpB;;;;OAIG;IAGH;;;OAGG;IACH,QAFU,YAAY,CAEJ;IAElB;;;;;OAKG;IACH,wFAAsB;IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,WA3BU,MAAM,CA2BE;IAElB;;;;OAIG;IACH;;;;;MAKC;IAKA,sGAAqC;IACrC,kBAAkC;IA2TpC,0BANU,OAAO,EAQhB;IAVD;;;;OAIG;IACH,sBAHU,OAAO,CAKhB;IApQE;;;;OAIG;IACH,mDAKE;IAYF;;;OAGG;IACH,2CAAgC;IAChC;;;;OAIG;IACH,uCAA8B;IAC9B;;;;OAIG;IACH,sCAA0B;IAC1B;;;;OAIG;IACH,gDAAsC;IASpC;;;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ACH,mBAzBW,MAAM,SACN,MAAM,EAAE,GAAC,MAAM,EAAE,GAAC,MAAM,EAAE,mBAC1B,MAAM,GACJ,MAAM,CAwBlB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACH,0BA9CW,MAAM,cACN,MAAM,cAAU,MAAM,gBACtB,OAAO,GACL,MAAM,CA8ClB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,GACJ,MAAM,CASlB;IAED;;;;;;;;OAQG;IACH,yBAPW,MAAM,GACJ,OAAO,CAQnB;IAED;;;;;;;;OAQG;IACH,qBANa,MAAM,EAAE,CAQpB;IAED;;;;;;;;OAQG;IACH,kBANW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;OAOG;IACH,oBAJW,MAAM,QA2ChB;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,GACJ,MAAM,CAQlB;IAED;;;OAGG;IACH,4BAFa,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,mCAHW,MAAM,GACJ,MAAM,CAIlB;IA6FD;;;OAGG;IACH,eAFW,QAAQ,QAsDlB;IAED;;;;;;;;OAQG;IACH,mBAqBC;IAED;;;;;OAKG;IACH,2BAkBC;IAED;;;;OAIG;IACH,yBAIC;IAED;;;OAGG;IACH,oCAYC;IAED;;;;OAIG;IACH,gBA0BC;CACD;uBA7oCsB,iBAAiB;2BADb,qBAAqB;8BAarB,qBAAqB;kCADjB,6BAA6B;qCAG1B,2DAA2D;0BADpE,wBAAwB;sBAhB3B,iCAAiC;sBAHjC,kBAAkB"}
|
|
@@ -77,6 +77,8 @@ export default class BitmapText extends Renderable {
|
|
|
77
77
|
/**
|
|
78
78
|
* Set the text baseline (e.g. the Y-coordinate for the draw operation), <br>
|
|
79
79
|
* possible values are "top", "hanging", "middle", "alphabetic", "ideographic", "bottom"<br>
|
|
80
|
+
* A multi-line text is placed as one block: its top, middle or bottom is at
|
|
81
|
+
* `pos.y` ("alphabetic" and "ideographic" place it like "bottom").
|
|
80
82
|
* @public
|
|
81
83
|
* @type {string}
|
|
82
84
|
* @default "top"
|
|
@@ -93,6 +95,8 @@ export default class BitmapText extends Renderable {
|
|
|
93
95
|
/**
|
|
94
96
|
* the maximum length in CSS pixel for a single segment of text.
|
|
95
97
|
* (use -1 to disable word wrapping)
|
|
98
|
+
* Each `\n`-separated line is wrapped on its own, so explicit line breaks
|
|
99
|
+
* are kept; a word wider than this gets a line of its own.
|
|
96
100
|
* @public
|
|
97
101
|
* @type {number}
|
|
98
102
|
* @default -1
|
|
@@ -246,15 +250,20 @@ export default class BitmapText extends Renderable {
|
|
|
246
250
|
*/
|
|
247
251
|
resize(scale: number): this;
|
|
248
252
|
/**
|
|
249
|
-
* measure the given text size in pixels
|
|
250
|
-
*
|
|
253
|
+
* measure the given text size in pixels.
|
|
254
|
+
*
|
|
255
|
+
* With no argument it measures the label's own text and returns the
|
|
256
|
+
* label's own metrics. Given another text, it measures it in this label's
|
|
257
|
+
* font and scale and returns a new TextMetrics for it, leaving the label's
|
|
258
|
+
* own metrics, bounds and drawing as they were.
|
|
259
|
+
* @param {string|string[]} [text] - the text to be measured, the label's own by default
|
|
251
260
|
* @returns {TextMetrics} a TextMetrics object with two properties: `width` and `height`, defining the output dimensions
|
|
252
261
|
* @example
|
|
253
262
|
* // size a panel around a label, at the label's CURRENT scale
|
|
254
263
|
* const size = label.measureText();
|
|
255
264
|
* panel.resize(size.width + 16, size.height + 16);
|
|
256
265
|
*/
|
|
257
|
-
measureText(text?: string): TextMetrics;
|
|
266
|
+
measureText(text?: string | string[]): TextMetrics;
|
|
258
267
|
/**
|
|
259
268
|
* draw the bitmap font
|
|
260
269
|
* @param {Renderer} renderer - Reference to the destination renderer instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitmaptext.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/bitmaptext.js"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH;;;;;;;;;GASG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,eA/BW,MAAM,KACN,MAAM,YAEd;QAA+B,IAAI,EAA3B,MAAM,8DAAM;QACM,QAAQ;QACR,IAAI;QACE,SAAS;QACf,SAAS;QACT,YAAY;QACZ,UAAU;QACmB,WAAW;eAAvC,MAAM;eAAG,MAAM;;QAChB,aAAa;QACH,WAAW;QACV,IAAI;KACzC,
|
|
1
|
+
{"version":3,"file":"bitmaptext.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/bitmaptext.js"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH;;;;;;;;;GASG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,eA/BW,MAAM,KACN,MAAM,YAEd;QAA+B,IAAI,EAA3B,MAAM,8DAAM;QACM,QAAQ;QACR,IAAI;QACE,SAAS;QACf,SAAS;QACT,YAAY;QACZ,UAAU;QACmB,WAAW;eAAvC,MAAM;eAAG,MAAM;;QAChB,aAAa;QACH,WAAW;QACV,IAAI;KACzC,EAqJF;IAhIA;;;;;;OAMG;IACH,kBAHU,MAAM,CAG6B;IAE7C;;;;;;;;OAQG;IACH,qBAHU,MAAM,CAGkC;IAElD;;;;;;OAMG;IACH,mBAHU,MAAM,CAG4B;IAE5C;;;;;;;;OAQG;IACH,sBAHU,MAAM,CAGiC;IAEjD;;;;;OAKG;IACH,cAAe;IAEf;;;OAGG;IACH,kBAA2C;IAE3C;;;OAGG;IACH,kBAG2B;IAG1B;;;OAGG;IAEH,iBAAgE;IAsUlE,4BAlBU,KAAK,EAyBd;IAjCD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,wBAfU,KAAK,CAiBd;IAtSA;;;OAGG;IACH,2BAA4B;IAG5B,qBAAoC;IAOpC,wCAAwC;IACxC,qBAAwB;IACxB,eAAe;IACf,yBAAyB;IACzB;;;;OAIG;IACH,0BAAkC;IA8GnC,wBAjCU,WAAW,GAAC,IAAI,EAoDzB;IA5ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACH,mBA7BU,WAAW,GAAC,IAAI,CA+BzB;IArGD;;;;;OAKG;IACH,eAJW,MAAM,UACN,MAAM,GACJ,UAAU,CAWtB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,MAAM,GAAC,MAAM,EAAE,GACpB,UAAU,CAwBtB;IAgFD,kBAAkB;IAClB,yBAMC;IAoBD,oCAdU,MAAM,EAmBf;IAvBD;;;;;;;;;;;;;OAaG;IACH,gCAVU,MAAM,CAYf;IAyBD,+BAZU,MAAM,EAsBf;IA1BD;;;;;OAKG;IACH,2BAFU,MAAM,CAUf;IAsGD;;;;;;;;;;OAUG;IACH,cATW,MAAM,GAEJ,IAAI,CAiBhB;IAED;;;;;;;;;;;;;OAaG;IACH,mBAPW,MAAM,GAAC,MAAM,EAAE,GACb,WAAW,CAavB;IAED;;;OAGG;IACH,eAFW,QAAQ,QA6GlB;IAED;;;;;;;;;;OAUG;IACH,yBA0CC;IAED;;;;OAIG;IACH,gBAUC;CACD;uBAtrBsB,kBAAkB;sBAHnB,qBAAqB;wBAKK,kBAAkB;iCASG,kBAAkB;0BAD9D,yBAAyB;8BAHvB,wBAAwB"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* a Text object: draws a string using a system or web font.
|
|
3
3
|
*
|
|
4
4
|
* The text is rasterised to a cached texture, so it draws as fast as a sprite
|
|
5
|
-
* while staying fully styleable — `fillStyle`, `strokeStyle` + `lineWidth
|
|
5
|
+
* while staying fully styleable — `fillStyle`, `strokeStyle` + `lineWidth`
|
|
6
|
+
* (with the outline behind or over the glyphs by `paintOrder`, and its corners
|
|
7
|
+
* set by `lineJoin` / `miterLimit`), and
|
|
6
8
|
* per-object opacity — with multi-line text (embedded `\n`), optional
|
|
7
9
|
* `wordWrapWidth` word-wrapping, and chainable {@link Text#bold} /
|
|
8
10
|
* {@link Text#italic}. `font` accepts any CSS family, including the generic
|
|
@@ -24,6 +26,9 @@ export default class Text extends Renderable {
|
|
|
24
26
|
* @param {boolean} [settings.gradientPerLine=true] - restart a gradient fill on every line; `false` spans one ramp across the whole block, as a plain canvas does
|
|
25
27
|
* @param {Color|string} [settings.strokeStyle="#000000"] - a CSS color value used for the glyph outline (drawn when `lineWidth` > 0)
|
|
26
28
|
* @param {number} [settings.lineWidth=0] - outline width in pixels (0 = no stroke)
|
|
29
|
+
* @param {"round"|"bevel"|"miter"} [settings.lineJoin="round"] - the shape of the outline's corners: "round", "bevel" or "miter" (pointed, as a plain canvas draws them)
|
|
30
|
+
* @param {number} [settings.miterLimit=10] - with a "miter" join, how far a corner may point, in half line widths, before it is cut flat
|
|
31
|
+
* @param {"stroke"|"fill"} [settings.paintOrder="stroke"] - what is painted first: "stroke" puts the outline behind the glyphs, so it shows only around them; "fill" puts it over them, where its inner half covers the glyph
|
|
27
32
|
* @param {string} [settings.textAlign="left"] - horizontal text alignment ("left", "center", "right")
|
|
28
33
|
* @param {string} [settings.textBaseline="top"] - the text baseline ("top", "hanging", "middle", "alphabetic", "ideographic", "bottom")
|
|
29
34
|
* @param {number} [settings.lineHeight=1.0] - line spacing height
|
|
@@ -66,6 +71,52 @@ export default class Text extends Renderable {
|
|
|
66
71
|
* // gradientPerLine: false, // ...or span ONE ramp across both lines
|
|
67
72
|
* }));
|
|
68
73
|
* @example
|
|
74
|
+
* // outlined text and its corners: the outline is centred on the glyph
|
|
75
|
+
* // edge and drawn behind it (see `paintOrder`), and its corners are set
|
|
76
|
+
* // by `lineJoin`
|
|
77
|
+
* const outline = {
|
|
78
|
+
* font: "sans-serif",
|
|
79
|
+
* size: 48,
|
|
80
|
+
* fillStyle: "#ffffff",
|
|
81
|
+
* strokeStyle: "#1d3557",
|
|
82
|
+
* lineWidth: 6,
|
|
83
|
+
* };
|
|
84
|
+
*
|
|
85
|
+
* // "round" (the default): the outline is the same width all around
|
|
86
|
+
* app.world.addChild(new Text(10, 10, { ...outline, text: "ROUND" }));
|
|
87
|
+
*
|
|
88
|
+
* // "bevel": corners cut flat
|
|
89
|
+
* app.world.addChild(new Text(10, 70, { ...outline, lineJoin: "bevel", text: "BEVEL" }));
|
|
90
|
+
*
|
|
91
|
+
* // "miter": pointed corners, as a plain canvas strokes text. At the
|
|
92
|
+
* // canvas's default limit of 10 a sharp glyph ("A", "V", "M") grows a
|
|
93
|
+
* // long spike...
|
|
94
|
+
* app.world.addChild(new Text(10, 130, { ...outline, lineJoin: "miter", text: "MITER" }));
|
|
95
|
+
*
|
|
96
|
+
* // ...which `miterLimit` caps: a corner that would point further than
|
|
97
|
+
* // this many half line widths is cut flat instead
|
|
98
|
+
* app.world.addChild(new Text(10, 190, { ...outline, lineJoin: "miter", miterLimit: 3, text: "MITER 3" }));
|
|
99
|
+
*
|
|
100
|
+
* // whichever is set, the whole outline is drawn: the label's texture
|
|
101
|
+
* // grows to hold it, while its position and bounds stay the same
|
|
102
|
+
* @example
|
|
103
|
+
* // the outline behind the glyphs, or over them, with `paintOrder`
|
|
104
|
+
* const label = {
|
|
105
|
+
* font: "sans-serif",
|
|
106
|
+
* size: 48,
|
|
107
|
+
* fillStyle: "#ffd23f",
|
|
108
|
+
* strokeStyle: "#1b1b1b",
|
|
109
|
+
* lineWidth: 6,
|
|
110
|
+
* };
|
|
111
|
+
*
|
|
112
|
+
* // "stroke" (the default): the outline is painted first, behind the
|
|
113
|
+
* // glyphs, so they stay whole and it shows only around them
|
|
114
|
+
* app.world.addChild(new Text(10, 10, { ...label, text: "BEHIND" }));
|
|
115
|
+
*
|
|
116
|
+
* // "fill": the glyphs first and the outline over them, centred on their
|
|
117
|
+
* // edge, so its inner half covers them: a thick one hides them
|
|
118
|
+
* app.world.addChild(new Text(10, 70, { ...label, paintOrder: "fill", text: "OVER" }));
|
|
119
|
+
* @example
|
|
69
120
|
* // a web font (loaded via the fontface loader) is used by its family name
|
|
70
121
|
* loader.preload(
|
|
71
122
|
* [{ name: "kenpixel", type: "fontface", src: "data/font/kenvector.woff2" }],
|
|
@@ -83,6 +134,9 @@ export default class Text extends Renderable {
|
|
|
83
134
|
gradientPerLine?: boolean | undefined;
|
|
84
135
|
strokeStyle?: string | Color | undefined;
|
|
85
136
|
lineWidth?: number | undefined;
|
|
137
|
+
lineJoin?: "round" | "bevel" | "miter" | undefined;
|
|
138
|
+
miterLimit?: number | undefined;
|
|
139
|
+
paintOrder?: "fill" | "stroke" | undefined;
|
|
86
140
|
textAlign?: string | undefined;
|
|
87
141
|
textBaseline?: string | undefined;
|
|
88
142
|
lineHeight?: number | undefined;
|
|
@@ -113,6 +167,86 @@ export default class Text extends Renderable {
|
|
|
113
167
|
* @default 0
|
|
114
168
|
*/
|
|
115
169
|
lineWidth: number;
|
|
170
|
+
/**
|
|
171
|
+
* The shape of the outline's corners, where the stroke turns on a
|
|
172
|
+
* glyph: "round", "bevel" (cut flat) or "miter" (pointed). The
|
|
173
|
+
* canvas's own default is "miter", which on a thick outline grows
|
|
174
|
+
* long spikes from sharp glyphs such as "A", "V" or "M"; "round"
|
|
175
|
+
* keeps the outline the same width all around, as most game text
|
|
176
|
+
* outlines are.
|
|
177
|
+
*
|
|
178
|
+
* The text is baked with room for whichever is set, so no corner is
|
|
179
|
+
* cut: "miter" takes more, up to {@link Text#miterLimit} half line
|
|
180
|
+
* widths around the text.
|
|
181
|
+
*
|
|
182
|
+
* Like the other style properties, a change shows from the next
|
|
183
|
+
* {@link Text#setText}.
|
|
184
|
+
* @type {"round"|"bevel"|"miter"}
|
|
185
|
+
* @default "round"
|
|
186
|
+
* @example
|
|
187
|
+
* // sharp, pointed corners, as a plain canvas strokes them
|
|
188
|
+
* const title = new Text(0, 0, {
|
|
189
|
+
* font: "sans-serif",
|
|
190
|
+
* size: 48,
|
|
191
|
+
* fillStyle: "#ffffff",
|
|
192
|
+
* strokeStyle: "#000000",
|
|
193
|
+
* lineWidth: 6,
|
|
194
|
+
* lineJoin: "miter",
|
|
195
|
+
* miterLimit: 3, // and no spike past 3 half widths
|
|
196
|
+
* text: "VICTORY",
|
|
197
|
+
* });
|
|
198
|
+
*/
|
|
199
|
+
lineJoin: "round" | "bevel" | "miter";
|
|
200
|
+
/**
|
|
201
|
+
* With a "miter" {@link Text#lineJoin}: how far a corner of the
|
|
202
|
+
* outline may point, in half line widths, before it is cut flat
|
|
203
|
+
* instead. The canvas's default, 10, lets sharp glyphs grow long
|
|
204
|
+
* spikes; 2 to 4 keeps most corners pointed and the spikes short.
|
|
205
|
+
* Has no effect with "round" or "bevel" joins. A value the canvas
|
|
206
|
+
* would refuse (zero, negative, infinite or NaN) draws with 10.
|
|
207
|
+
*
|
|
208
|
+
* Like the other style properties, a change shows from the next
|
|
209
|
+
* {@link Text#setText}.
|
|
210
|
+
* @type {number}
|
|
211
|
+
* @default 10
|
|
212
|
+
* @example
|
|
213
|
+
* // pointed corners with short spikes
|
|
214
|
+
* label.lineJoin = "miter";
|
|
215
|
+
* label.miterLimit = 2;
|
|
216
|
+
* label.setText("VICTORY"); // re-bakes with the new corners
|
|
217
|
+
*/
|
|
218
|
+
miterLimit: number;
|
|
219
|
+
/**
|
|
220
|
+
* What is painted first, the outline ("stroke") or the glyphs
|
|
221
|
+
* ("fill"), as the CSS and SVG `paint-order` property says it.
|
|
222
|
+
*
|
|
223
|
+
* The outline is centred on the glyph's edge, so half of it lies
|
|
224
|
+
* inside the glyph. With "stroke", the default, the outline is
|
|
225
|
+
* painted first and the glyphs over it: they stay whole, and the
|
|
226
|
+
* outline shows only around them, at half its `lineWidth`. With
|
|
227
|
+
* "fill", the glyphs are painted first and the outline over them,
|
|
228
|
+
* as a plain canvas does with `fillText` then `strokeText`: its inner
|
|
229
|
+
* half covers the glyph, so a thick outline, or a thin face, hides
|
|
230
|
+
* the letters.
|
|
231
|
+
*
|
|
232
|
+
* Either way the outline reaches as far out, and the label's size and
|
|
233
|
+
* bounds are the same. Like the other style properties, a change
|
|
234
|
+
* shows from the next {@link Text#setText}.
|
|
235
|
+
* @type {"stroke"|"fill"}
|
|
236
|
+
* @default "stroke"
|
|
237
|
+
* @example
|
|
238
|
+
* // the outline over the glyphs, as melonJS drew it before 20.13
|
|
239
|
+
* const label = new Text(0, 0, {
|
|
240
|
+
* font: "sans-serif",
|
|
241
|
+
* size: 32,
|
|
242
|
+
* fillStyle: "#ffffff",
|
|
243
|
+
* strokeStyle: "#000000",
|
|
244
|
+
* lineWidth: 2,
|
|
245
|
+
* paintOrder: "fill",
|
|
246
|
+
* text: "SCORE",
|
|
247
|
+
* });
|
|
248
|
+
*/
|
|
249
|
+
paintOrder: "stroke" | "fill";
|
|
116
250
|
/**
|
|
117
251
|
* Set the default text alignment (or justification),<br>
|
|
118
252
|
* possible values are "left", "right", and "center".<br>
|
|
@@ -123,6 +257,8 @@ export default class Text extends Renderable {
|
|
|
123
257
|
/**
|
|
124
258
|
* Set the text baseline (e.g. the Y-coordinate for the draw operation), <br>
|
|
125
259
|
* possible values are "top", "hanging", "middle", "alphabetic", "ideographic", "bottom"<br>
|
|
260
|
+
* A multi-line text is placed as one block: its top, middle or bottom is at
|
|
261
|
+
* `pos.y` ("alphabetic" and "ideographic" place it like "bottom").
|
|
126
262
|
* @type {string}
|
|
127
263
|
* @default "top"
|
|
128
264
|
*/
|
|
@@ -137,6 +273,8 @@ export default class Text extends Renderable {
|
|
|
137
273
|
/**
|
|
138
274
|
* the maximum length in CSS pixel for a single segment of text.
|
|
139
275
|
* (use -1 to disable word wrapping)
|
|
276
|
+
* Each `\n`-separated line is wrapped on its own, so explicit line breaks
|
|
277
|
+
* are kept; a word wider than this gets a line of its own.
|
|
140
278
|
* @type {number}
|
|
141
279
|
* @default -1
|
|
142
280
|
*/
|
|
@@ -242,8 +380,13 @@ export default class Text extends Renderable {
|
|
|
242
380
|
*/
|
|
243
381
|
public get visibleRatio(): number;
|
|
244
382
|
/**
|
|
245
|
-
* measure the given text size in pixels
|
|
246
|
-
*
|
|
383
|
+
* measure the given text size in pixels.
|
|
384
|
+
*
|
|
385
|
+
* With no argument it measures the label's own text and returns the
|
|
386
|
+
* label's own metrics. Given another text, it measures it in this label's
|
|
387
|
+
* style and returns a new TextMetrics for it, leaving the label's own
|
|
388
|
+
* metrics, bounds and drawing as they were.
|
|
389
|
+
* @param {string|string[]} [text] - the text to be measured, the label's own by default
|
|
247
390
|
* @returns {TextMetrics} a TextMetrics object defining the dimensions of the given piece of text
|
|
248
391
|
* @example
|
|
249
392
|
* // size a panel around a label
|
|
@@ -254,7 +397,7 @@ export default class Text extends Renderable {
|
|
|
254
397
|
* // room for the widest state a counter will reach
|
|
255
398
|
* const widest = label.measureText("00:00").width;
|
|
256
399
|
*/
|
|
257
|
-
measureText(text?: string): TextMetrics;
|
|
400
|
+
measureText(text?: string | string[]): TextMetrics;
|
|
258
401
|
/**
|
|
259
402
|
* draw a text at the specified coord
|
|
260
403
|
* @param {Renderer} renderer - Reference to the destination renderer instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/text.js"],"names":[],"mappings":"AAiDA
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/text.js"],"names":[],"mappings":"AAiDA;;;;;;;;;;;;;;;;GAgBG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8GG;IACH,eA9GW,MAAM,KACN,MAAM,YAEd;QAAyB,IAAI,EAArB,MAAM;QACkB,IAAI,EAA5B,MAAM,GAAC,MAAM;QACoB,SAAS;QACvB,eAAe;QACV,WAAW;QACjB,SAAS;QACQ,QAAQ;QACzB,UAAU;QACD,UAAU;QACnB,SAAS;QACT,YAAY;QACZ,UAAU;QACmB,WAAW;eAAvC,MAAM;eAAG,MAAM;;QAChB,aAAa;QACZ,IAAI;QACJ,MAAM;QACI,IAAI;KACzC,EA2PF;IA7JA;;;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AAM,GAAC,MAAM,EAAE,GACb,WAAW,CAmBvB;IAED;;;OAGG;IACH,eAFW,QAAQ,QAsClB;IAED;;;OAGG;IACH,4EA+HC;IAED;;;;OAIG;IACH,gBAWC;CACD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wGAQG;uBAnhC8C,kBAAkB;sBANlC,qBAAqB;yBAE7B,yBAAyB;+BAEnB,gDAAgD;wBAG/B,kBAAkB;0BASzC,yBAAyB;8BAHvB,wBAAwB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
export default TextMetrics;
|
|
2
3
|
/**
|
|
3
4
|
* a Text Metrics object that contains helper for text manipulation
|
|
@@ -36,12 +37,19 @@ declare class TextMetrics extends Bounds {
|
|
|
36
37
|
glyphMaxBottom: number | undefined;
|
|
37
38
|
inkPadTop: number | undefined;
|
|
38
39
|
inkPadBottom: number | undefined;
|
|
40
|
+
inkPadLeft: number | undefined;
|
|
41
|
+
inkPadRight: number | undefined;
|
|
39
42
|
/**
|
|
40
|
-
* wrap the given text based on the given width
|
|
43
|
+
* wrap the given text based on the given width.
|
|
44
|
+
*
|
|
45
|
+
* Each `\n`-separated line (each entry, for an array) is wrapped on its
|
|
46
|
+
* own, so wrapping only ever adds line breaks: the explicit ones are kept,
|
|
47
|
+
* blank lines included. A line breaks between words, never inside one: a
|
|
48
|
+
* word wider than `width` is put on a line of its own and overflows it.
|
|
41
49
|
* @param {string|string[]} text - the text to be wrapped
|
|
42
50
|
* @param {number} width - maximum width of one segment of text in css pixel
|
|
43
51
|
* @param {CanvasRenderingContext2D} [context] - reference to an active 2d context for canvas rendering
|
|
44
|
-
* @returns {string[]} an array of string representing wrapped text
|
|
52
|
+
* @returns {string[]} an array of string representing wrapped text, one entry per line
|
|
45
53
|
*/
|
|
46
54
|
wordWrap(text: string | string[], width: number, context?: CanvasRenderingContext2D): string[];
|
|
47
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textmetrics.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/textmetrics.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"textmetrics.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/textmetrics.js"],"names":[],"mappings":"AA+BA;;;;;;;GAOG;AACH,gCALW,MAAM,GAAC,MAAM,GAAC,MAAM,EAAE,GAAC,IAAI,GACzB,MAAM,EAAE,CAWpB;AAED;;;;;;;;GAQG;AACH,6BANW,MAAM,EAAE,KACR,MAAM,EAAE,GACN,OAAO,CAcnB;;AAaD;;GAEG;AACH;IACC;;OAEG;IACH,sBAFW,IAAI,GAAC,UAAU,EAczB;IARA;;;;OAIG;IACH,UAHU,UAAU,CAGI;IAKzB;;;OAGG;IACH,cAFa,MAAM,CAalB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,YACN,wBAAwB,GACtB,MAAM,CA4BlB;IAED;;;;;OAKG;IACH,kBAJW,MAAM,YACN,wBAAwB,GACtB,WAAW,CAuJvB;IArHA,iCAAqB;IACrB,mCAAuB;IAyCvB,8BAAkB;IAClB,iCAAqB;IACrB,+BAAmB;IACnB,gCAAoB;IA0ErB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,gBAJa,WAAW,CAcvB;IAED;;;;;;;;;;;OAWG;IACH,cAJa,MAAM,CAclB;IAED;;;;;;;;;;;OAWG;IACH,eALW,MAAM,GAAC,MAAM,EAAE,SACf,MAAM,YACN,wBAAwB,GACtB,MAAM,EAAE,CA8CpB;CACD;uBAxasB,yBAAyB;4BAOrB,kBAAkB;iBAN5B,WAAW;4BAKD,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textstyle.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/textstyle.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"textstyle.d.ts","sourceRoot":"","sources":["../../../src/renderable/text/textstyle.js"],"names":[],"mappings":"AAwFA;;;;;;;;;;;;GAYG;AACH,mCALW,MAAM,GACJ,MAAM,CAclB;AAED;;;;;;;;GAQG;AACH,iDAPW,wBAAwB,SACxB,MAAM,GACJ,MAAM,GAAC,cAAc,CAgBjC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger an event when colliding with another object.
|
|
3
|
+
* Supports both fade and mask-based transitions when loading a new level.
|
|
4
|
+
* @category Game Objects
|
|
5
|
+
*/
|
|
1
6
|
export default class Trigger extends Renderable {
|
|
2
7
|
/**
|
|
3
8
|
* @param {number} x - the x coordinates of the trigger area
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"AA6DA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACH,eA9DW,MAAM,KACN,MAAM,YAEd;QAA0B,KAAK;QACL,MAAM;QACqB,MAAM;QACjC,QAAQ;QACF,KAAK;QACX,UAAU;QACD,KAAK;QACd,KAAK;QACL,EAAE;QACQ,SAAS;QACjB,QAAQ;QACT,OAAO;QACP,iBAAiB;QAClB,KAAK;QACJ,WAAW;QACX,MAAM;QACP,mBAAmB;QAClB,gBAAgB;QACjB,aAAa;QACb,aAAa;QACb,WAAW;QACX,YAAY;QACZ,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QACL,kBAAkB;QAC5B,WAAW;KACtC,EAyFF;IApDA,WAA4C;IAC5C,6BAAiC;IACjC,mBAA+C;IAC/C,+CAAqC;IACrC,gBAAmB;IAInB,UAAyB;IACzB,QAAqB;IACrB,8BAA4B;IAG5B;;MAEC;IAwBD;;;;;;MAMC;IASF;;;OAGG;IACH;;MAQC;IAED;;;OAGG;IACH,+BAwFC;IAED;;;;;OAKG;IACH,yBAIC;CACD;uBA5SsB,iBAAiB;6BAUd,0BAA0B;6BAH1B,0BAA0B;0BAI7B,4BAA4B;0BAH5B,uBAAuB;2BAHtB,kBAAkB;2BAChB,gBAAgB;8BAGf,qBAAqB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Color } from "../../math/color.ts";
|
|
2
2
|
import type { Gradient } from "../../video/gradient.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* A colour a widget is painted with: a CSS string, a {@link Color} (kept
|
|
5
|
+
* and read every frame, so changing it animates the widget), or a gradient.
|
|
6
|
+
* @category UI
|
|
7
|
+
*/
|
|
4
8
|
export type Paint = Color | string | Gradient;
|
|
5
9
|
//# sourceMappingURL=panelpaint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelpaint.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/panelpaint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAa,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD
|
|
1
|
+
{"version":3,"file":"panelpaint.d.ts","sourceRoot":"","sources":["../../../src/renderable/ui/panelpaint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAa,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGxD;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC"}
|