Coder Social home page Coder Social logo

neon-animation's Introduction

⚠️ neon-animation is deprecated ⚠️

Please use the Web Animations API or CSS animations instead. See An Update on Neon Animation for more information.

Published on NPM Build status Published on webcomponents.org

neon-animation

neon-animation is a suite of elements and behaviors to implement pluggable animated transitions for Polymer Elements using Web Animations. Please note that these elements do not include the web-animations polyfill.

See: Documentation, Demo.

See the guide for detailed usage.

Usage

Installation

Element:

npm install --save @polymer/neon-animation

Polyfill:

npm install --save web-animations-js

In an HTML file

NeonAnimatableBehavior

Elements that can be animated by NeonAnimationRunnerBehavior should implement the NeonAnimatableBehavior behavior, or NeonAnimationRunnerBehavior if they're also responsible for running an animation.

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {NeonAnimatableBehavior} from '@polymer/neon-animation/neon-animatable-behavior.js';

class SampleElement extends mixinBehaviors([NeonAnimatableBehavior], PolymerElement) {
  static get template() {
    return html`
      <style>
        :host {
          display: block;
        }
      </style>

      <slot></slot>
    `;
  }
}
customElements.define('sample-element', SampleElement);

NeonAnimationRunnerBehavior

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {NeonAnimationRunnerBehavior} from '@polymer/neon-animation/neon-animation-runner-behavior.js';
import '@polymer/neon-animation/animations/scale-down-animation.js';

class SampleElement extends mixinBehaviors([NeonAnimationRunnerBehavior], PolymerElement) {
  static get template() {
    return html`
      <div>this entire element will be animated after one second</div>
    `;
  }

  connectedCallback() {
    super.connectedCallback();

    // must be set here because properties is static and cannot reference "this"
    this.animationConfig = {
      // provided by neon-animation/animations/scale-down-animation.js
      name: 'scale-down-animation',
      node: this,
    };

    setTimeout(() => this.playAnimation(), 1000);
  }
}
customElements.define('sample-element', SampleElement);

<neon-animatable>

A simple element that implements NeonAnimatableBehavior.

In an html file

<html>
  <head>
  </head>
  <body>
    <neon-animatable id="animatable">
      <div>this entire element and its parent will be animated after one second</div>
    </neon-animatable>
    <runner-element></runner-element>
    <script type="module">
      import {PolymerElement} from '@polymer/polymer';
      import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
      import {NeonAnimationRunnerBehavior} from '@polymer/neon-animation/neon-animation-runner-behavior.js';
      import '@polymer/neon-animation/neon-animatable.js';
      import '@polymer/neon-animation/animations/scale-down-animation.js';

      const animatable = document.getElementById('animatable');

      class SampleElement extends mixinBehaviors([NeonAnimationRunnerBehavior], PolymerElement) {
        connectedCallback() {
          super.connectedCallback();

          this.animationConfig = {
            // provided by neon-animation/animations/scale-down-animation.js
            name: 'scale-down-animation',
            // node is node to animate
            node: animatable,
          }

          setTimeout(() => this.playAnimation(), 1000);
        }
      }
      customElements.define('runner-element', SampleElement);
    </script>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {NeonAnimationRunnerBehavior} from '@polymer/neon-animation/neon-animation-runner-behavior.js';
import '@polymer/neon-animation/neon-animatable.js';
import '@polymer/neon-animation/animations/scale-down-animation.js';

class SampleElement extends mixinBehaviors([NeonAnimationRunnerBehavior], PolymerElement) {
  static get template() {
    return html`
      <div>this div will not be animated</div>
      <neon-animatable id="animatable">
        <div>this div and its parent will be animated after one second</div>
      </neon-animatable>
    `;
  }

  connectedCallback() {
    super.connectedCallback();

    // must be set here because properties is static and cannot reference "this"
    this.animationConfig = {
      // provided by neon-animation/animations/scale-down-animation.js
      name: 'scale-down-animation',
      node: this.$.animatable,
    };

    setTimeout(() => this.playAnimation(), 1000);
  }
}
customElements.define('sample-element', SampleElement);

<neon-animated-pages>

