update()
    {
        this.dirty = true;

        const wt = this._wt;
        const lt = this._lt;

        if (this._localUpdateId !== this._cachedLocalUpdateId)
        {
            const a =  this._cr * this._scale.x;
            const b =  this._sr * this._scale.x;
            const c = -this._sr * this._scale.y;
            const d =  this._cr * this._scale.y;

            // skew
            lt.a = (this._cy * a) + (this._sy * c);
            lt.b = (this._cy * b) + (this._sy * d);
            lt.c = (this._sx * a) + (this._cx * c);
            lt.d = (this._sx * b) + (this._cx * d);

            // translation
            lt.tx = this._position.x - ((this._pivot.x * lt.a) + (this._pivot.y * lt.c));
            lt.ty = this._position.y - ((this._pivot.x * lt.b) + (this._pivot.y * lt.d));

            this._cachedLocalUpdateId = this._localUpdateId;
            this._cachedWorldUpdateId = -1;
        }

        // @ifdef DEBUG
        debug.ASSERT(this._lt.valid(), 'Invalid local transform, property is set incorrectly somewhere...');
        // @endif

        if (this.parent)
        {
            if (this._cachedWorldUpdateId !== this.parent._worldUpdateId)
            {
                const pt = this.parent._wt;

                // multiply the parent matrix with the objects transform.
                wt.a = (lt.a * pt.a) + (lt.b * pt.c);
                wt.b = (lt.a * pt.b) + (lt.b * pt.d);
                wt.c = (lt.c * pt.a) + (lt.d * pt.c);
                wt.d = (lt.c * pt.b) + (lt.d * pt.d);
                wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;
                wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;

                this._cachedWorldUpdateId = this.parent._worldUpdateId;
                this._worldUpdateId++;
            }
        }
        else if (this._cachedWorldUpdateId !== this._worldUpdateId)
        {
            wt.copy(this._lt);
            this._worldUpdateId++;
            this._cachedWorldUpdateId = this._worldUpdateId;
        }

        // @ifdef DEBUG
        debug.ASSERT(this._wt.valid(), 'Invalid world transform, property is set incorrectly somewhere...');
        // @endif
    }
/**
     * Updates the world transform based on the passed transform.
     *
     */
Updates the world transform based on the passed transform.
Updates the world transform based on the passed transform .
update()
    {
        this.dirty = true;
        const wt = this._wt;
        const lt = this._lt;
        if (this._localUpdateId !== this._cachedLocalUpdateId)
        {
            const a =  this._cr * this._scale.x;
            const b =  this._sr * this._scale.x;
            const c = -this._sr * this._scale.y;
            const d =  this._cr * this._scale.y;
            lt.a = (this._cy * a) + (this._sy * c);
            lt.b = (this._cy * b) + (this._sy * d);
            lt.c = (this._sx * a) + (this._cx * c);
            lt.d = (this._sx * b) + (this._cx * d);
            lt.tx = this._position.x - ((this._pivot.x * lt.a) + (this._pivot.y * lt.c));
            lt.ty = this._position.y - ((this._pivot.x * lt.b) + (this._pivot.y * lt.d));
            this._cachedLocalUpdateId = this._localUpdateId;
            this._cachedWorldUpdateId = -1;
        }
        debug.ASSERT(this._lt.valid(), 'Invalid local transform, property is set incorrectly somewhere...');
        if (this.parent)
        {
            if (this._cachedWorldUpdateId !== this.parent._worldUpdateId)
            {
                const pt = this.parent._wt;
                wt.a = (lt.a * pt.a) + (lt.b * pt.c);
                wt.b = (lt.a * pt.b) + (lt.b * pt.d);
                wt.c = (lt.c * pt.a) + (lt.d * pt.c);
                wt.d = (lt.c * pt.b) + (lt.d * pt.d);
                wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;
                wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;
                this._cachedWorldUpdateId = this.parent._worldUpdateId;
                this._worldUpdateId++;
            }
        }
        else if (this._cachedWorldUpdateId !== this._worldUpdateId)
        {
            wt.copy(this._lt);
            this._worldUpdateId++;
            this._cachedWorldUpdateId = this._worldUpdateId;
        }
        debug.ASSERT(this._wt.valid(), 'Invalid world transform, property is set incorrectly somewhere...');
    }
update ( ) { this . dirty = true ; const wt = this . _wt ; const lt = this . _lt ; if ( this . _localUpdateId !== this . _cachedLocalUpdateId ) { const a = this . _cr * this . _scale . x ; const b = this . _sr * this . _scale . x ; const c = - this . _sr * this . _scale . y ; const d = this . _cr * this . _scale . y ; lt . a = ( this . _cy * a ) + ( this . _sy * c ) ; lt . b = ( this . _cy * b ) + ( this . _sy * d ) ; lt . c = ( this . _sx * a ) + ( this . _cx * c ) ; lt . d = ( this . _sx * b ) + ( this . _cx * d ) ; lt . tx = this . _position . x - ( ( this . _pivot . x * lt . a ) + ( this . _pivot . y * lt . c ) ) ; lt . ty = this . _position . y - ( ( this . _pivot . x * lt . b ) + ( this . _pivot . y * lt . d ) ) ; this . _cachedLocalUpdateId = this . _localUpdateId ; this . _cachedWorldUpdateId = - 1 ; } debug . ASSERT ( this . _lt . valid ( ) , 'Invalid local transform, property is set incorrectly somewhere...' ) ; if ( this . parent ) { if ( this . _cachedWorldUpdateId !== this . parent . _worldUpdateId ) { const pt = this . parent . _wt ; wt . a = ( lt . a * pt . a ) + ( lt . b * pt . c ) ; wt . b = ( lt . a * pt . b ) + ( lt . b * pt . d ) ; wt . c = ( lt . c * pt . a ) + ( lt . d * pt . c ) ; wt . d = ( lt . c * pt . b ) + ( lt . d * pt . d ) ; wt . tx = ( lt . tx * pt . a ) + ( lt . ty * pt . c ) + pt . tx ; wt . ty = ( lt . tx * pt . b ) + ( lt . ty * pt . d ) + pt . ty ; this . _cachedWorldUpdateId = this . parent . _worldUpdateId ; this . _worldUpdateId ++ ; } } else if ( this . _cachedWorldUpdateId !== this . _worldUpdateId ) { wt . copy ( this . _lt ) ; this . _worldUpdateId ++ ; this . _cachedWorldUpdateId = this . _worldUpdateId ; } debug . ASSERT ( this . _wt . valid ( ) , 'Invalid world transform, property is set incorrectly somewhere...' ) ; }
Updates the world transform based on the passed transform.
Updates the world transform based on the passed transform .
// skew // translation // @ifdef DEBUG // @endif // multiply the parent matrix with the objects transform. // @ifdef DEBUG // @endif