All files / player-scene-model/src/play-state lift.ts

100% Statements 2/2
100% Branches 5/5
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15            48x 48x              
/** The beatoraja LIFT geometry: shorten scroll distance by the same ratio as the raised judgement line. */
export function resolveLiftedLane<T extends { top: number; bottom: number }>(
  lane: T,
  lift: number,
  scaleScroll = true,
): T & { baseBottom: number; scrollScale: number } {
  const scrollScale = 1 - (Number.isFinite(lift) ? Math.max(0, Math.min(1, lift)) : 0);
  return {
    ...lane,
    bottom: lane.top + (lane.bottom - lane.top) * scrollScale,
    baseBottom: lane.bottom,
    scrollScale: scaleScroll ? scrollScale : 1,
  };
}