Revert of Revert of Revert of Revert of Revert of Enable ServiceWorkerPerfTest (servi...
[chromium-blink-merge.git] / ash / rotator / screen_rotation_animation.h
blob51fcccad15c03c11da0b7c9dd846bb4e7044df04
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.
5 #ifndef ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_
6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_
8 #include <stdint.h>
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"
18 namespace ui {
19 class InterpolatedTransform;
20 class Layer;
23 namespace ash {
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;
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;
53 // The root InterpolatedTransform that defines the animation.
54 scoped_ptr<ui::InterpolatedTransform> interpolated_transform_;
56 // The Tween type to use for the animation.
57 gfx::Tween::Type tween_type_;
59 // The initial layer opacity to start the animation with.
60 float initial_opacity_;
62 // The target layer opacity to end the animation with.
63 float target_opacity_;
65 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimation);
68 } // namespace ash
70 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_