Sha256: 483549154f9b81e2383465bc4b56999ed8a25c78c7eedb310b0b250b239304d1

Contents?: true

Size: 1.75 KB

Versions: 5

Compression:

Stored size: 1.75 KB

Contents

<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../app-scroll-effects-behavior.html">

<script>
  /**
   * While scrolling down, fade in the rear background layer and fade out the front background
   * layer (opacity interpolated based on scroll position).
   */
  Polymer.AppLayout.registerEffect('blend-background', {
    /** @this Polymer.AppLayout.ElementWithBackground */
    setUp: function setUp() {
      var fx = {};
      fx.backgroundFrontLayer = this._getDOMRef('backgroundFrontLayer');
      fx.backgroundRearLayer = this._getDOMRef('backgroundRearLayer');
      fx.backgroundFrontLayer.style.willChange = 'opacity';
      fx.backgroundFrontLayer.style.transform = 'translateZ(0)';
      fx.backgroundRearLayer.style.willChange = 'opacity';
      fx.backgroundRearLayer.style.transform = 'translateZ(0)';
      fx.backgroundRearLayer.style.opacity = 0;
      this._fxBlendBackground = fx;
    },
    /** @this Polymer.AppLayout.ElementWithBackground */
    run: function run(p, y) {
      var fx = this._fxBlendBackground;
      fx.backgroundFrontLayer.style.opacity = 1 - p;
      fx.backgroundRearLayer.style.opacity = p;
    },
    /** @this Polymer.AppLayout.ElementWithBackground */
    tearDown: function tearDown() {
      delete this._fxBlendBackground;
    }
  });
</script>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jekyll-polymer-magazine-0.1.4 assets/bower_components/app-layout/app-scroll-effects/effects/blend-background.html
jekyll-polymer-magazine-0.1.3 assets/bower_components/app-layout/app-scroll-effects/effects/blend-background.html
jekyll-polymer-magazine-0.1.2 assets/bower_components/app-layout/app-scroll-effects/effects/blend-background.html
jekyll-polymer-magazine-0.1.1 assets/bower_components/app-layout/app-scroll-effects/effects/blend-background.html
jekyll-polymer-magazine-0.1.0 assets/bower_components/app-layout/app-scroll-effects/effects/blend-background.html