Jump to content

TilingSprite resize


lukasyno
 Share

Recommended Posts

Yeah, you can do it with this : 

 

 

var myTS....myTS.scale.x = 0.5;myTS.scale.y = 0.5; 

No. I want resize viewport not change scale.

I have TilingSprite on fullScreen in browser and if user change window size i want change viewport size on tilingSprite.

Link to comment
Share on other sites

I think he means the viewport of the TilingSprite.

The only way i found to do it, is to remove the sprite from stage, change width/height and add it to the stage again.

 

Example:

var sprite = new PIXI.TilingSprite(texture, 100, 100);stage.addChild(sprite);...stage.removeChild(sprite);sprite.width = 200;stage.addChild(sprite);
Link to comment
Share on other sites

The proper way to change the viewport size of a PIXI viewport is to call the resize function of the renderer:

 

renderer.resize(width, height);

 

That will properly update the canvas size, and perform the necessary calculations. You should not be resizing the canvas on your own (especially if you are using WebGL).

 

For more information, see the implementation of resize for the CanvasRenderer and the WebGLRenderer.

Link to comment
Share on other sites

@Seby, rolnaaba, Thank you but you don't understand me..

@enpu WOW yes exactly what I mean, your hack

stage.removeChild(sprite);sprite.width = 200;stage.addChild(sprite);

work very nice but i think this is PIXI.TilingSprite BUG (I will report this...)..

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...