reset method
void
reset()
The parameters need to be reset when the snowflake moves off the screen
Implementation
void reset() {
double ratio = 1.0;
double random = 0.4 + 0.12 * Random().nextDouble() * 5;
if (weatherType == WeatherType.lightRainy) {
ratio = 0.5;
} else if (weatherType == WeatherType.middleRainy) {
ratio = 0.75;
} else if (weatherType == WeatherType.heavyRainy ||
weatherType == WeatherType.storm) {
ratio = 1;
} else if (weatherType == WeatherType.lightSnow) {
ratio = 0.5;
} else if (weatherType == WeatherType.middleSnow) {
ratio = 0.75;
} else if (weatherType == WeatherType.heavySnow) {
ratio = 1;
}
if (WeatherUtil.isRainy(weatherType)) {
if (weatherType == WeatherType.storm) {
scale = random * 1.8;
} else {
scale = random * 1.2;
}
speed = 20 * random * ratio * heightRatio;
alpha = random * 0.6;
x = Random().nextInt(width * 1.2 ~/ scale).toDouble() -
width * 0.1 ~/ scale;
} else {
scale = random * 0.8 * heightRatio;
speed = 8 * random * ratio * heightRatio;
alpha = random;
x = Random().nextInt(width * 1.2 ~/ scale).toDouble() -
width * 0.1 ~/ scale;
}
}