#

API Docs for: 1.5.0
Show: Inherited Protected Private Deprecated

# File: src/pixi/extras/Strip.js

    /**
     * @author Mat Groves http://matgroves.com/
     */

     /**
     *
     * @class Strip
     * @extends DisplayObjectContainer
     * @constructor
     * @param texture {Texture} The texture to use
     * @param width {Number} the width
     * @param height {Number} the height
     *
     */
    PIXI.Strip = function(texture, width, height)
    {
        PIXI.DisplayObjectContainer.call( this );
        this.texture = texture;
        this.blendMode = PIXI.blendModes.NORMAL;

        try
        {
            this.uvs = new Float32Array([0, 1,
                    1, 1,
                    1, 0, 0,1]);

            this.verticies = new Float32Array([0, 0,
                              0,0,
                              0,0, 0,
                              0, 0]);

            this.colors = new Float32Array([1, 1, 1, 1]);

            this.indices = new Uint16Array([0, 1, 2, 3]);
        }
        catch(error)
        {
            this.uvs = [0, 1,
                    1, 1,
                    1, 0, 0,1];

            this.verticies = [0, 0,
                              0,0,
                              0,0, 0,
                              0, 0];

            this.colors = [1, 1, 1, 1];

            this.indices = [0, 1, 2, 3];
        }

        /*
        this.uvs = new Float32Array()
        this.verticies = new Float32Array()
        this.colors = new Float32Array()
        this.indices = new Uint16Array()
        */

        this.width = width;
        this.height = height;

        // load the texture!
        if(texture.baseTexture.hasLoaded)
        {
            this.width   = this.texture.frame.width;
            this.height  = this.texture.frame.height;
            this.updateFrame = true;
        }
        else
        {
            this.onTextureUpdateBind = this.onTextureUpdate.bind(this);
            this.texture.addEventListener( 'update', this.onTextureUpdateBind );
        }

        this.renderable = true;
    };

    // constructor
    PIXI.Strip.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
    PIXI.Strip.prototype.constructor = PIXI.Strip;

    /*
     * Sets the texture that the Strip will use
     *
     * @method setTexture
     * @param texture {Texture} the texture that will be used
     * @private
     */
    PIXI.Strip.prototype.setTexture = function(texture)
    {
        //TODO SET THE TEXTURES
        //TODO VISIBILITY

        // stop current texture
        this.texture = texture;
        this.width   = texture.frame.width;
        this.height  = texture.frame.height;
        this.updateFrame = true;
    };

    /**
     * When the texture is updated, this event will fire to update the scale and frame
     *
     * @method onTextureUpdate
     * @param event
     * @private
     */
    PIXI.Strip.prototype.onTextureUpdate = function()
    {
        this.updateFrame = true;
    };