All files / player-browser/src/skins/synesthesia song-info.ts

0% Statements 0/4
0% Branches 0/2
0% Functions 0/1
0% Lines 0/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 16 17 18 19 20                                       
import {
  resolveSongInfoLayers,
  type BeMusicGameplayRuntime,
  type BeMusicSongInfoText,
} from '@be-music/player-skin-sdk';
import type { Text } from 'pixi.js';
 
/**
 * Draws a NONSTOP play's song info crossfading (`resolveSongInfoLayers`): `draw` once per layer, returning the texts it
 * added, which then take that layer's opacity. Pooled texts come back at full opacity each frame.
 */
export function drawSongInfoLayers(
  runtime: BeMusicGameplayRuntime,
  draw: (info: BeMusicSongInfoText) => ReadonlyArray<Text | undefined>,
): void {
  for (const { info, alpha } of resolveSongInfoLayers(runtime)) {
    for (const node of draw(info)) if (node !== undefined) node.alpha = alpha;
  }
}