computeAlignment static method
Converts item index to alignment (-1 to 1).
Implementation
static double computeAlignment(int index, int itemCount) {
final relativeIndex = (index / (itemCount - 1)).clamp(0.0, 1.0);
return (relativeIndex * 2) - 1;
}