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