Commit 76cb23f9 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Adjust animation curves of UnifiedSystemTray.

This CL adjusts animation curves of some UnifiedSystemTray elements so
that the animation looks more natural and elements would not overlap
each other.

Detailed spec of the animation curves is still WIP on UX side.

TEST=manual
BUG=858941,857346

Change-Id: Ibdcf9371d5436c5bd7ad6e094dab4b6b88bcf945
Reviewed-on: https://chromium-review.googlesource.com/1124259Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572523}
parent cb2b8636
...@@ -269,7 +269,8 @@ void FeaturePodButton::SetToggled(bool toggled) { ...@@ -269,7 +269,8 @@ void FeaturePodButton::SetToggled(bool toggled) {
} }
void FeaturePodButton::SetExpandedAmount(double expanded_amount) { void FeaturePodButton::SetExpandedAmount(double expanded_amount) {
label_button_->layer()->SetOpacity(expanded_amount); // TODO(tetsui): Confirm the animation curve with UX.
label_button_->layer()->SetOpacity(std::max(0., 5. * expanded_amount - 4.));
label_button_->SetVisible(expanded_amount > 0.0); label_button_->SetVisible(expanded_amount > 0.0);
} }
......
...@@ -106,15 +106,20 @@ gfx::Size UnifiedSlidersContainerView::CalculatePreferredSize() const { ...@@ -106,15 +106,20 @@ gfx::Size UnifiedSlidersContainerView::CalculatePreferredSize() const {
} }
void UnifiedSlidersContainerView::UpdateOpacity() { void UnifiedSlidersContainerView::UpdateOpacity() {
const int height = GetPreferredSize().height();
for (int i = 0; i < child_count(); ++i) { for (int i = 0; i < child_count(); ++i) {
views::View* child = child_at(i); views::View* child = child_at(i);
double opacity = 1.0; double opacity = 1.0;
if (child->y() > height()) if (child->y() > height) {
opacity = 0.0; opacity = 0.0;
else if (child->bounds().bottom() < height()) } else if (child->bounds().bottom() < height) {
opacity = 1.0; opacity = 1.0;
else } else {
opacity = static_cast<double>(height() - child->y()) / child->height(); const double ratio =
static_cast<double>(height - child->y()) / child->height();
// TODO(tetsui): Confirm the animation curve with UX.
opacity = std::max(0., 2. * ratio - 1.);
}
child->layer()->SetOpacity(opacity); child->layer()->SetOpacity(opacity);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment