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

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

Issue 2633633002: Polymer: Remove unused app-layout element (Closed)
Patch Set: Fix closure Created 3 years, 11 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 fx = {};
11 var scalar = parseFloat(config.scalar);
12 fx.background = this._getDOMRef('background');
13 fx.backgroundFrontLayer = this._getDOMRef('backgroundFrontLayer');
14 fx.backgroundRearLayer = this._getDOMRef('backgroundRearLayer');
15 fx.deltaBg = fx.backgroundFrontLayer.offsetHeight - fx.background.offsetHe ight;
16 if (fx.deltaBg === 0) {
17 if (isNaN(scalar)) {
18 scalar = 0.8;
19 }
20 fx.deltaBg = this._dHeight * scalar;
21 } else {
22 if (isNaN(scalar)) {
23 scalar = 1;
24 }
25 fx.deltaBg = fx.deltaBg * scalar;
26 }
27 this._fxParallaxBackground = fx;
28 },
29 /** @this Polymer.AppLayout.ElementWithBackground */
30 run: function run(p, y) {
31 var fx = this._fxParallaxBackground;
32 this.transform('translate3d(0px, ' + (fx.deltaBg * Math.min(1, p)) + 'px, 0px)', fx.backgroundFrontLayer);
33 if (fx.backgroundRearLayer) {
34 this.transform('translate3d(0px, ' + (fx.deltaBg * Math.min(1, p)) + 'px , 0px)', fx.backgroundRearLayer);
35 }
36 },
37 /** @this Polymer.AppLayout.ElementWithBackground */
38 tearDown: function tearDown() {
39 delete this._fxParallaxBackground;
40 }
41 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698