Commit 92339b8f authored by jennyz@chromium.org's avatar jennyz@chromium.org

Use the new animation tween types to improve the animation effects for app list folder operation.

BUG=342832

Review URL: https://codereview.chromium.org/162363002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251128 0039d316-1c4b-4281-b951-d872f2087c98
parent d7309448
......@@ -36,14 +36,23 @@ const int kPageTransitionDurationInMs = 180;
// Duration in milliseconds for over scroll page transition.
const int kOverscrollPageTransitionDurationMs = 50;
// Duration in milliseconds for the target page transition when opening or
// closing a folder.
const int kFolderTransitionInDurationMs = 200;
// Duration in milliseconds for fading in the target page when opening
// or closing a folder, and the duration for the top folder icon animation
// for flying in or out the folder.
const int kFolderTransitionInDurationMs = 400;
// Duration in milliseconds for fading out the old page when opening or
// closing a folder.
// Duration in milliseconds for fading out the old page when opening or closing
// a folder.
const int kFolderTransitionOutDurationMs = 30;
// Animation curve used for fading in the target page when opening or closing
// a folder.
const gfx::Tween::Type kFolderFadeInTweenType = gfx::Tween::EASE_IN_2;
// Animation curve used for fading out the target page when opening or closing
// a folder.
const gfx::Tween::Type kFolderFadeOutTweenType = gfx::Tween::EASE_IN_3;
// Preferred number of columns and rows in apps grid.
const int kPreferredCols = 4;
const int kPreferredRows = 4;
......
......@@ -8,6 +8,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/app_list/app_list_export.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/animation/tween.h"
namespace app_list {
......@@ -36,6 +37,8 @@ APP_LIST_EXPORT extern const int kPageTransitionDurationInMs;
APP_LIST_EXPORT extern const int kOverscrollPageTransitionDurationMs;
APP_LIST_EXPORT extern const int kFolderTransitionInDurationMs;
APP_LIST_EXPORT extern const int kFolderTransitionOutDurationMs;
APP_LIST_EXPORT extern const gfx::Tween::Type kFolderFadeInTweenType;
APP_LIST_EXPORT extern const gfx::Tween::Type kFolderFadeOutTweenType;
APP_LIST_EXPORT extern const int kPreferredCols;
APP_LIST_EXPORT extern const int kPreferredRows;
......
......@@ -99,7 +99,8 @@ void AppListFolderView::ScheduleShowHideAnimation(bool show,
UpdateFolderNameVisibility(true);
ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator());
animation.SetTweenType(gfx::Tween::EASE_IN_2);
animation.SetTweenType(
show ? kFolderFadeInTweenType : kFolderFadeOutTweenType);
animation.AddObserver(this);
animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
show ? kFolderTransitionInDurationMs : kFolderTransitionOutDurationMs));
......
......@@ -676,7 +676,8 @@ void AppsGridView::ScheduleShowHideAnimation(bool show) {
ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator());
animation.AddObserver(this);
animation.SetTweenType(gfx::Tween::EASE_IN_2);
animation.SetTweenType(
show ? kFolderFadeInTweenType : kFolderFadeOutTweenType);
animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
show ? kFolderTransitionInDurationMs : kFolderTransitionOutDurationMs));
......
......@@ -55,9 +55,11 @@ void FolderBackgroundView::UpdateFolderContainerBubble(ShowState state) {
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds((kBubbleTransitionDurationMs)));
if (show_state_ == SHOW_BUBBLE) {
settings.SetTweenType(gfx::Tween::EASE_OUT_2);
layer()->SetOpacity(1.0f);
layer()->SetTransform(gfx::Transform());
} else {
settings.SetTweenType(gfx::Tween::EASE_IN_3);
layer()->SetOpacity(0.0f);
layer()->SetTransform(transform);
}
......
......@@ -58,6 +58,7 @@ void TopIconAnimationView::TransformView() {
// closing a folder.
ui::ScopedLayerAnimationSettings settings(layer()->GetAnimator());
settings.AddObserver(this);
settings.SetTweenType(gfx::Tween::EASE_IN_OUT_2);
settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kFolderTransitionInDurationMs));
layer()->SetTransform(open_folder_ ? gfx::Transform() : transform);
......
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