UInt64Animator.cs 631 B

123456789101112131415161718192021
  1. using System;
  2. namespace Avalonia.Animation.Animators
  3. {
  4. /// <summary>
  5. /// Animator that handles <see cref="UInt64"/> properties.
  6. /// </summary>
  7. public class UInt64Animator : Animator<UInt64>
  8. {
  9. const double maxVal = (double)UInt64.MaxValue;
  10. /// <inheritdocs/>
  11. public override UInt64 Interpolate(double progress, UInt64 oldValue, UInt64 newValue)
  12. {
  13. var normOV = oldValue / maxVal;
  14. var normNV = newValue / maxVal;
  15. var deltaV = normNV - normOV;
  16. return (UInt64)Math.Round(maxVal * ((deltaV * progress) + normOV));
  17. }
  18. }
  19. }