dist/carrot.js
/**
     * The internal render loop of the sprite. It is managed automatically by {@link Carrot.World} or {@link Carrot.Group}, depending on whhich it was added to.
     *
     * @method Carrot.Sprite#_render
     * @private
     */
The internal render loop of the sprite. It is managed automatically by  Carrot.World or  Carrot.Group, depending on whhich it was added to.
The internal render loop of the sprite . It is managed automatically by Carrot . World or Carrot . Group depending on whhich it was added to .
_render()
    {
        if (this.active)
        {
            if (this.inCamera === false)
            {
                if (this.visible === true)
                {
                    this.visible = false;
                    this.style.display = "none";
                }
            }
            else
            {
                if (this.visible === false)
                {
                    this.visible = true;
                    this.style.display = "";
                }
                if (this.alpha !== this._alpha)
                {
                    if (this.alpha < 1)
                    {
                        this.style.opacity = this.alpha;
                    }
                }
                if (this.x !== this._x)
                {
                    this.image.style.left = this.x - (this.width * this.anchor.x) + "px";
                }
                if (this.y !== this._y)
                {
                    this.image.style.top = this.y - (this.height * this.anchor.y) + "px";
                }
                if (this.transform !== this._transform)
                {
                    this.style.transform = this.transform;
                }
            }
            for (let i = 0; i < this.children.length; i++)
            {
                let child = this.children[i];
                child._render();
            }
        }
    }
_render ( ) { if ( this . active ) { if ( this . inCamera === false ) { if ( this . visible === true ) { this . visible = false ; this . style . display = "none" ; } } else { if ( this . visible === false ) { this . visible = true ; this . style . display = "" ; } if ( this . alpha !== this . _alpha ) { if ( this . alpha < 1 ) { this . style . opacity = this . alpha ; } } if ( this . x !== this . _x ) { this . image . style . left = this . x - ( this . width * this . anchor . x ) + "px" ; } if ( this . y !== this . _y ) { this . image . style . top = this . y - ( this . height * this . anchor . y ) + "px" ; } if ( this . transform !== this . _transform ) { this . style . transform = this . transform ; } } for ( let i = 0 ; i < this . children . length ; i ++ ) { let child = this . children [ i ] ; child . _render ( ) ; } } }
The internal render loop of the sprite.
The internal render loop of the sprite .
// Don't display the sprite if not in camera. // Apply cosmetic CSS rules only when inside camera bounds. // Update only if the current values don't match the ones from the last frame // Apply CSS transform. // Render the sprite's children