animation_value_f.h 702 B

1234567891011121314151617181920212223242526
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. namespace anim {
  9. TG_FORCE_INLINE float64 interpolateF(float a, float b, float64 b_ratio) {
  10. return a + float64(b - a) * b_ratio;
  11. };
  12. TG_FORCE_INLINE QRectF interpolatedRectF(
  13. const QRectF &r1,
  14. const QRectF &r2,
  15. float64 ratio) {
  16. return QRectF(
  17. interpolateF(r1.x(), r2.x(), ratio),
  18. interpolateF(r1.y(), r2.y(), ratio),
  19. interpolateF(r1.width(), r2.width(), ratio),
  20. interpolateF(r1.height(), r2.height(), ratio));
  21. }
  22. } // namespace anim