tmp-demo / tde.js

JS demo engine.
2 stars 0 forks source link

Use [0-1] intervals for key frames (the #13

Open nical opened 9 years ago

nical commented 9 years ago

In the sequence, I want to go from

    "u_glitch": [
      {
        start: 0,
        duration: 64,
        animation: [
          [0, [0.5]],
          [64, [1]],
        ],
      },
    ],

to

    "u_glitch": [
      {
        start: 0,
        duration: 64,
        animation: [
          [0, [0.5]],
          [1, [1]],
        ],
      },
    ],

I find it easier to work with, it should make stretching and tweaking curves easier, and it'll make it simpler to add some easing functions.

Rémi, any objection ?

nical commented 9 years ago

cc @wsmind

wsmind commented 9 years ago

I though it was easier to reason in integer values (0, 24, 48) rather than small fractional values (0.124, 0.47, 0.86). Especially for music sync, it's quite easy to think about multiples of 8 or 16, much harder to check for values that should be aligned on 0.112...

Also I don't see how this would make easing implementation easier.

nical commented 9 years ago

The way I see it, the clip (start;duration) is positioned in music time and this is where you actually need music sync, while the key frames within a clip are at more arbitrary placed (they are a bit more about the shape of the curve than the timing of things) and are more likely to be proportionally repositioned when we change the duration of a clip.

easing curves are computed in [0-1] so it means going from music time to [0-1] back to music time rather than just [0-1] to music time which is slightly more code but not enough to matter I guess.

I don't feel strongly about this, let's see how it pans out in music time for now.