double Wrap(double value, double min, double max) => value - (max - min) * ((value - min) / (max - min)).floorToDouble();