私は、cascaded-animation
ととhero-animation
を一緒に使用する小さなアプリケーションを持っていますhere。ポリマーネオンアニメーション:カスケードアニメーションとヒーローアニメーションを一緒に使う方法は?
問題がWebComponentsReady
イベントにin the official documentation
<style>
:host {
display: block;
visibility: hidden;
}
</style>
index.html
リッスン私library-element
にshow
機能を呼び出すためのload
デモのように、私の主な要素は、視認性に隠さに設定されていることである。
<script>
document.addEventListener('WebComponentsReady', function() {
document.querySelector('library-element').show();
});
</script>
show
メソッドは、ライブラリ要素visible
を作成し、アニメーションを呼び出します。
show: function() {
this.style.visibility = 'visible';
this.playAnimation('entry');
}
私が今持っている問題は、showメソッドがプレイしたいと、私は entry
アニメーションを持っている子要素をアニメーション化という点です。 A cascaded-animation
およびhero-animation
である。
animationConfig: {
type: Object,
value: function() {
return {
'entry': [{
name: 'cascaded-animation',
animation: 'scale-up-animation',
}, {
name: 'hero-animation',
id: 'hero',
toPage: this
}],
'exit': [{
name: 'hero-animation',
id: 'hero',
fromPage: this
}, {
name: 'fade-out-animation',
node: this
}]
}
}
}
これはhero-animation
休憩のでhero-animation
が必要ですfromPage
が定義されていないので、プレイしていないcascaded-animation
になります。
これは私が取得警告です:結果はcascaded-animation
を起動時に実行されないということである
polymer-mini.html:2061 Uncaught TypeError: CreateListFromArrayLike called on non-object
:
hero-animation: fromPage is undefined!
これは私が取得エラーメッセージです。
推奨ソリューション:
ONE:のみ最初のアニメーションを再生するには、私のindex.html
にshow
方法を変更する方法を見つけます。たぶん、このような何か:
show: function() {
this.style.visibility = 'visible';
this.playAnimation(['entry'][0]);
}
TWO:このからライン40でneon-shared-element-animation-behavior.html
を変更します。それはマイナー前にしたものに
if (!fromPage || !toPage) {
console.warn(this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!');
return null;
};
:これに
if (!fromPage || !toPage) {
Polymer.Base._warn(this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!');
return null;
};
neon-animation
要素の1.2.2に修正してください。そうすれば、少なくともアニメーションを破る代わりに警告を発するだけで、アニメーションを再生することができます。ここで
は、できるだけ頻繁にあなたが望むよう任意の紙カード上DEMO
クリックでヒーローをトリガーとアニメーションをカスケード接続して観察するために、あなたは、カスケード接続のアニメーションが起動されていないウィンドウを更新するたびに。
にはどうすればhero-animation
との組み合わせでcascaded-animation
プレーを作るのですか?