diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/ticker/index.js b/src/core/ticker/index.js index d4d2f40..c3020d4 100644 --- a/src/core/ticker/index.js +++ b/src/core/ticker/index.js @@ -57,6 +57,13 @@ * * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); * @namespace PIXI.ticker */ export { shared, Ticker }; diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/ticker/index.js b/src/core/ticker/index.js index d4d2f40..c3020d4 100644 --- a/src/core/ticker/index.js +++ b/src/core/ticker/index.js @@ -57,6 +57,13 @@ * * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); * @namespace PIXI.ticker */ export { shared, Ticker }; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index a0db0d9..582b24a 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -10,6 +10,20 @@ /** * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" * @namespace PIXI.utils */ export { diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/ticker/index.js b/src/core/ticker/index.js index d4d2f40..c3020d4 100644 --- a/src/core/ticker/index.js +++ b/src/core/ticker/index.js @@ -57,6 +57,13 @@ * * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); * @namespace PIXI.ticker */ export { shared, Ticker }; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index a0db0d9..582b24a 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -10,6 +10,20 @@ /** * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" * @namespace PIXI.utils */ export { diff --git a/src/extract/index.js b/src/extract/index.js index 031c859..e9478c1 100644 --- a/src/extract/index.js +++ b/src/extract/index.js @@ -4,6 +4,18 @@ * * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}. + * @example + * // Create a new app (will auto-add extract plugin to renderer) + * const app = new PIXI.Application(); + * + * // Draw a red circle + * const graphics = new PIXI.Graphics() + * .beginFill(0xFF0000) + * .drawCircle(0, 0, 50); + * + * // Render the graphics as an HTMLImageElement + * const image = app.renderer.plugins.extract.image(graphics); + * document.body.appendChild(image); * @namespace PIXI.extract */ export { default as webgl } from './webgl/WebGLExtract'; diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/ticker/index.js b/src/core/ticker/index.js index d4d2f40..c3020d4 100644 --- a/src/core/ticker/index.js +++ b/src/core/ticker/index.js @@ -57,6 +57,13 @@ * * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); * @namespace PIXI.ticker */ export { shared, Ticker }; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index a0db0d9..582b24a 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -10,6 +10,20 @@ /** * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" * @namespace PIXI.utils */ export { diff --git a/src/extract/index.js b/src/extract/index.js index 031c859..e9478c1 100644 --- a/src/extract/index.js +++ b/src/extract/index.js @@ -4,6 +4,18 @@ * * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}. + * @example + * // Create a new app (will auto-add extract plugin to renderer) + * const app = new PIXI.Application(); + * + * // Draw a red circle + * const graphics = new PIXI.Graphics() + * .beginFill(0xFF0000) + * .drawCircle(0, 0, 50); + * + * // Render the graphics as an HTMLImageElement + * const image = app.renderer.plugins.extract.image(graphics); + * document.body.appendChild(image); * @namespace PIXI.extract */ export { default as webgl } from './webgl/WebGLExtract'; diff --git a/src/filters/index.js b/src/filters/index.js index 01f63a2..7ceb50a 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -1,6 +1,21 @@ /** * This namespace contains WebGL-only display filters that can be applied * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. + * @example + * // Create a new application + * const app = new PIXI.Application(); + * + * // Draw a green rectangle + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add a blur filter + * rect.filters = [new PIXI.filters.BlurFilter()]; + * + * // Display rectangle + * app.stage.addChild(rect); + * document.body.appendChild(app.view); * @namespace PIXI.filters */ export { default as FXAAFilter } from './fxaa/FXAAFilter'; diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/ticker/index.js b/src/core/ticker/index.js index d4d2f40..c3020d4 100644 --- a/src/core/ticker/index.js +++ b/src/core/ticker/index.js @@ -57,6 +57,13 @@ * * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); * @namespace PIXI.ticker */ export { shared, Ticker }; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index a0db0d9..582b24a 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -10,6 +10,20 @@ /** * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" * @namespace PIXI.utils */ export { diff --git a/src/extract/index.js b/src/extract/index.js index 031c859..e9478c1 100644 --- a/src/extract/index.js +++ b/src/extract/index.js @@ -4,6 +4,18 @@ * * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}. + * @example + * // Create a new app (will auto-add extract plugin to renderer) + * const app = new PIXI.Application(); + * + * // Draw a red circle + * const graphics = new PIXI.Graphics() + * .beginFill(0xFF0000) + * .drawCircle(0, 0, 50); + * + * // Render the graphics as an HTMLImageElement + * const image = app.renderer.plugins.extract.image(graphics); + * document.body.appendChild(image); * @namespace PIXI.extract */ export { default as webgl } from './webgl/WebGLExtract'; diff --git a/src/filters/index.js b/src/filters/index.js index 01f63a2..7ceb50a 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -1,6 +1,21 @@ /** * This namespace contains WebGL-only display filters that can be applied * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. + * @example + * // Create a new application + * const app = new PIXI.Application(); + * + * // Draw a green rectangle + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add a blur filter + * rect.filters = [new PIXI.filters.BlurFilter()]; + * + * // Display rectangle + * app.stage.addChild(rect); + * document.body.appendChild(app.view); * @namespace PIXI.filters */ export { default as FXAAFilter } from './fxaa/FXAAFilter'; diff --git a/src/loaders/index.js b/src/loaders/index.js index f13d855..39669be 100644 --- a/src/loaders/index.js +++ b/src/loaders/index.js @@ -1,6 +1,14 @@ /** * This namespace contains APIs which extends the {@link https://github.com/englercj/resource-loader resource-loader} module * for loading assets, data, and other resources dynamically. + * @example + * const loader = new PIXI.loaders.Loader(); + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.load((loader, resources) => { + * // resources.bunny + * // resources.spaceship + * }); * @namespace PIXI.loaders */ export { default as Loader } from './loader'; diff --git a/src/core/settings.js b/src/core/settings.js index 9e8144d..d75b058 100644 --- a/src/core/settings.js +++ b/src/core/settings.js @@ -4,6 +4,13 @@ /** * User's customizable globals for overriding the default PIXI settings, such * as a renderer's default resolution, framerate, float percision, etc. + * @example + * // Use the native window resolution as the default resolution + * // will support high-density displays when rendering + * PIXI.settings.RESOLUTION = window.devicePixelRatio. + * + * // Disable interpolation when scaling, will make texture be pixelated + * PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; * @namespace PIXI.settings */ export default { diff --git a/src/core/ticker/index.js b/src/core/ticker/index.js index d4d2f40..c3020d4 100644 --- a/src/core/ticker/index.js +++ b/src/core/ticker/index.js @@ -57,6 +57,13 @@ * * This ticker is used for rendering, {@link PIXI.extras.AnimatedSprite AnimatedSprite}, * {@link PIXI.interaction.InteractionManager InteractionManager} and many other time-based PIXI systems. + * @example + * const ticker = new PIXI.ticker.Ticker(); + * ticker.stop(); + * ticker.add((deltaTime) => { + * // do something every frame + * }); + * ticker.start(); * @namespace PIXI.ticker */ export { shared, Ticker }; diff --git a/src/core/utils/index.js b/src/core/utils/index.js index a0db0d9..582b24a 100644 --- a/src/core/utils/index.js +++ b/src/core/utils/index.js @@ -10,6 +10,20 @@ /** * Generalized convenience utilities for PIXI. + * @example + * // Extend PIXI's internal Event Emitter. + * class MyEmitter extends PIXI.utils.EventEmitter { + * constructor() { + * super(); + * console.log("Emitter created!"); + * } + * } + * + * // Get info on current device + * console.log(PIXI.utils.isMobile); + * + * // Convert hex color to string + * console.log(PIXI.utils.hex2string(0xff00ff)); // returns: "#ff00ff" * @namespace PIXI.utils */ export { diff --git a/src/extract/index.js b/src/extract/index.js index 031c859..e9478c1 100644 --- a/src/extract/index.js +++ b/src/extract/index.js @@ -4,6 +4,18 @@ * * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}. + * @example + * // Create a new app (will auto-add extract plugin to renderer) + * const app = new PIXI.Application(); + * + * // Draw a red circle + * const graphics = new PIXI.Graphics() + * .beginFill(0xFF0000) + * .drawCircle(0, 0, 50); + * + * // Render the graphics as an HTMLImageElement + * const image = app.renderer.plugins.extract.image(graphics); + * document.body.appendChild(image); * @namespace PIXI.extract */ export { default as webgl } from './webgl/WebGLExtract'; diff --git a/src/filters/index.js b/src/filters/index.js index 01f63a2..7ceb50a 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -1,6 +1,21 @@ /** * This namespace contains WebGL-only display filters that can be applied * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. + * @example + * // Create a new application + * const app = new PIXI.Application(); + * + * // Draw a green rectangle + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add a blur filter + * rect.filters = [new PIXI.filters.BlurFilter()]; + * + * // Display rectangle + * app.stage.addChild(rect); + * document.body.appendChild(app.view); * @namespace PIXI.filters */ export { default as FXAAFilter } from './fxaa/FXAAFilter'; diff --git a/src/loaders/index.js b/src/loaders/index.js index f13d855..39669be 100644 --- a/src/loaders/index.js +++ b/src/loaders/index.js @@ -1,6 +1,14 @@ /** * This namespace contains APIs which extends the {@link https://github.com/englercj/resource-loader resource-loader} module * for loading assets, data, and other resources dynamically. + * @example + * const loader = new PIXI.loaders.Loader(); + * loader.add('bunny', 'data/bunny.png') + * .add('spaceship', 'assets/spritesheet.json'); + * loader.load((loader, resources) => { + * // resources.bunny + * // resources.spaceship + * }); * @namespace PIXI.loaders */ export { default as Loader } from './loader'; diff --git a/src/prepare/index.js b/src/prepare/index.js index 28a5ff5..e7491ec 100644 --- a/src/prepare/index.js +++ b/src/prepare/index.js @@ -4,6 +4,26 @@ * * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property. * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.WebGLRenderer#plugins}. + * @example + * // Create a new application + * const app = new PIXI.Application(); + * document.body.appendChild(app.view); + * + * // Don't start rendering right away + * app.stop(); + * + * // create a display object + * const rect = new PIXI.Graphics() + * .beginFill(0x00ff00) + * .drawRect(40, 40, 200, 200); + * + * // Add to the stage + * app.stage.addChild(rect); + * + * // Don't start rendering until the graphic is uploaded to the GPU + * app.renderer.plugins.prepare.upload(app.stage, () => { + * app.start(); + * }); * @namespace PIXI.prepare */ export { default as webgl } from './webgl/WebGLPrepare';