flyover / spine-c2-plugin

A Construct 2 plugin for creating a Spine animation object.
MIT License
27 stars 5 forks source link

Simple Feature Request : disable interpolation #5

Closed c13303 closed 8 years ago

c13303 commented 8 years ago

The idea is to draw the frame only every x seconds, in order to create a traditionnal animation feeling.

Like the mirror function, I've made my own version based on old plugin, but it may be dirty. Here is it, if it can help https://drive.google.com/file/d/0B4BNmts_YUX6bUdDdmxtbXZpUmc/view?usp=sharing

flyover commented 8 years ago

This can be accomplished by using stepped curves in Spine.

http://esotericsoftware.com/spine-graph

Fromageinteractif commented 8 years ago

Yea but the thing is : it's not only every x seconds but we would like to have a "12 fps" feeling so that means 12 times per seconds. Although this is doable in Spine it is not designed to do so, curves cannot be baked automatically so that means that you must redo every single key yourself one by one and put them in step. And even after that, that also means that your animations files would have three time or four times more informations because there is a key every 2 frames. Where just a refresh drawing feature to adjust the framerate in the plugin could do the same job.

Actually this is even on the Spine forum that we have been suggested to increment this in the plugin rather than doing it in Spine. You can take a look on the topic if you have time : http://esotericsoftware.com/forum/Framerate-editing-5171 But in short, here is wat I have been told :

"To achieve discrete-framed animations, the runtime code can be easily modified, given that your engine also allows you access to observable time and manageable variables (or at least allows you to manage your own).

The Spine runtimes are already set up to receive customized update time deltas.

Limiting the framerate amounts to just delaying animation updates until enough time has passed (eg, 1/24 of a second, or 1/12 of a second). And achieving discrete and predictable 12 and 24 fps poses (like you would expect in hand-drawn or pre-rendered animations) amounts to restricting the time values being passed into Spine's runtime code in discrete 1/12 or 1/24 chunks."

flyover commented 8 years ago

I see. So I'm thinking I'll add another variable (Step) to the object where 0.0 is continuous and > 0.0 will wait that many milliseconds between striking the pose. With this, how would you like the Rate of the animation to apply? Should the Step be scaled with the Rate, causing the flip-book to speed up; or, should the Step stay consistent and sample the continuous animation running at a faster/slower rate?

c13303 commented 8 years ago

I think the best for animator artists (fromage will maybe confirm?) should be to set a Frames per Seconds [fps] parameter. This way, every 1/[fps] seconds, draw is called and you can easily set up a 12 or 24 or 60 fps animation.

Fromageinteractif commented 8 years ago

Ideally the step shouldn't scale with the rate, because basically to get a 12 FPS result in Spine I must slow down the speedrate to 0.4 (as the default speed is 30 "keyable units" per seconds in Spine). This way, it plays 12 units per seconds and then I take off an option called "Interpolated" so that it doesn't calculate the drawings between each time unit. This way, I finally get a result equivalent to a real 12 FPS traditional animation, without having to put a key in step on each time unit. Unfortunately, the "Interpolated" option is not recognized in the export (and I am not sure it can be ?). The speed rate is not either, but this is not a problem as there is already a speed rate feature in the plugin. So once I'm in Construct 2, I put the speed rate to 0.4 as well and I have the right speed. At the end of the day, as I already have a tweaked speed rate, it would be better to have the Step variable independent from the Speedrate variable.

I have another question : as 1000/12 = 83.333333... what is the best option to get an accurate result and to avoid an offset on the long term ? Is that possible to put a fraction as a variable ? To answer c13303, it is right, in other terms, the best would be an option where we put the divisor of 1 second and not the result. For example if I put 12 in the Step variable, then it would cut 1 second in 12 parts and refresh the drawing 12 times per seconds.

flyover commented 8 years ago

added in ea48f45b72c5b65889359180af0b0e3cdd9e8e5b