Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/polymer/v1_0/components-chromium/app-layout/app-scroll-effects/effects/parallax-background-extracted.js

Issue 1984963002: Roll Polymer elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /**
2 * Vertically translate the background based on a factor of the scroll positio n.
3 */
4 Polymer.AppLayout.registerEffect('parallax-background', {
5 /**
6 * @param {{scalar: string}} config
7 * @this Polymer.AppLayout.ElementWithBackground
8 */
9 setUp: function setUp(config) {
10 var scalar = parseFloat(config.scalar);
11
12 this._deltaBg = this.$.backgroundFrontLayer.offsetHeight - this.$.backgrou nd.offsetHeight;
13 if (this._deltaBg === 0) {
14 if (isNaN(scalar)) {
15 scalar = 0.8;
16 }
17 this._deltaBg = this._dHeight * scalar;
18 } else {
19 if (isNaN(scalar)) {
20 scalar = 1;
21 }
22 this._deltaBg = this._deltaBg * scalar;
23 }
24 },
25 /** @this Polymer.AppLayout.ElementWithBackground */
26 tearDown: function tearDown() {
27 delete this._deltaBg;
28 },
29 /** @this Polymer.AppLayout.ElementWithBackground */
30 run: function run(p, y) {
31 this.transform('translate3d(0px, ' + (this._deltaBg * Math.min(1, p)) + 'p x, 0px)', this.$.backgroundFrontLayer);
32 if (this.$.backgroundRearLayer) {
33 this.transform('translate3d(0px, ' + (this._deltaBg * Math.min(1, p)) + 'px, 0px)', this.$.backgroundRearLayer);
34 }
35 }
36 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698