vaibhavsilar Posted September 6, 2013 Share Posted September 6, 2013 Hello, I want to use setTransform method of canvas in pixijs.Is there any interface in pixijs to apply this concept. I have tried implementing like this: displayObj.localTransform = [1, 1, 1, 1, 0, 0]; but its not working. Please suggest. Thanksvbh Quote Link to comment Share on other sites More sharing options...
xerver Posted September 6, 2013 Share Posted September 6, 2013 What are you trying to accomplish? More than likely you can use our properties instead of setting the transform directly. Quote Link to comment Share on other sites More sharing options...
vaibhavsilar Posted September 13, 2013 Author Share Posted September 13, 2013 Thanks for you reply. I am just trying to skew image. I have not found tutorial for skewing.May you please help Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted September 16, 2013 Share Posted September 16, 2013 hello!Best to override the updateTransform - as at the moment the skews are not taken into account with pixi..SkewableSprite.updateTransform = function(){ // TODO OPTIMIZE THIS!! with dirty this.localTransform[0] = this.scale.x//this._cr * this.scale.x; this.localTransform[1] = Math.tan(this.skew) * this.scale.y;// -this._sr * this.scale.y this.localTransform[3] = 0//Math.tan(0.5);//this._sr * this.scale.x; this.localTransform[4] = this.scale.y//this._cr * this.scale.y; ///AAARR GETTER SETTTER! this.localTransform[2] = this.position.x; this.localTransform[5] = this.position.y; // TODO optimize? mat3.multiply(this.localTransform, this.parent.worldTransform, this.worldTransform); this.worldAlpha = this.alpha * this.parent.worldAlpha; }hope this helps! mariogarranz 1 Quote Link to comment Share on other sites More sharing options...
Chen Ling Xue Posted July 9, 2015 Share Posted July 9, 2015 @Mat Grovescan you show me how an example on how to skew a image using phaser.js/pixi.js using your exampleSkewableSprite.updateTransform = function(){ // TODO OPTIMIZE THIS!! with dirty this.localTransform[0] = this.scale.x//this._cr * this.scale.x; this.localTransform[1] = Math.tan(this.skew) * this.scale.y;// -this._sr * this.scale.y this.localTransform[3] = 0//Math.tan(0.5);//this._sr * this.scale.x; this.localTransform[4] = this.scale.y//this._cr * this.scale.y; ///AAARR GETTER SETTTER! this.localTransform[2] = this.position.x; this.localTransform[5] = this.position.y; // TODO optimize? mat3.multiply(this.localTransform, this.parent.worldTransform, this.worldTransform); this.worldAlpha = this.alpha * this.parent.worldAlpha; } Quote Link to comment Share on other sites More sharing options...
xerver Posted July 9, 2015 Share Posted July 9, 2015 We ended up not keeping it in the core lib, but here was how I implemented skew a while ago: https://github.com/GoodBoyDigital/pixi.js/commit/9ae248c5564bfa0f1c607957de5217c0b2ca26d1 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.