GitBrincie212 / Apel-Mod

Apel is a library that brings particle animations to the table with flexible behaviour and a clean developer interface. It promises also lots of predefined shapes & paths to help the developer on their particle scene
Other
2 stars 1 forks source link

Improve step calculations in LinearAnimator #27

Closed DarthSharkie closed 2 months ago

DarthSharkie commented 2 months ago

convertToSteps was incorrectly adding all rendering intervals and dividing by the sum of the distance. This is one way to compute it, but it ignores what the constructor provided and redistributes steps.

scheduleGetAmount was incorrectly multiplying its sum by the number of segments. This works if a single value was provided (before the constructors were changed to create a step array of the correct size and copy the value into all elements), but not if an array was provided. Now that the constructor forces an array of proper length, there is no longer a need to multiply here.

Write simple tests to verify these calculations continue to hold.