Jump to content

Changing texture size


Sia
 Share

Recommended Posts

Hi everyone

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

a.thumb.png.3a6a1713c07793adc2a6fb26a66eb705.png

the whole code goes like this :

const app = new PIXI.Application({
    antialias: true  , width:1000 , height:1000 , backgroundColor: 0xFFFFFF
});
document.body.appendChild(app.view);


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.beginFill(0);
g.drawRect(0,0 , 900,900);  // the size of rectangle : 900*900
g.endFill();

app.stage.addChild(g);

 

the result :

by9.JPG.ea08aa38a8d47e6370d6f5af8348836c.JPG

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 :

by4.JPG.68576b0df203fed608de1b79fee80070.JPG

 

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.

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