AdaptiveHaptics / AdapticsDesigner

An online platform for creating and experimenting with dynamic mid-air haptic patterns.
https://adaptivehaptics.github.io/AdapticsDesigner/
GNU General Public License v3.0
1 stars 0 forks source link

Time discontinuous transitions #10

Closed kevin-cgc closed 1 year ago

kevin-cgc commented 1 year ago

In order to support adapative/dynamic pattern transitions, the evaluator must be able to support mapping the monotonic "realtime" it receives as a parameter to a discontinuous "pattern local" time that represents which keyframes are used.

Additionally, in order to smoothly transition to a new "pattern local" time rather than just jumping to it, the evaluator would need to do something like create a new time space for the transition (analogous to the graphical transition timeline UI from FMOD).

For example: If we want to loop the animation involving the standard keyframes [K1-------K2-------K3]. We could just have K3's transition set the "pattern local" time to 0. However, this would cause an abrupt jump during playback: [K1-------K2-------K3K1-------K2-------K3]. What we need is a way to create a temporary different view of the pattern to support the transition during the loop: [K1-------K2-------K3-_-_-_-K1-------K2-------K3]. Or if a designer wants to jump from K3 to K2: [K1-------K2-------K3-_-_-_-K2-------K3].

I think a potentially good way to do this is by adding optional object parameter on PatternEvaluatorParameters:

params.transition = {
  MAHKeyframeStandard prev_std_keyframe: Object.assign(
    { time: transition_from_time+ prev_keyframe.time-prev_std_keyframe.time, transition: transition_type },
    prev_std_keyframe
  ),
  MAHKeyframe prev_keyframe: Object.assign(
     { time: transition_from_time, transition: transition_type },
     prev_keyframe
  ),
  timeoffset: number,
} | null

The problem with this definition is, if a designer wants K3 to transition to K2, the K3->K2 transition cannot be longer than the K1->K2 transition, as then the transition would become a K3->K1 transition.

kevin-cgc commented 1 year ago

Closed around 21d739ee9b44aac668f34e93f16cc2d75e7f1ea3 - ecbdfce856e84d4f2b832dfff65dac7fd802d355