JayCabasag Posted April 25 Share Posted April 25 Hi, I'm new to PIXI JS and pixi spine, I'm wondering if there is a way for me to make it more performant in terms of changing the spine data. What we currently have is adding the spine and removing it from its parent. But this is an expensive process for our game. Is there a better way to do it? Here is the sample code where I want to change the spine data. /** * Set up the visuals. Pieces can be resused and set up with different params freely. * @param options The setup options */ public setup(options: Partial<SlotSpineOptions> = {}) { const opts = { ...defaultSlotSpineOptions, ...options }; this.killTweens(); this.paused = false; this.visible = true; this.alpha = 1; this.type = opts.type; this.name = opts.name; this.blurName = opts.blurName; this.atlasName = opts.atlasName; this.size = opts.size; this.spine.alpha = 1; this.scale.set(1); // Replace new spine data without removing the actual spine added above this.spine = this.spine.width = opts.size; this.spine.height = opts.size; this.spine.pivot.set(0.5) this.highlight.visible = opts.highlight; this.highlight.width = opts.size; this.highlight.height = opts.size; this.highlight.alpha = 0.3; this.area.width = opts.size; this.area.height = opts.size; this.area.interactive = opts.interactive; this.area.cursor = 'pointer'; this.unlock(); } SlotSpine.ts 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.