Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ui/views/animation/ink_drop_hover.cc

Issue 1495753002: Make the material design ripple effect more visible on a quick action (single click or single tap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polished for review. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/animation/ink_drop_hover.h" 5 #include "ui/views/animation/ink_drop_hover.h"
6 6
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "ui/compositor/callback_layer_animation_observer.h" 8 #include "ui/compositor/callback_layer_animation_observer.h"
9 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer.h"
10 #include "ui/compositor/layer_animation_sequence.h" 10 #include "ui/compositor/layer_animation_sequence.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 const base::TimeDelta& duration) { 60 const base::TimeDelta& duration) {
61 // The |animation_observer| will be destroyed when the 61 // The |animation_observer| will be destroyed when the
62 // AnimationStartedCallback() returns true. 62 // AnimationStartedCallback() returns true.
63 ui::CallbackLayerAnimationObserver* animation_observer = 63 ui::CallbackLayerAnimationObserver* animation_observer =
64 new ui::CallbackLayerAnimationObserver( 64 new ui::CallbackLayerAnimationObserver(
65 base::Bind(&InkDropHover::AnimationEndedCallback, 65 base::Bind(&InkDropHover::AnimationEndedCallback,
66 base::Unretained(this), animation_type)); 66 base::Unretained(this), animation_type));
67 67
68 ui::LayerAnimator* animator = layer_->GetAnimator(); 68 ui::LayerAnimator* animator = layer_->GetAnimator();
69 ui::ScopedLayerAnimationSettings animation(animator); 69 ui::ScopedLayerAnimationSettings animation(animator);
70 animation.SetTweenType(gfx::Tween::EASE_IN_OUT);
70 animation.SetPreemptionStrategy( 71 animation.SetPreemptionStrategy(
71 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 72 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
72 ui::LayerAnimationElement* animation_element = 73 ui::LayerAnimationElement* animation_element =
73 ui::LayerAnimationElement::CreateOpacityElement( 74 ui::LayerAnimationElement::CreateOpacityElement(
74 animation_type == FADE_IN ? kHoverVisibleOpacity : kHiddenOpacity, 75 animation_type == FADE_IN ? kHoverVisibleOpacity : kHiddenOpacity,
75 duration); 76 duration);
76 ui::LayerAnimationSequence* animation_sequence = 77 ui::LayerAnimationSequence* animation_sequence =
77 new ui::LayerAnimationSequence(animation_element); 78 new ui::LayerAnimationSequence(animation_element);
78 animation_sequence->AddObserver(animation_observer); 79 animation_sequence->AddObserver(animation_observer);
79 80
(...skipping 13 matching lines...) Expand all
93 HoverAnimationType animation_type, 94 HoverAnimationType animation_type,
94 const ui::CallbackLayerAnimationObserver& observer) { 95 const ui::CallbackLayerAnimationObserver& observer) {
95 // AnimationEndedCallback() may be invoked when this is being destroyed and 96 // AnimationEndedCallback() may be invoked when this is being destroyed and
96 // |layer_| may be null. 97 // |layer_| may be null.
97 if (animation_type == FADE_OUT && layer_) 98 if (animation_type == FADE_OUT && layer_)
98 layer_->SetVisible(false); 99 layer_->SetVisible(false);
99 return true; 100 return true;
100 } 101 }
101 102
102 } // namespace views 103 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698