test
JavaScript
function testFunction() {
// A specific rectangle graphics element
var testBox = new PIXI.Graphics();
testBox.beginFill(0xA7D38B, 1);
testBox.drawRect(50, 0, 445, 40);
testBox.endFill();
// Loop about 96 times and create a list of testBox sprites, one below the other
for (var i = 0; i < 96; i++) {
// Using the new RenderTexture function in v4
var testTexture = PIXI.RenderTexture.create(500, 40);
this.sliderRenderer.render(testBox, testTexture);
// Create the sprite, and set it's position
var testSprite = new PIXI.Sprite(testTexture);
testSprite.position.y = i * 41;
// Add to a container, and an array, just for keeping the reference
this.sliderElementsContainer.addChild(testSprite);
this.sliderSlotArray.push(testSprite);
}
// Create a texture when the loop finishes, which has the above elements in a vertical list
this.sliderTexture = PIXI.RenderTexture.create(550, 4000);
this.sliderRenderer.render(this.sliderElementsContainer, this.sliderTexture);
this.sliderBackground = new PIXI.Sprite(this.sliderTexture);
this.sliderBackground.interactive = true;
this.sliderBackground
.on('mouseup', this.onSliderBackground)
.on('touchend', this.onSliderBackground);
this.sliderStage.addChild(this.sliderBackground);
}