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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/app-layout/app-scroll-effects/effects/parallax-background-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/app-layout/app-scroll-effects/effects/parallax-background-extracted.js b/third_party/polymer/v1_0/components-chromium/app-layout/app-scroll-effects/effects/parallax-background-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..06ed13a3c419def68d77ee9bf1ff7c4d6806c44b
--- /dev/null
+++ b/third_party/polymer/v1_0/components-chromium/app-layout/app-scroll-effects/effects/parallax-background-extracted.js
@@ -0,0 +1,36 @@
+/**
+ * Vertically translate the background based on a factor of the scroll position.
+ */
+ Polymer.AppLayout.registerEffect('parallax-background', {
+ /**
+ * @param {{scalar: string}} config
+ * @this Polymer.AppLayout.ElementWithBackground
+ */
+ setUp: function setUp(config) {
+ var scalar = parseFloat(config.scalar);
+
+ this._deltaBg = this.$.backgroundFrontLayer.offsetHeight - this.$.background.offsetHeight;
+ if (this._deltaBg === 0) {
+ if (isNaN(scalar)) {
+ scalar = 0.8;
+ }
+ this._deltaBg = this._dHeight * scalar;
+ } else {
+ if (isNaN(scalar)) {
+ scalar = 1;
+ }
+ this._deltaBg = this._deltaBg * scalar;
+ }
+ },
+ /** @this Polymer.AppLayout.ElementWithBackground */
+ tearDown: function tearDown() {
+ delete this._deltaBg;
+ },
+ /** @this Polymer.AppLayout.ElementWithBackground */
+ run: function run(p, y) {
+ this.transform('translate3d(0px, ' + (this._deltaBg * Math.min(1, p)) + 'px, 0px)', this.$.backgroundFrontLayer);
+ if (this.$.backgroundRearLayer) {
+ this.transform('translate3d(0px, ' + (this._deltaBg * Math.min(1, p)) + 'px, 0px)', this.$.backgroundRearLayer);
+ }
+ }
+ });

Powered by Google App Engine
This is Rietveld 408576698