GBear Posted October 11, 2017 Share Posted October 11, 2017 hi.. i'm using 3.x with our project and i'm testing 4.x (and i will move some good issue of 4.x like multi texture or transformstatic) 4.x's geometric values like this.position, this.scale..... have moved to Transform Object. and i saw following code /** * Convenience function to set the position, scale, skew and pivot at once. * * @param {number} [x=0] - The X position * @param {number} [y=0] - The Y position * @param {number} [scaleX=1] - The X scale value * @param {number} [scaleY=1] - The Y scale value * @param {number} [rotation=0] - The rotation * @param {number} [skewX=0] - The X skew value * @param {number} [skewY=0] - The Y skew value * @param {number} [pivotX=0] - The X pivot value * @param {number} [pivotY=0] - The Y pivot value * @return {PIXI.DisplayObject} The DisplayObject instance */ DisplayObject.prototype.setTransform = function setTransform() { var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var scaleX = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; var scaleY = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; var rotation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; var skewX = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; var skewY = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; var pivotX = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0; var pivotY = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0; this.position.x = x; this.position.y = y; this.scale.x = !scaleX ? 1 : scaleX; this.scale.y = !scaleY ? 1 : scaleY; this.rotation = rotation; this.skew.x = skewX; this.skew.y = skewY; this.pivot.x = pivotX; this.pivot.y = pivotY; return this; }; there are this.position, this.scale but DisplayObject do not has them ... can you explain how operate? thx.. ps> code get from pixi 4.5.6 thx. Quote Link to comment Share on other sites More sharing options...
GBear Posted October 11, 2017 Author Share Posted October 11, 2017 find wrapped parts { key: 'localTransform', get: function get() { return this.transform.localTransform; } /**wwww * The coordinate of the object relative to the local coordinates of the parent. * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} */ }, { key: 'position', get: function get() { return this.transform.position; }, set: function set(value) // eslint-disable-line require-jsdoc { this.transform.position.copy(value); } /** * The scale factor of the object. * Assignment by value since pixi-v4. * * @member {PIXI.Point|PIXI.ObservablePoint} */ }, { key: 'scale', get: function get() { return this.transform.scale; }, set: function set(value) // eslint-disable-line require-jsdoc { this.transform.scale.copy(value); } Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 11, 2017 Share Posted October 11, 2017 That method is legacy. Also, yes, properties. 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.