在 Polymer 1.0 中完成 'neon-animatable' 页面动画时如何处理?
How to handle when a 'neon-animatable' page animation is completed in Polymer 1.0?
一旦选择了 neon-animatable
页面,页面的动画完成事件是否有处理程序?我在这里使用的 _onNeonAnimationFinish
方法只处理 dom-module
容器的动画完成事件。
模板片段:
<neon-animated-pages class="fit" selected="{{selectedPage}}" attr-for-selected="id" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation" on-iron-select="_pageChanged">
<neon-animatable id="page1" class="fit">1</neon-animatable>
<neon-animatable id="page2" class="fit">2</neon-animatable>
<neon-animatable id="page3" class="fit">3</neon-animatable>
</neon-animated-pages>
脚本:
Polymer({
is: "popup-view",
behaviors: [
Polymer.PaperDialogBehavior,
Polymer.NeonAnimationRunnerBehavior
],
listeners: {
'neon-animation-finish': '_onNeonAnimationFinish'
},
_onNeonAnimationFinish: function() {
console.log("*** _onNeonAnimationFinish ***"); // only called when container animation completes
if (this.opened) {
this._finishRenderOpened();
} else {
this._finishRenderClosed();
}
},
尝试将事件处理程序添加到 <neon-animated-pages>
元素。
<neon-animated-pages on-neon-animation-finish="_onNeonAnimationFinish" ...
一旦选择了 neon-animatable
页面,页面的动画完成事件是否有处理程序?我在这里使用的 _onNeonAnimationFinish
方法只处理 dom-module
容器的动画完成事件。
模板片段:
<neon-animated-pages class="fit" selected="{{selectedPage}}" attr-for-selected="id" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation" on-iron-select="_pageChanged">
<neon-animatable id="page1" class="fit">1</neon-animatable>
<neon-animatable id="page2" class="fit">2</neon-animatable>
<neon-animatable id="page3" class="fit">3</neon-animatable>
</neon-animated-pages>
脚本:
Polymer({
is: "popup-view",
behaviors: [
Polymer.PaperDialogBehavior,
Polymer.NeonAnimationRunnerBehavior
],
listeners: {
'neon-animation-finish': '_onNeonAnimationFinish'
},
_onNeonAnimationFinish: function() {
console.log("*** _onNeonAnimationFinish ***"); // only called when container animation completes
if (this.opened) {
this._finishRenderOpened();
} else {
this._finishRenderClosed();
}
},
尝试将事件处理程序添加到 <neon-animated-pages>
元素。
<neon-animated-pages on-neon-animation-finish="_onNeonAnimationFinish" ...