Commit 400fce48 authored by Ana Salazar's avatar Ana Salazar Committed by Commit Bot

Cros: Set tween for animations of apps grid

Tween type for the animations involved in apps grid cardified state
enter and exit should be FAST_OUT_SLOW_IN per spec.

Bug: 1115231
Change-Id: Ie80037f25cab3912b5b1436121276002615395ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350134Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Ana Salazar <anasalazar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797133}
parent 0002c914
......@@ -403,6 +403,7 @@ void AppListItemView::ScaleAppIcon(bool scale_up) {
ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds((kDragDropAppIconScaleTransitionInMs)));
settings.SetTweenType(gfx::Tween::EASE_OUT_2);
if (scale_up) {
if (is_folder_) {
const gfx::Rect bounds(layer()->bounds().size());
......
......@@ -113,10 +113,6 @@ constexpr int kMaximumTileSpacing = 96;
// The duration in ms for most of the apps grid view animations.
constexpr int kDefaultAnimationDuration = 200;
// The duration in ms for the animation that ends the cardified state of the
// apps grid view.
constexpr int kEndCardifiedAnimationDuration = 350;
// The opacity for the background cards when hidden.
constexpr float kBackgroundCardOpacityHide = 0.0f;
......@@ -129,6 +125,9 @@ constexpr gfx::Tween::Type kFolderFadeInTweenType = gfx::Tween::EASE_IN_2;
constexpr gfx::Tween::Type kFolderFadeOutTweenType =
gfx::Tween::FAST_OUT_LINEAR_IN;
// Animation curve used for entering and exiting cardified state.
constexpr gfx::Tween::Type kCardifiedStateTweenType = gfx::Tween::EASE_OUT_2;
// Presentation time histogram for apps grid scroll by dragging.
constexpr char kPageDragScrollInClamshellHistogram[] =
"Apps.PaginationTransition.DragScroll.PresentationTime.ClamshellMode";
......@@ -2362,9 +2361,10 @@ void AppsGridView::AnimateCardifiedState() {
entry_view->layer()->GetAnimator());
animator.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
animator.SetTweenType(kCardifiedStateTweenType);
if (!cardified_state_) {
animator.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kEndCardifiedAnimationDuration));
base::TimeDelta::FromMilliseconds(kDefaultAnimationDuration));
}
// When the animations are done, discard the layer and reset view to
// proper scale.
......@@ -2381,11 +2381,12 @@ void AppsGridView::AnimateCardifiedState() {
background_card->SetTransform(translate_transform);
}
ui::ScopedLayerAnimationSettings animator(background_card->GetAnimator());
animator.SetTweenType(kCardifiedStateTweenType);
animator.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
if (!cardified_state_) {
animator.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kEndCardifiedAnimationDuration));
base::TimeDelta::FromMilliseconds(kDefaultAnimationDuration));
}
animator.AddObserver(this);
ui::AnimationThroughputReporter reporter(
......@@ -3241,10 +3242,6 @@ void AppsGridView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
items_need_layer_for_drag_ = false;
for (const auto& entry : view_model_.entries())
entry.view->DestroyLayer();
if (animator) {
animator->SetAnimationDuration(
base::TimeDelta::FromMilliseconds(kDefaultAnimationDuration));
}
}
void AppsGridView::MaybeCallOnBoundsAnimatorDone() {
......
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