Jump to content

Texture crop not applying?


Recommended Posts

Hey folks, again... I'm having an issue with my crop not applying to a texture.
I was able to apply a frame just fine, but when I apply the crop, either by passing it in as a third parameter, or by using `texture.crop = ___`, it's not applied/ doesn't do anything.

let frame = new Pixi.Rectangle(clip.x, clip.y, clip.width, clip.height);let crop = new Pixi.Rectangle(32, 32, 32, 32);let texture = new Pixi.Texture(new Pixi.BaseTexture(img), frame, crop);

clip is an object that contains x,y,width,height; img is an image object.


Any idea what could be happening? When I output the texture's crop in the console, I get the frame's dimensions.

Link to comment
Share on other sites

Hi, there's a comment in the code that suggests crop might be in normalised uv coordinates so, maybe you have to have _uvs set true and maybe the domain for the crop coordinates is [[0, 0], [1,1]] based on the top left of the frame? Also, there seems to be some confusion in the code about trim and crop... Anyway, trim needs to be truthy or crop is set to frame.

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