forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MD Settings: Shorten page fade transitions
Expanding or collapsing a section takes 350ms, but fading the new content in and the old content out takes 500ms. This is a contributing factor to the overlap seen when closing a section, as the old section is still visible when the collapse animation has completed. Shortening the fade duration to match the expand/collapse animation makes that overlap much less likely to occur. It also makes the animations appear snappier, IMO -- if the page is still fading after expanding, it looks slugging. This re-implements the fade animations, rather than programmatically changing the neon-animated-pages' transition durations for the existing fade-in-animation/fade-out-animation. The latter is not possible due to PolymerElements/neon-animation#209. [email protected] BUG=716680 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2856223007 Cr-Commit-Position: refs/heads/master@{#469582}
- Loading branch information
Showing
6 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
chrome/browser/resources/settings/animation/fade_animations.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/neon-animation-behavior.html"> | ||
<link rel="import" href="animation.html"> | ||
<script src="fade_animations.js"></script> |
51 changes: 51 additions & 0 deletions
51
chrome/browser/resources/settings/animation/fade_animations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/** | ||
* @fileoverview Defines fade animations similar to Polymer's fade-in-animation | ||
* and fade-out-animation, but with Settings-specific timings. | ||
*/ | ||
Polymer({ | ||
is: 'settings-fade-in-animation', | ||
|
||
behaviors: [Polymer.NeonAnimationBehavior], | ||
|
||
configure: function(config) { | ||
var node = config.node; | ||
this._effect = new KeyframeEffect( | ||
node, | ||
[ | ||
{'opacity': '0'}, | ||
{'opacity': '1'}, | ||
], | ||
/** @type {!KeyframeEffectOptions} */ ({ | ||
duration: settings.animation.Timing.DURATION, | ||
easing: settings.animation.Timing.EASING, | ||
fill: 'both', | ||
})); | ||
return this._effect; | ||
} | ||
}); | ||
|
||
Polymer({ | ||
is: 'settings-fade-out-animation', | ||
|
||
behaviors: [Polymer.NeonAnimationBehavior], | ||
|
||
configure: function(config) { | ||
var node = config.node; | ||
this._effect = new KeyframeEffect( | ||
node, | ||
[ | ||
{'opacity': '1'}, | ||
{'opacity': '0'}, | ||
], | ||
/** @type {!KeyframeEffectOptions} */ ({ | ||
duration: settings.animation.Timing.DURATION, | ||
easing: settings.animation.Timing.EASING, | ||
fill: 'both', | ||
})); | ||
return this._effect; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters