How to use the @pixi/app.Application function in @pixi/app

To help you get started, we’ve selected a few @pixi/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github datavized / morph / src / components / Export.js View on Github external
const margin = resolution * (1 - scale) / 2;
			pathContainer.scale.set(scale, scale);
			pathContainer.position.set(margin, margin);
		}

		const pixiOpts = assign({}, pixiOptions);
		const { a, r, g, b } = config.backgroundColor;
		if (a > 0 && !config.transparentBackground) {
			assign(pixiOpts, {
				// eslint-disable-next-line no-bitwise
				backgroundColor: r << 16 ^ g << 8 ^ b << 0,
				transparent: a < 1
			});
		}

		const app = new PIXIApplication({
			width: resolution,
			height: resolution,
			...pixiOpts
		});

		const container = new Container();
		app.stage.addChild(container);

		const drawFn = drawPixi(this.state.drawFunction, pathContainer);
		const draw = drawFn(container, app);
		if (draw.update) {
			draw.update({
				sourceData,
				genes,
				title: config.showTitle && config.title,
				showLabels: !!config.showLabels,
github datavized / morph / src / components / Sketch.js View on Github external
context.glVersion = 2;
					}
					if (!context) {
						context = view.getContext('webgl', glOpts) ||
							view.getContext('experimental-webgl', glOpts);
					}
				} catch (e) {}
			}

			assign(pixiOptions, {
				view,
				context
			});
		}

		const app = this.pixiApp = new PIXIApplication({
			width: width || window.innerWidth,
			height: height || window.innerHeight,
			...pixiOptions
		});
		patchPixiContext(app.renderer.context);

		this.wrapper.appendChild(app.view);
		this.wrapper.className = this.props.className || '';
		this.container = new Container();
		app.stage.addChild(this.container);

		this.sketch = sketch(this.container, app, otherProps);

		if (this.sketch.update) {
			this.sketch.update(otherProps);
		}
github datavized / morph / src / components / Sketch.js View on Github external
view = this.pixiApp.renderer.view;
				context = this.pixiApp.renderer.context;

				try {
					this.pixiApp.destroy();
				} catch (e) {}
			}

			const pixiOptions = assign({}, defaultPixiOptions, {
				view,
				context
			});

			pixiOptions.backgroundColor = hexColor(newProps.bgColor, pixiOptions.backgroundColor);

			const app = this.pixiApp = new PIXIApplication({
				width: width || window.innerWidth,
				height: height || window.innerHeight,
				...pixiOptions
			});
			patchPixiContext(app.renderer.context);
			this.wrapper.appendChild(app.view);
			this.container = new Container();
			app.stage.addChild(this.container);
			this.sketch = sketch(this.container, app, otherProps);
		}

		if (this.sketch.update) {
			this.sketch.update(otherProps);
		}

		if (this.props.sketch !== sketch ||

@pixi/app

Convenience class to create a new PixiJS application

MIT
Latest version published 8 months ago

Package Health Score

91 / 100
Full package analysis