How to use the @pixi/display.Container function in @pixi/display

To help you get started, we’ve selected a few @pixi/display 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 pixijs / pixi.js / packages / core / src / AbstractRenderer.js View on Github external
* The background color as a string.
         *
         * @member {string}
         * @protected
         */
        this._backgroundColorString = '#000000';

        this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter

        /**
         * This temporary display object used as the parent of the currently being rendered item.
         *
         * @member {PIXI.DisplayObject}
         * @protected
         */
        this._tempDisplayObjectParent = new Container();

        /**
         * The last root object that the renderer tried to render.
         *
         * @member {PIXI.DisplayObject}
         * @protected
         */
        this._lastObjectRendered = this._tempDisplayObjectParent;

        /**
         * Collection of plugins.
         * @readonly
         * @member {object}
         */
        this.plugins = {};
    }
github datavized / morph / src / components / Export.js View on Github external
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,
				fontSize: config.labelFontSize,
				backgroundColor: {
					a: config.transparentBackground ? 0 : a,
					r,
					g,
					b
github pixijs / pixi.js / packages / app / src / Application.js View on Github external
// The default options
        options = Object.assign({
            forceCanvas: false,
        }, options);

        /**
         * WebGL renderer if available, otherwise CanvasRenderer.
         * @member {PIXI.Renderer|PIXI.CanvasRenderer}
         */
        this.renderer = autoDetectRenderer(options);

        /**
         * The root display container that's rendered.
         * @member {PIXI.Container}
         */
        this.stage = new Container();

        // install plugins here
        Application._plugins.forEach((plugin) =>
        {
            plugin.init.call(this, options);
        });
    }
github datavized / morph / src / components / Sketch.js View on Github external
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);
		}

		this.resize({ height, width, centerOrigin });

		window.addEventListener('resize', this.onResize);

		// render right away to prevent flash of black #12
		app.render();
	}
github datavized / morph / src / components / Sketch.js View on Github external
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 ||
				this.props.width !== width ||
				this.props.height !== height ||
				!!this.props.centerOrigin !== !!centerOrigin) {
			this.resize({ height, width, centerOrigin });
		}
	}

@pixi/display

Core display functionality

MIT
Latest version published 4 months ago

Package Health Score

92 / 100
Full package analysis