Jump to content

Flipping sprite and negative width


julacariote
 Share

Recommended Posts

Hello,

 

If I flip a sprite on the horizontal axis, meaning I set its scale to (-1, 1), the width of the sprite become negative because the width is defined like this in Sprite:

Object.defineProperty(PIXI.Sprite.prototype, 'width', {    get: function() {        return this.scale.x * this.texture.frame.width;});

This makes perfect sense if I scale my sprite to for example (0.5, 1), its resulting width would indeed be the half of the original size. But in the case of flipping a sprite, why not returns the absolute value to always get a positive width?

 

I guess this is done this way on purpose, I'm just wondering why a width should be negative?

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