Jump to content

Changing texture size


Recommended Posts

Hi everyone

I have a texture which I use it in Graphics.lineTextureStyle :


the whole code goes like this :

const app = new PIXI.Application({
    antialias: true  , width:1000 , height:1000 , backgroundColor: 0xFFFFFF

const texture = PIXI.Texture.from('./a.png');  // the size of image file : 900*900
const g = new PIXI.Graphics();

g.lineTextureStyle({width:40 , texture:texture , alignment:0});

g.drawRect(0,0 , 900,900);  // the size of rectangle : 900*900



the result :


now I want to change the size of rectangle to 400*400 but texture stays the same size so most of texture gets clipped like so :



how to change the size of texture to match it with the size of rectangle ?

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