Commit 7faa5f11 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Use non-linear tweens for tab-loading animation

* Uses EASE_IN_OUT for the progress bar to match the throbber.
* Uses FAST_OUT_SLOW_IN for favicon per UX request.

Bug: chromium:912620
Change-Id: I3ce0a376996c016904a605aa8195cc741b8e03d1
Reviewed-on: https://chromium-review.googlesource.com/c/1373016Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615781}
parent 64e9bfb3
......@@ -17,6 +17,7 @@
#include "ui/base/theme_provider.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/favicon_size.h"
......@@ -378,9 +379,10 @@ void TabIcon::PaintLoadingProgressIndicator(gfx::Canvas* canvas,
!animation_state_.loading_progress_fade_out) {
return;
}
const double progress = gfx::Tween::CalculateValue(
gfx::Tween::EASE_IN_OUT, animation_state_.loading_progress.value_or(1.0));
bounds.set_width(bounds.height() +
animation_state_.loading_progress.value_or(1.0) *
(bounds.width() - bounds.height()));
progress * (bounds.width() - bounds.height()));
cc::PaintFlags flags;
flags.setColor(color);
......@@ -476,9 +478,11 @@ void TabIcon::MaybePaintFavicon(gfx::Canvas* canvas,
return;
cc::PaintFlags flags;
double fade_in_progress = UseNewLoadingAnimation()
? *animation_state_.favicon_fade_in_progress
: 1.0;
double fade_in_progress =
UseNewLoadingAnimation() ? gfx::Tween::CalculateValue(
gfx::Tween::FAST_OUT_SLOW_IN,
*animation_state_.favicon_fade_in_progress)
: 1.0;
flags.setAlpha(fade_in_progress * SK_AlphaOPAQUE);
// Drop in the new favicon from the top while it's fading in.
const int offset = round((fade_in_progress - 1.0) * 4.0);
......
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