ecsancho Posted September 14, 2016 Share Posted September 14, 2016 Hello I have a sprite object with an image that is using a graphics shape as a mask and I'm trying to animate the width of the mask but nothing is happening. When I check bounds of the mask everything results in (0,0,0,0) however I remove it from being as mask I get the correct bounds. I cannot seem to figure out what's going on. Any ideas? var texture = PIXI.Texture.fromImage('_assets/s3/test1.jpg'); var sprite = new PIXI.Sprite(texture); sprite.width = 500; sprite.height = 500; sprite.interactive=true; sprite.on('mousedown', on_down); stage.addChild(sprite); var masker = new PIXI.Graphics(); masker.beginFill(0xFF0000, 1); masker.drawRect(0, 0, 200, 200); masker.endFill(); stage.addChild(masker); sprite.mask=masker; function on_down(){ console.log( this.mask.getBounds() ); //returns all 0,0,0,0 TweenLite.to( this.mask, {width:500});//does nothing } Quote Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 14, 2016 Share Posted September 14, 2016 Which version of pixi do you use? Quote Link to comment Share on other sites More sharing options...
ecsancho Posted September 14, 2016 Author Share Posted September 14, 2016 I'm using v4 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 15, 2016 Share Posted September 15, 2016 OK, so masks getBounds() and getLocalBounds() isnt working. That's bad. You can use "scale" parameter for now, make it 2.5 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 15, 2016 Share Posted September 15, 2016 That's solution: https://github.com/pixijs/pixi.js/pull/2956 . Your case will be solved when it goes to master Quote Link to comment Share on other sites More sharing options...
ecsancho Posted September 20, 2016 Author Share Posted September 20, 2016 Thank you thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.