Jump to content

Spine play more than one animation (together).


Mr_Cutia
 Share

Recommended Posts

Hye,

 

I've a case, where the animator made a complexi animation, but he divided the animation in two. Now I need play the two animation simultaneous.
 
I use spine.setAnimationByName and I'm adding a animation with spine.state.addAnimationByName
 
I tryed to override spineObject.state.upadate = function(delta){
   this.queue.push(this.queue[0]);
   PIXI.Spine.prototype.state.update.call(this, update)
}
 
Then I get a error... I can't access state.update in prototype. I tryed other ways to access prototype of the spine.AnimationState (in line 8364 in pixi.js), But I could not.
 
I'm beginner in javascript, and don't know how access this type of prototype.
 
[pixi.js line 7479]
PIXI.Spine = function (url) {
...
this.state = new spine.AnimationState(this.stateData);
        ....
};
 
Anybody can help me?  :ph34r:
Link to comment
Share on other sites

Well,

I can do it!
 
I just needed to add an animation with addAnimationByName, add the second and add the first again. After this, I replaced the state.update like this:
 
spine.state.update = function(delta) {                  this.currentTime += delta;                  this.previousTime += delta;                  this.mixTime += delta;                  if (this.queue.length > 0) {                        var entry = this.queue[0];                        if (this.currentTime >= entry.delay) {                              this._setAnimation(entry.animation, entry.loop);                              this.queue.push(entry);                              this.queue.shift();                        }                  }                              };
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...