Use integer count for tiny droplet generation

This commit is contained in:
ekrctb 2019-01-26 16:14:37 +09:00
parent aaba377e11
commit 1a5a238752
1 changed files with 9 additions and 5 deletions

View File

@ -90,13 +90,17 @@ private void createTicks()
time = Math.Max(StartTime + Duration / 2, time - LegacyLastTickOffset.Value);
}
int tinyTickCount = 1;
double tinyTickInterval = time - lastTickTime;
while (tinyTickInterval > 100)
tinyTickInterval /= 2;
// we don't want to generate at (t == time - epsilon) due to floating point accuracy. time - 1 seems working.
for (double t = lastTickTime + tinyTickInterval; t < time - 1; t += tinyTickInterval)
while (tinyTickInterval > 100 && tinyTickCount < 10000)
{
tinyTickInterval /= 2;
tinyTickCount *= 2;
}
for (int tinyTickIndex = 0; tinyTickIndex < tinyTickCount - 1; tinyTickIndex++)
{
var t = lastTickTime + (tinyTickIndex + 1) * tinyTickInterval;
double progress = reversed ? 1 - (t - spanStartTime) / spanDuration : (t - spanStartTime) / spanDuration;
AddNested(new TinyDroplet