neon-animated-pages manages a set of pages and runs an animation when switching between them.

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/neon-animation/neon-animated-pages.js';
      import '@polymer/neon-animation/neon-animatable.js';
      import '@polymer/neon-animation/animations/slide-from-right-animation.js';
      import '@polymer/neon-animation/animations/slide-left-animation.js';
    </script>
  </head>
  <body>
    <neon-animated-pages
        id="pages"
        selected="0"
        entry-animation="slide-from-right-animation"
        exit-animation="slide-left-animation">
      <neon-animatable>1</neon-animatable>
      <neon-animatable>2</neon-animatable>
      <neon-animatable>3</neon-animatable>
      <neon-animatable>4</neon-animatable>
      <neon-animatable>5</neon-animatable>
    </neon-animated-pages>
    <button onclick="increase()">+</button>
    <button onclick="decrease()">-</button>
    <script>
      const pages = document.getElementById('pages');
      function increase() { pages.selected = pages.selected + 1 % 5; };
      function decrease() { pages.selected = (pages.selected - 1 + 5) % 5; };
    </script>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/neon-animation/neon-animated-pages.js';
import '@polymer/neon-animation/neon-animatable.js';
import '@polymer/neon-animation/animations/slide-from-right-animation.js';
import '@polymer/neon-animation/animations/slide-left-animation.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <neon-animated-pages
          id="pages"
          selected="0"
          entry-animation="slide-from-right-animation"
          exit-animation="slide-left-animation">
        <neon-animatable>1</neon-animatable>
        <neon-animatable>2</neon-animatable>
        <neon-animatable>3</neon-animatable>
        <neon-animatable>4</neon-animatable>
        <neon-animatable>5</neon-animatable>
      </neon-animated-pages>
      <button on-click="increase">+</button>
      <button on-click="decrease">-</button>
    `;
  }

  increase() {
    this.$.pages.selected = this.$.pages.selected + 1 % 5;
  }

  decrease() {
    this.$.pages.selected = (this.$.pages.selected - 1 + 5) % 5;
  }
}
customElements.define('sample-element', SampleElement);

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {NeonAnimationRunnerBehavior} from '@polymer/neon-animation/neon-animation-runner-behavior.js';
import '@polymer/neon-animation/animations/neon-animatable.js';
import '@polymer/neon-animation/animations/scale-down-animation.js';

class SampleElement extends mixinBehaviors([NeonAnimationRunnerBehavior], PolymerElement) {
  static get template() {
    return html`
      <div>this div will not be animated</div>
      <neon-animatable id="animatable">
        <div>this div and its parent will be animated after one second</div>
      </neon-animatable>
    `;
  }

  connectedCallback() {
    super.connectedCallback();

    // must be set here because properties is static and cannot reference "this"
    this.animationConfig = {
      // provided by neon-animation/animations/scale-down-animation.js
      name: 'scale-down-animation',
      node: this.$.animatable,
    };

    setTimeout(() => this.playAnimation(), 1000);
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/neon-animation
cd neon-animation
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm

neon-animation's People

Contributors

addyosmani avatar alancutter avatar aomarks avatar bicknellr avatar blasten avatar cdata avatar cprecioso avatar dependabot[bot] avatar dstoc avatar dzhioev avatar e111077 avatar ebidel avatar frankiefu avatar jklein24 avatar lp177 avatar majorbreakfast avatar masonlouchart avatar mgiuffrida avatar naoak avatar notwaldorf avatar rictic avatar robdodson avatar romanovx avatar samuelli avatar tedium-bot avatar timeu avatar tjsavage avatar valdrinkoshi avatar vguillou avatar zerodevx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neon-animation's Issues

Resize ignored because this.selectedItem is undefined.

Hi.

I wonder why in this file, the selectedPage is stored in a variable and used rather than be used directly in the callback.

I mean could this:

var selectedPage = this.selectedItem;
this.resizerShouldNotify = function(element) {
  return element == selectedPage;
}

be this:

this.resizerShouldNotify = function(element) {
  return element == this.selectedItem;
}

I've got an issue with this. I need to resize a child component of the selected page. When the previously callback is called, selectedItem is unknow. It could occured if the method _notifyPageResize is called before this method.

Recent Blink changes break <neon-animated-pages>

I've noticed that recent changes in Blink break <neon-animated-pages> in some cases.

Here is an small example, where the issue appears -- http://dzhioev.net:8080/animation_pages.html -- selected page is set to '1', but shortly after (before the transition is finished) selected page is set to '0'.

In the latest dev Chromium (which includes the noted Blink change), <neon-animated-pages> remains in inconsistent state after all transitions are finished: both pages have .neon-animating class set, which make them non-interactive (as .neon-animating implies pointer-events: none).
Dev Tools Screenshot
This happens because <neon-animated-pages> is set up to skip the first finish animation event after animation cancellation (_squelchNextFinishEvent), assuming that this event belongs to the cancelled animation.

Rapidly changing pages can lose track of 'neon-animating' class

If you rapidly switch between multiple pages, 'neon-animating' flag can get stuck on one of your pages. This causes the entire page to be unclickable.

The cause is that previous animation gets cancelled before it even starts, so _squelchNextFinishEvent flag does not get cleared by _neonAnimationFinish.

I have a simple fix, filing this to have a bug to reference.

Example using cascaded-animation with dom-repeat

I've been struggling to find an example of using cascaded-animation with dynamic content (dom-repeat). In the below snippet, {{ images }} is asynchronously set from an API call. Is it possible to wait / perform a cascaded animation once the images are loaded? I know Polymer.dom(this).querySelectorAll('.image') returns an empty result since dom-repeat has not created the elements when that line executes.

<template>
  <template is="dom-repeat" items="{{images}}">
    <div class="image" style$="{{ _computeStyle(item.data) }}">
      <div class="title">{{ item.data.title }}</div>
    </div>
  </template>
</template>

<script>
    Polymer({
      is: 'image-list',
      properties: {
        images: Array,

        animationConfig: {
          type: Object,
          value: function() {
            return {
              'enter': [{
                name: 'cascaded-animation',
                animation: 'transform-animation',
                transformFrom: 'translateY(100%)',
                nodes: Polymer.dom(this).querySelectorAll('.image')
              }]
            }
          }
        }
     ...
    }
</script>

can't use flex inside neon-animated-pages

I am using neon-animated-pages to animate the page. I have set it's height to 100%. I am using div inside it with background-image. But the height of div doesn't cover the entire browser height and is limited to it's content only. I have tried using flex with div but that also doesn't work. If I use this div outside of neon-animated-pages then it flexes well and cover the entire browser height.

What's going wrong inside neon-animated-pages?

neon-animation-finish is not triggered with shared animations.

Hi,
It seems the neon-animation-finish event is not triggered when using the ripple shared animation.
Both the incoming or outgoing pages can't listen on this event.

I want to 'reset' the shared Elements after the end of the ripple animation but I can't find out how without event.

Thanks in advance.

Animations shouldn't set properties in the configure method

For example, hero-animation does this in the configure method:

shared.from.style.visibility = 'hidden';

Because of this, delaying the hero-animation looks like a total disaster: the hero element is hidden before the hero-animation starts.

web-animations-js update breaks neon-animation.

Hi,

The last update (2.1.1) of web-animation-js breaks neon-animation.

How to reproduce:

  • Clone neon-animation
  • replace in bower.json : "web-animations-js": "web-animations/web-animations-js#^2.0.0" with "web-animations-js": "web-animations/web-animations-js#2.1.1"
  • bower update && polyserve
  • Try a demo

Thomas.

hero-id?

On the grid demo page the fullsize-page-with-card element has hero-id="hero" but there is no documentation on what hero-id is or why it is needed.

Reliance on paper-styles adds bloat

neon-animated-pages.html imports ../paper-styles/paper-styles.html which brings with it a considerable amount of assets (iron-flex-layout, Roboto font from Google Fonts, paper theming, etc.).

What's the recommended course of action to exclude this? Right now, I'm not using any page transitions at all, so I can simply remove the import of neon-animated-pages.html from neon-animation.html but that's not a good long term solution given a bower update would kill that change.

Should paper-styles even be required in the first place? Would a paper-specific version of neon-animation make sense so that neon-animation itself is as basic a component that doesn't care or make assumptions about your theming? Or, should paper require neon-animation instead?

Cascade animation doesn't call complete of each animations.

Hi,

I noticed that the complete function is not defined in cascaded-animation. Is this intentional ?
I think this function should call the complete method of each animations composing the cascade.

I could implement this feature if interested.

Thomas

Missing files for demo

One of the animations used in the demos appears to be missing:

neon-animation/animations/slide-up-scale-down-animation.html

Also, I think paper-styles should be in the regular dependencies rather than devDependencies.

Fixed Positioning inside neon-pages

How does one correctly set up fixed positioning inside a neon-animatable? I am trying to get a paper-fab to hover in the bottom right corner over a list but it only works correctly on page load; after an animation it disappears off the visible screen. However, if I toggle any css attribute on it or its parents in the dev inspector, the element appears correctly again. It feels like it just needs a hint to reflow or something.

I've tried toggling styles using js in the neon-animation-finish event to no avail.

Exert from custom element

<style>
    paper-fab {
      position: fixed;
      bottom: 30px;
      right: 30px;
    }
  </style>

  <template>
     <!-- list stuff; (enough to make the page scroll) --!>
      <paper-fab icon="add" elevation="3"></paper-fab>
   </template>

Page it's hosted on...

<neon-animated-pages id="main-pages-container" attr-for-selected="data-route" selected="[[route]]" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation">
<neon-animatable data-route="foo">
   <custom-element></custom-element>
</neon-animatable>
</neon-animated-pages>

Update: Only happens on Google Chrome 43.0.2357.125 (Official Build) (64-bit). Firefox seems to work great. I assume the polyfills take care of it.

Update2: It also works on chrome if the page I'm coming from has enough content that it had a vertical scrollbar.

Changing transition animations on the fly

Changing the exit animation of neon-animated-pages by modifying animationConfig object did not work for me. I tried to switch from 'scale-down-animation' to hero animation dynamically, but it did not work.

'fade-out-animation' flickers on mobile web app

When I played fade-out-animation on my android web app, the fading out page flickered at beginning, then it worked normally. This problem disappeared after I removed the opaque-animation hacky codes from 'neon-animated-pages.html' and 'neon-animatable-behavior.html'.

This problem only happened on my android web app(cordova + system webview), can't reproduce on my android chrome browser. my android version: 5.1.1, nexus 9.

Clarification on when to insert "opaque-animation"

@morethanreal referring to https://github.com/PolymerElements/neon-animation/blob/master/neon-animatable-behavior.html#L53,

   _entryAnimationChanged: function() {
      this.animationConfig = this.animationConfig || {};
      if (this.entryAnimation !== 'fade-in-animation') {
        // insert polyfill hack
        this.animationConfig['entry'] = [{
          name: 'opaque-animation',
          node: this
        }, {
          name: this.entryAnimation,
          node: this
        }];
      } else {
        this.animationConfig['entry'] = [{
          name: this.entryAnimation,
          node: this
        }];
      }
    },

shouldn't the polyfill hack be inserted only if this.animationConfig === "fade-in-animation"?

Using attr-for-selected breaks neon-animated-pages

Hi @morethanreal,

1). Using _IronSelectableBehavior_'s attr-for-selected property to assign custom labels for child nodes under neon-animated-pages breaks page transitions. This is because inside neon-animated-pages's _selectedChanged method, this.selected is used to retrieve the index position for the items array. This will not work if this.selected is not a number.

var selectedPage = this.items[this.selected];
var oldPage = this.items[this._prevSelected];
this._prevSelected = this.selected;

It might be better to use _IronSelectableBehavior_'s itemSelected property to get the current selected node instead, while using _prevSelected to store the object reference to the previous page.

var selectedPage = this.selectedItem;
var oldPage = this._prevSelected;
this._prevSelected = selectedPage;

2). Also, the current implementation does not play entry animations for the first selected page, which is inconsistent with 0.5 core-animated-pages's behaviour (as I recall, but it could also be due to having the <body unresolved> attribute set - this fades in the page - to prevent FOUC?).

I can imagine valid use-cases for both behaviours, i.e. having the very first selected page to display directly, or having that page conform to its predefined entry animation. What I propose is to expose an animate-first-selected property as part of neon-animated-pages's API, allowing us to declaratively set the desired behaviour.

3). I'm not sure how I can contribute - I'm new to this - so I forked the repo and added the above 2 updates for your reference; I will submit the pull request in a bit.

Regards,
Jason

Fade-in-animation has a flicker issue

I am seeing a flicker problem for dialogs using the fade-in-animation: When dialog.open() is called the dialog appears instantly, disappears after maybe 100mS, then fades in normally.

The problem is sporadic, and occurs on Firefox, IE, and Edge, but never on Chrome (perhaps indicating a race condition in the polyfill code?). The problem occurs most frequently on IE 11 and Edge.

For now, I have replaced the fade-in-animation with the scale-up-animation which does not appear to exhibit the problem.

[grid] Unexpected takeover artefacts in Safari & Firefox

Video (play at 0.25x speed): https://www.youtube.com/watch?v=FvQnNyj95HY&feature=youtu.be
Tested against: neon-animated-pages/demo/grid/

When selecting a grid item in Safari or Firefox, a full-screen takeover occurs..

screen shot 2015-05-12 at 10 30 55

before returning to this state

screen shot 2015-05-12 at 10 31 08

after which, the correct takeover animation occurs.

screen shot 2015-05-12 at 10 32 46

I haven't noticed this in Chrome (or at least, if it occurs it's quick enough that I don't see it). This may be related to the Web Animations polyfill.

Minor error in README.md

Under Page Transitions, children nodes should implement NeonAnimatableBehavior instead of IronAnimatableBehavior.

Passing in distributed content into <neon-animated-pages> breaks removal of .neon-animating class

If we pass in <content> into <neon-animated-pages> page changing breaks after the first page change. For instance,

<neon-animated-pages selected="0">
  <content></content>
</neon-animated-pages>

This is because the .neon-animating class is not properly removed from the two affected pages (old page and new page). The method responsible is the _completeSelectedChanged function.

  _completeSelectedChanged: function(oldPage, selectedPage) {
    console.log("_completeSelectedChanged",oldPage,selectedPage);
    if (selectedPage) {
      selectedPage.classList.remove('neon-animating');
    }
    if (oldPage) {
      oldPage.classList.remove('neon-animating');
    }
    if (!selectedPage || !oldPage) { // the issue lies here
      var nodes = Polymer.dom(this).querySelectorAll('.neon-animating');
      for (var node, index = 0; node = nodes[index]; index++) {
        node.classList.remove('neon-animating');
      }
    }
    this.async(this.notifyResize);
  },

Since <neon-animated-pages> implements IronSelectableBehavior, we can use the in-built items array which contains the correct list of selectable nodes to remove the .neon-animating class from, perhaps like this:

  if (!selectedPage || !oldPage) { // this might be better
    this.items.forEach(function (node) {
      node.classList.remove('neon-animating');
    });
  }

This fixes the mentioned issue; I'll add this commit into my fork that fixes the attr-for-selected issue #8 together later for your reference.

Thanks

Template dom-repeat in <neon-animated-pages>.

Hi,

I am trying to use a dom-repeat template inside of a neon-animated-pages element.
To demo that, I modified the declarative demo. It is available here.

The problem is when I try to reach the next page the first time the animation isn't played. The next times work well.

The issue is maybe due to an implementation in iron-selectable-behavior.

I found a workaround. I listen for the dom-change event on neon-animated-pages and execute this code in the handler to call the neon-animated-pages _selectedChanged method:

  var selected = this.$.pages.selected;
  this.$.pages.selected = null;
  this.$.pages.selected = selected;

Anyone has an idea ?
Thanks,
Thomas

Slide up/down animation does not work

Is it just me or the slide-up-animation and slide-down-animation are not working ? I don't know how to make them work. Is it possible to have an example of the configuration to provide in animationConfig?

Pleaaaaaase 😺

can't use flex inside neon-animated-pages

I am using neon-animated-pages to animate the page. I have set it's height to 100%. I am using div inside it with background-image. But the height of div doesn't cover the entire browser height and is limited to it's internal content only. I have tried using flex with div but that also doesn't work. If I use this div outside of neon-animated-pages then it flexes well and cover the entire browser height.

What's going wrong inside neon-animated-pages?

neon-animated-pages reverse animation?

Hello,

I'm using neon-animated-pages which is working fine, but the trouble is "reversing" the animation when the user navigates backwards in the UI.

So imagine this:

<neon-animated-pages id="pages" class="flex fit" selected="[[selectedPage]]">
  <a-page>...</a-page>
  <a-page>...</a-page>
</neon-animated-pages>

The initial value of selectedPage is 0 which is fine, the first page is shown. The user presses a button on this page and selectedPage is now 1. In my case, slide-from-right-animation is run and the pages move "forward" as you would expect. The user now presses an internal back button and the selectedPage variable is changed from 1 to 0 -- moving backwards. The same animation is still run however, making it look like the page is moving forward although its in reality moving backwards.

I hope this makes sense, if not, I'll clarify.

Is there a way to make the animation reverse when you move backwards, i.e., running slide-from-left-animation instead?

Thanks

Any reason why this._player.cancel() is called once animations finish in playAnimation function?

I asked a question on SO a few days ago regarding maintaining the end state of a neon animation (http://stackoverflow.com/questions/31692377/how-to-maintain-the-end-state-of-a-neon-animation-in-polymer) and today I found this piece of code inside the function playAnimation in neon-animation-runner-behavior.html.

playAnimation: function(type, cookie) {
  var allConfigs = this.getAnimationConfig(type);
  if (!allConfigs) {
    return;
  }
  var allAnimations = this._configureAnimationEffects(allConfigs);
  var allEffects = allAnimations.map(function(animation) {
    return animation.effect;
  });

  if (allEffects.length > 0) {
    this._player = this._runAnimationEffects(allEffects);
    this._player.onfinish = function() {
      this._completeAnimations(allAnimations);

      if (this._player) {
        // not sure why this is needed?
        this._player.cancel();
        this._player = null;
      }

      this.fire('neon-animation-finish', cookie, {bubbles: false});
    }.bind(this);

  } else {
    this.fire('neon-animation-finish', cookie, {bubbles: false});
  }
},

I don't really understand why we need to cancel the animation upon the completion of it. Doing so will remove all effects from the source object and I have to manually set its final state once the animation finishes.

Can someone please shed some light on this?

Impossible to configure animation after the element has been created.

I have <paper-dialog> element, which is statically declared on the page. I'd like to configure its entry and exit animations - and I do so in my WebComponentsReady event handler.

        // configure modal dialog's animations
        this.modalDialog.animationConfig = {
            value: function () {
                return {

                    // scale up
                    'entry': {
                        name: 'scale-up-animation',
                        node: this,
                        timing: { duration: 200, easing: 'ease-out' }
                    },

                    // fade out
                    'exit': {
                        name: 'fade-out-animation',
                        node: this,
                        timing: { duration: 100 }
                    }
                }
            }.bind( this.modalDialog )
        };

No effect. It works ( without .bind(...) ) part if I make my own element and configure animation in properties {} block, but it's awfully cumbersome to do so just for that.

Additionally, animationConfig value is a Function - I'd expect it to be called every time you call .playAnimation() to be able to modify animation parameters, if needed, based on current state of the element, but it seems the animations are pre-configured during initialization, and are not modifiable.

Minor error in README

my-dialog hide function has a minor error.

this.playAnimation('fade-out-animation')

should be

this.playAnimation('exit')

No equivalent of 'core-animated-pages-transition-prepare'

What's the equivalent of core-animated-pages-transition-prepare in <neon-animated-pages>?

Specifically I need to trigger measureHeaderHeight on my <paper-scroll-header-panel> before it's actually shown, but after it is 'visible' in the DOM.

Per: http://stackoverflow.com/questions/32555991/whats-the-equivalent-of-core-animated-pages-transition-prepare-in-neon-anima it seems to be the case the event is missing in the new <neon-animation>-element.

Scale-up-animation, cascade-animation stopped working after update

The scale-up-animation worked until I did bower update a few days ago. Now only the fade-out-animation work. Replacing the entry-animation with other animations work. Also cascade-animation stopped working after that update. The scale-up-animation used in the dropdown example stopped working too. What am I missing?

<paper-dialog id="lDiag" entry-animation="scale-up-animation" exit-animation="fade-out-animation">
            <h2>Hi</h2>
                <p>Hello</p>
            <div class="buttons">
                <paper-button dialog-dismiss>Cancel</paper-button>
                <paper-button dialog-confirm on-tap="showTDetails">OK</paper-button>
            </div>
   </paper-dialog>

TypeError: this.unlisten is not a function at neon-animated-pages... With Iron-Dropdown

Chrome throws the following error when refreshing on a page with <iron-dropdown> inside <neon-animated-pages>. Everything is fine if I load a different page and then navigate to the same page (SPA). I'm not sure if it's some sort of bug related to a race condition, or my own implementation fault. (My apologies if this should have been reported in the iron-resizable repo)

Error

TypeError: this.unlisten is not a function at neon-animated-pages.Polymer.IronResizableBehavior.stopResizeNotificationsFor (.../iron-resizable-behavior/iron-resizable-behavior.html:119:14) at iron-dropdown.Polymer.IronResizableBehavior.detached (.../iron-resizable-behavior/iron-resizable-behavior.html:76:31) at iron-dropdown.Polymer.Base._addFeature._invokeBehavior (.../polymer/polymer-micro.html:283:4) at iron-dropdown.<anonymous> (.../polymer/polymer-micro.html:276:6) at Array.forEach (native) at iron-dropdown.Polymer.Base._addFeature._doBehavior (.../polymer/polymer-micro.html:275:16) at iron-dropdown.Polymer.Base.detachedCallback (.../polymer/polymer-micro.html:117:6) at Object.Polymer.DomApi.DomApi.appendChild (.../polymer/polymer-mini.html:441:19) at dom-repeat.Polymer._detachRow (.../polymer/polymer.html:3429:23) at dom-repeat.Polymer._render (.../polymer/polymer.html:3303:6)

Relevant function causing the error
    stopResizeNotificationsFor: function(target) {
      var index = this._interestedResizables.indexOf(target);

      if (index > -1) {
        this._interestedResizables.splice(index, 1);
        this.unlisten(target, 'iron-resize', '_onDescendantIronResize');
      }
    },
Variables

this = neon-animated-pages#main-pages-container.fit.style-scope
target = iron-dropdown#dropdown.style-scope.paper-menu-button

Stack overflow during animation

A stack overflow exception is thrown when an animated dialog is repeatedly opened and dismissed in rapid fire succession. In my case, I'm using a toolbar icon button to open/dismiss the dialog. The exception is not thrown if animation is removed from the dialog. Here is a stack trace:

RangeError: Maximum call stack size exceeded
at Object.DomApi.querySelectorAll (.../polymer/polymer/polymer-mini.html:649:28)
at Object.DomApi.querySelector (.../polymer/polymer/polymer-mini.html:647:13)
at paper-dialog._focusNode (.../polymer/iron-overlay-behavior/iron-overlay-behavior.html:154:32)
at paper-dialog.Polymer.IronOverlayBehaviorImpl._applyFocus (.../polymer/iron-overlay-behavior/iron-overlay-behavior.html:375:13)
at Object.focusOverlay (.../polymer/iron-overlay-behavior/iron-overlay-manager.html:74:17)
at paper-dialog.Polymer.IronOverlayBehaviorImpl._applyFocus (.../polymer/iron-overlay-behavior/iron-overlay-behavior.html:376:23)
at Object.focusOverlay (.../polymer/iron-overlay-behavior/iron-overlay-manager.html:74:17)
at paper-dialog.Polymer.IronOverlayBehaviorImpl._applyFocus (.../polymer/iron-overlay-behavior/iron-overlay-behavior.html:376:23)
at Object.focusOverlay (.../polymer/iron-overlay-behavior/iron-overlay-manager.html:74:17)
at paper-dialog.Polymer.IronOverlayBehaviorImpl._applyFocus (.../polymer/iron-overlay-behavior/iron-overlay-behavior.html:376:23)

Orphaned neon-animating class causing page overlap.

Changing the selected page before the current animation finishes causes the neon-animating class to remain on the neon-animatable being selected and the previously selected neon-animatable. In my case, this is causing both pages to be opened and overlap each other. This may be related to #46.

I'm able to reproduce the orphaned neon-animating class in the 'declarative' demo for neon-animated-pages (although it doesn't seem to have an adverse effect in this case). Here's a link to that demo: https://elements.polymer-project.org/elements/neon-animation?view=demo:demo/index.html&active=neon-animated-pages

To reproduce in the demo:

  1. Click '>>' to transition to page 2
  2. Click '<<' to transition to page 1 before the animation to page 2 completes.
  3. Notice that both the neon-animatable for page 1 and 2 have the neon-animating class.

As a note, I only saw this problem after I updated to Chrome v45.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.