Jump to content

How to rotate frame Texture


kyptov
 Share

Recommended Posts

I have one sprite with shots

curtov.hol.es/pixiloader/blasts.png

 

I need to make array from texture and use them later. To make sprite I used TexturePacker and some frames was rotated.

 

So I have the next code from json file exported by TexturePacker

 

var frames = [{"filename": "11_protoss","frame": {"x":403,"y":387,"width":58,"height":37},"rotated": true},{"filename": "11_terran","frame": {"x":433,"y":377,"width":42,"height":6},"rotated": true}]
To rotate texture I used DOC and generateTexture() 

 

texture = new PIXI.Texture(baseTexture, frames[i].frame);if (frames[i].rotated) {    doc = new PIXI.DisplayObjectContainer();    sprite = new PIXI.Sprite(texture);    sprite.rotation = - Math.PI / 2;    doc.addChild(sprite);    texture = doc.generateTexture();}
Everything fine in Chrome, but all rotated in FF without transparency.

http://curtov.hol.es/pixiloader/

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