Herro I've another question... What do the keys actually do and what does each value indicate? This is an example of a key array down below, and I have no idea what this actually does to the effect. Code: "size": { "keys": [ [ 0, 0.5 ], [ 0.025, 1 ], [ 1, 0 ] ], "stepped": false }, "alpha": { "keys": [ [ 0.025, 0.75 ], [ 0.0625, 0.25 ], [ 1, 0 ] ], "stepped": false }, thx
I am fairly new to this, so perhaps a more experience person could correct or confirm what I say; but I am pretty sure the 'keys' are essentially the time key-frames for the effect. Eg: Code: "size" : { "keys" : [[0, 0], [0.5, 1], [1, 0]], "stepped" : false} // keys is an array of key-frames. // stepped I have not played with, but I presume it is to do with the // interpolation between theses key frames. With stepped false, it is a simple linear interp. "size" : {"keys" : [[<time>,<value>], [<time>,<value>]], "stepped" : false} The 'size' attribute will be 0 at time 0 and 1 at time 0.5 and then back to 0 at time 1. Something to remember, is that these are scalar multiples of the life time of the effect for the time component and similarly for the size value, it is a multiple of the size given outside of the "spec" part.
This is right to make it maybe a bit more simpler Code: "alpha": { "keys": [ [ 0.025, <- Is the lifetime 0.75 <- is the alpha value ], [ 0.0625, 0.25 ], [ 1, 0 ] ], "stepped": false <- is should the change between lifetimes go fluently or stepped for instance. the rainbow code if you're gonne place stepped in it you'll only see the red, green and blue colours and the transitition is going to be hard. Red to green to blue nothing in between },
Umm, help me understand then. Let's say you have an effect which has a lifeTime value of 2 (which I presume is 2 seconds?). If you have as a key '1' for the time value, does that mean it will be keyed at the 2 seconds (i.e. a full multiple of the lifeTime of the effect) or will this be only 1 second, half way through the effect? I presumed it was <time_key> * <lifeTime> = the time at which that value applies.
I tested this and I think it's how keyframes interact in video editing software, etc. It just means the point in time (seconds) the value takes control.
Keys mean different things in different places, but effectively they're key / value pairs in a linear curve. For anything under the particle "spec" the keys are defining values over the normalized lifetime of the particle. This is a value range from zero (0.0) to one (1.0) where zero is the time when the particle spawned and one is the moment the particle dies. Anything outside of that just under the emitters list are in emitter lifetime in actual seconds, not normalized. Code: { "emitters": [ { "spec": { "alpha": { "keys": [[0.0, 1.0],[1.0, 0.0]], "stepped": false } }, "lifetime": 2.0 } ] } So, in this basic example this would be a particle system that spawns particles that last for two seconds starting at their full opacity and fading out completely by the time they're done. Code: { "emitters": [ { "spec": { "alpha": 1.0 }, "alpha": { "keys": [[0.0, 1.0],[2.5, 0.0]], "stepped": false }, "emitterLifetime": 2.5 } ] } In this example now the first particles spawned will be at full opacity, then as the emitter continues each new particle will spawn more and more transparent. Each individual particle will not fade out over time, just disappear at the end of their life. Once a looping emitter has finished it's emitterLifetime the keys start over. If in the second example if the alpha curve's keys were [[0.0, 1.0], [1.0, 0.0]] after 1 second all particles spawned would be completely transparent for the remaining 1.5 seconds of the 2.5 second life of the emitter. The "stepped" value changes the behavior from blending from one value to the next to stepping between them. In the second example if "stepped" was true the particles would just always be full opacity as it would never get to the 2.5 second key before the emitter looped. If the second key was at 1 second the particles would spawn for the first second at full opacity, then spawn invisible for the rest. I also use some shorthand versions of defining the curves. "alpha": 1.0 "alpha": [[0.0, 1.0]] "alpha": {"keys": [[0.0, 1.0]], "stepped": false} All three of those are identical. Some of the older effects have "stepped" still in them, but unless it's true it's unnecessary and the shorter form works. "alpha": [[0.0, 1.0], [0.25, 0.1], [1.o, 0.0]] And that's an example of multiple keys without needing the "keys" text.
@bgolus, wow this is absolutely great info! Thanks a lot. I will be using the short hand form from now on :3