11
私はポリマーを学んでいます。私はdiv
を含む要素を持っています。そのdivの高さをアニメーション化したいこれを実行しようとする試みで、私は次のことを持っている:ポリマー - DIVのアニメーション
私-element.html
<dom-module id="my-element">
<template>
<div id="container" style="height:100px; background-color:green; color:white;">
Hello!
</div>
<paper-button on-click="_onTestClick">Expand</paper-button>
</template>
<script>
Polymer({
is: 'my-element',
_onTestClick: function() {
// expand the height of container
}
});
</script>
</dom-module>
私は、インスピレーションのためのhereを示すグロー高さのアニメーションを使用していました。私の挑戦がある
Polymer({
is: 'grow-height-animation',
behaviors: [
Polymer.NeonAnimationBehavior
],
configure: function(config) {
var node = config.node;
var rect = node.getBoundingClientRect();
var height = rect.height;
this._effect = new KeyframeEffect(node, [{
height: (height/2) + 'px'
}, {
height: height + 'px'
}], this.timingFromConfig(config));
return this._effect;
}
});
、私は「コンテナ」のidを持つdiv
要素で、このアニメーションを統合する方法を理解していない
div
をアニメーション化する方法を理解しようとしています。私は何が欠けていますか?
ありがとう!