Jump to content

How to speed up Pixi.spine.Spine instance?


sinol
 Share

Recommended Posts

Hi guys, i'm using pixi.js (ver 3.0.7) with plugin pixi-spine.js (version 2.1), everything works fine but when I tried this:

var test = new PIXI.spine.Spine(res.spine.spineData);

test.animationSpeed = 2;

it doen't work. :huh:

I was wondering if the API has been changed....hmm,anyone knows how to speed up/down the animation speed (or maybe frame rate) of an instance of the PIXI.spine.Spine?

 

Hope you guys can give me a hand,it would be great help :)

 

Link to comment
Share on other sites

:mellow: hmm...I have solved the problem myself.... I modified the code in pixi-spine.js and add animationSpeed property to it's spine.AnimationState.prototype

 

Here is the code : :D

spine.AnimationState.prototype = {
    onStart: null,
    onEnd: null,
    onComplete: null,
    onEvent: null,
    timeScale: 1,
animationSpeed : 1,
    update: function (delta)
    {
        delta *= this.timeScale;
        for (var i = 0; i < this.tracks.length; i++)
        {
            var current = this.tracks;
            if (!current) continue;
 
            current.time += delta * current.timeScale * this.animationSpeed;
 
The red color code is what I added to it. If anyone met the same problem like me, you can simply modify the code in Pixi-spine.js.
 
Hope the author can take a look :lol:
 
Now you can use :
var test = new PIXI.spine.Spine(res.spine.spineData);
test.state.animationSpeed = 2;
Link to comment
Share on other sites

  • 2 years later...
  • 2 years later...

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...