Jump to content

Making Sense of Tiling Sprite


ipop
 Share

Recommended Posts

With 

 

var tilingSprite = new PIXI.TilingSprite(texture, window.innerWidth, window.innerHeight)

 

var count = 0;

 

stage.addChild(tilingSprite);

 

The stage is filled by the same tile repeating is that what PIXI.TilingSprite does?

 

How do you reference an array of tiles, and then display them using .TilingSprite?

 

or is this for scrolling a background, for example?

Link to comment
Share on other sites

when i try to loop a backgound using TilingSprite, i get Stuttering of the graphic:

 

 

// create an new instance of a pixi stage

var stage = new PIXI.Stage(0x97c56e, true);

 

// create a renderer instance

var renderer = PIXI.autoDetectRenderer(window.innerWidth, window.innerHeight, null);

 

// add the renderer view element to the DOM

document.body.appendChild(renderer.view);

renderer.view.style.position = "absolute";

renderer.view.style.top = "0px";

renderer.view.style.left = "0px";

requestAnimFrame( animate );

 

// create a texture from an image path

var texture = PIXI.Texture.fromImage("sky.jpg");

var tilingSprite = new PIXI.TilingSprite(texture, 1024,1024);

stage.addChild(tilingSprite);

//stage.addChild(tilingSprite1);

 

function animate() {

 

    requestAnimFrame( animate );

 

tilingSprite.tilePosition.x += 7;

 

    renderer.render(stage);

}

 

https://www.dropbox.com/s/k49119yz1griq2q/sky.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...