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_
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"
19 class InterpolatedTransform
;
25 // A LayerAnimationElement that will animate a layer by rotating it around a
27 class ASH_EXPORT ScreenRotationAnimation
: public ui::LayerAnimationElement
{
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
,
36 float initial_opacity
,
38 const gfx::Point3F
& initial_scale
,
39 const gfx::Point3F
& target_scale
,
41 base::TimeDelta duration
,
42 gfx::Tween::Type twen_type
);
43 ~ScreenRotationAnimation() override
;
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
);
70 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATION_H_