findCurrent static method
Поиск текущей звуковой анимации
Implementation
static SoundAnimation? findCurrent(
List<Animation> animations,
double prevScroll,
double scroll,
) {
try {
return animations.whereType<SoundAnimation>().firstWhere(
(x) =>
(x.start <= scroll && x.end >= scroll) ||
(x.start == x.end &&
prevScroll < scroll &&
prevScroll <= x.start &&
x.start <= scroll),
);
} catch (e) {
return null;
}
}