crossFadeFrom method

dynamic crossFadeFrom(
  1. dynamic fadeOutAction,
  2. dynamic duration,
  3. dynamic warp
)

Implementation

crossFadeFrom(fadeOutAction, duration, warp) {
  fadeOutAction.fadeOut(duration);
  fadeIn(duration);

  if (warp) {
    var fadeInDuration = clip.duration,
        fadeOutDuration = fadeOutAction.clip.duration,
        startEndRatio = fadeOutDuration / fadeInDuration,
        endStartRatio = fadeInDuration / fadeOutDuration;

    fadeOutAction.warp(1.0, startEndRatio, duration);
    this.warp(endStartRatio, 1.0, duration);
  }

  return this;
}