Jump to content

How to stretch gradient in Pixi


Recommended Posts

   so I have a 2x128 vertical gradient, I do that to reduce the spritesheet size. What I want is to stretch the sprite to 64x128. When I created a sprite out of it, I notice it having a weird incorrect width.  When I do,  sprite.width = 64,  it doesn't go to 64 px.  And when I use a huge number to force it to 64px on screen,  it uses the wrong sampling where it tries to interpolate the pixel across the x direction using the pixel above and below. How can I resolve this ? 

Link to comment
Share on other sites

19 hours ago, ivan.popelyshev said:

Use TilingSprite instead. Also, you may have scaled the parents of the sprite, if its not 64px on screen :)

I am not sure how to use TilingSprite and what it does.  In this case, would it be   new TilingSprite(my2x128Texture,  64, 128)  ? 

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.

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.


  • Recently Browsing   0 members

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