How to use @pixi/ticker - 10 common examples

To help you get started, we’ve selected a few @pixi/ticker 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 / textures / resources / VideoResource.js View on Github external
_onPlayStart()
    {
        // Just in case the video has not received its can play even yet..
        if (!this.valid)
        {
            this._onCanPlay();
        }

        if (!this._isAutoUpdating && this.autoUpdate)
        {
            Ticker.shared.add(this.update, this);
            this._isAutoUpdating = true;
        }
    }
github pixijs / pixi.js / packages / core / src / textures / VideoBaseTexture.js View on Github external
_onPlayStart()
    {
        // Just in case the video has not received its can play even yet..
        if (!this.hasLoaded)
        {
            this._onCanPlay();
        }

        if (!this._isAutoUpdating && this.autoUpdate)
        {
            Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);
            this._isAutoUpdating = true;
        }
    }
github pixijs / pixi.js / packages / core / src / textures / resources / VideoResource.js View on Github external
_onPlayStart()
    {
        // Just in case the video has not received its can play even yet..
        if (!this.valid)
        {
            this._onCanPlay();
        }

        if (!this._isAutoUpdating && this.autoUpdate)
        {
            Ticker.shared.add(this.update, this);
            this._isAutoUpdating = true;
        }
    }
github pixijs / pixi.js / packages / prepare / src / BasePrepare.js View on Github external
{
            this.add(item);
        }

        // Get the items for upload from the display
        if (this.queue.length)
        {
            if (done)
            {
                this.completes.push(done);
            }

            if (!this.ticking)
            {
                this.ticking = true;
                Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);
            }
        }
        else if (done)
        {
            done();
        }
    }
github pixijs / pixi.js / packages / prepare / src / BasePrepare.js View on Github external
{
            this.ticking = false;

            const completes = this.completes.slice(0);

            this.completes.length = 0;

            for (let i = 0, len = completes.length; i < len; i++)
            {
                completes[i]();
            }
        }
        else
        {
            // if we are not finished, on the next rAF do this again
            Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);
        }
    }
github pixijs / pixi-sound / src / htmlaudio / HTMLAudioInstance.ts View on Github external
this._source.onloadedmetadata = () => {
            if (this._source)
            {
                this._source.currentTime = start;
                this._source.onloadedmetadata = null;
                this.emit("progress", start, this._duration);
                Ticker.shared.add(this._onUpdate, this);
            }
        };
        this._source.onended = this._onComplete.bind(this);
github pixijs / pixi-sound / src / webaudio / WebAudioInstance.ts View on Github external
private set _enabled(enabled: boolean)
    {
        Ticker.shared.remove(this._updateListener, this);
        if (enabled)
        {
            Ticker.shared.add(this._updateListener, this);
        }
    }
github pixijs / pixi-sound / src / webaudio / WebAudioInstance.ts View on Github external
private set _enabled(enabled: boolean)
    {
        Ticker.shared.remove(this._updateListener, this);
        if (enabled)
        {
            Ticker.shared.add(this._updateListener, this);
        }
    }
github pixijs / pixi.js / packages / interaction / src / InteractionManager.js View on Github external
removeEvents()
    {
        if (!this.interactionDOMElement)
        {
            return;
        }

        Ticker.shared.remove(this.update, this);

        if (window.navigator.msPointerEnabled)
        {
            this.interactionDOMElement.style['-ms-content-zooming'] = '';
            this.interactionDOMElement.style['-ms-touch-action'] = '';
        }
        else if (this.supportsPointerEvents)
        {
            this.interactionDOMElement.style['touch-action'] = '';
        }

        if (this.supportsPointerEvents)
        {
            window.document.removeEventListener('pointermove', this.onPointerMove, true);
            this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true);
            this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true);
github pixijs / pixi.js / packages / sprite-animated / src / AnimatedSprite.js View on Github external
stop()
    {
        if (!this.playing)
        {
            return;
        }

        this.playing = false;
        if (this._autoUpdate)
        {
            Ticker.shared.remove(this.update, this);
        }
    }

@pixi/ticker

Tickers are control the timings within PixiJS

MIT
Latest version published 8 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages