progress_ring_animation.cc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/system/progress_indicator/progress_ring_animation.h"
  5. #include "ash/system/progress_indicator/progress_ring_indeterminate_animation.h"
  6. #include "ash/system/progress_indicator/progress_ring_pulse_animation.h"
  7. namespace ash {
  8. ProgressRingAnimation::ProgressRingAnimation(Type type,
  9. base::TimeDelta duration,
  10. bool is_cyclic)
  11. : ProgressIndicatorAnimation(duration, is_cyclic), type_(type) {}
  12. ProgressRingAnimation::~ProgressRingAnimation() = default;
  13. // static
  14. std::unique_ptr<ProgressRingAnimation> ProgressRingAnimation::CreateOfType(
  15. Type type) {
  16. switch (type) {
  17. case Type::kIndeterminate:
  18. return std::make_unique<ProgressRingIndeterminateAnimation>();
  19. case Type::kPulse:
  20. return std::make_unique<ProgressRingPulseAnimation>();
  21. }
  22. }
  23. void ProgressRingAnimation::UpdateAnimatableProperties(double fraction) {
  24. UpdateAnimatableProperties(fraction, &start_position_, &end_position_,
  25. &outer_ring_opacity_);
  26. }
  27. } // namespace ash