OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 |
| 5 #ifndef ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_ |
| 6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "ash/ash_export.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" |
| 13 #include "ui/compositor/layer_animation_element.h" |
| 14 #include "ui/gfx/animation/tween.h" |
| 15 #include "ui/gfx/geometry/point.h" |
| 16 #include "ui/gfx/geometry/point3_f.h" |
| 17 |
| 18 namespace ui { |
| 19 class InterpolatedTransform; |
| 20 class Layer; |
| 21 } |
| 22 |
| 23 namespace ash { |
| 24 |
| 25 // A LayerAnimationElement that will animate a layer by rotating it around a |
| 26 // pivot point. |
| 27 class ASH_EXPORT ScreenRotationAnimation : public ui::LayerAnimationElement { |
| 28 public: |
| 29 // Creates an animation element that will rotate |layer| from |start_degrees| |
| 30 // to |end_degrees| around the given |pivot|. The animation will take |
| 31 // |duration| amount of time and |layer| will be scaled as defined by the |
| 32 // |initial_scale| and |target_scale| values. |
| 33 ScreenRotationAnimation(ui::Layer* layer, |
| 34 int start_degrees, |
| 35 int end_degrees, |
| 36 float initial_opacity, |
| 37 float target_opacity, |
| 38 const gfx::Point3F& initial_scale, |
| 39 const gfx::Point3F& target_scale, |
| 40 gfx::Point pivot, |
| 41 base::TimeDelta duration, |
| 42 gfx::Tween::Type twen_type); |
| 43 ~ScreenRotationAnimation() override; |
| 44 |
| 45 private: |
| 46 // Implementation of ui::LayerAnimationDelegate |
| 47 void OnStart(ui::LayerAnimationDelegate* delegate) override; |
| 48 bool OnProgress(double current, |
| 49 ui::LayerAnimationDelegate* delegate) override; |
| 50 void OnGetTarget(TargetValue* target) const override; |
| 51 void OnAbort(ui::LayerAnimationDelegate* delegate) override; |
| 52 |
| 53 // The root InterpolatedTransform that defines the animation. |
| 54 scoped_ptr<ui::InterpolatedTransform> interpolated_transform_; |
| 55 |
| 56 // The Tween type to use for the animation. |
| 57 gfx::Tween::Type tween_type_; |
| 58 |
| 59 // The initial layer opacity to start the animation with. |
| 60 float initial_opacity_; |
| 61 |
| 62 // The target layer opacity to end the animation with. |
| 63 float target_opacity_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimation); |
| 66 }; |
| 67 |
| 68 } // namespace ash |
| 69 |
| 70 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_ |
OLD | NEW |