我在网站上使用Material Design从谷歌和Polymer-Project工作。高分子材料设计纸阴影触摸
根据谷歌的Surface Response animation guide应该如轻敲对象时提升它在一定时间内,随着涟漪效应一起。读Paper-shadow docs我发现animated
参数可以设置为true,以动画元素z值(深度)的变化。
但是,我怎么改回为初始值?我可以设置计时器并重新应用初始值,但这似乎不是解决此问题的有效方法。既然是建议的行为添加此功能,我认为它应该以某种方式实现(或者也许是它的方式是什么?)
有谁知道如何解决这个问题?这里是当前的代码:
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/paper-shadow/paper-shadow.html">
<link rel="import" href="bower_components/paper-ripple/paper-ripple.html">
<polymer-element name="photo-album">
<template>
<style>
:host{
display: block;
position: relative;
background-color: white;
padding: 20px;
width: 200px;
}
polyfill-next-selector{ content: '.album-header img';}
.album-header ::content img{
margin-bottom: 10px;
}
polyfill-next-selector{ content: '.album-header h2';}
.album-header ::content h2{
color: #99182c;
font-family: 'RobotoDraft', sans-serif;
font-weight: normal;
margin: 0;
}
polyfill-next-selector{ content: '.album-header h3';}
.album-header ::content h3{
color: grey;
font-size: x-small;
font-family: 'RobotoDraft', sans-serif;
font-weight: normal;
margin: 0;
}
</style>
<paper-shadow z="{{shadowValue}}" animated="true"></paper-shadow>
<div class="album-header" vertical layout on-tap="{{albumTapped}}">
<paper-ripple class="recenteringTouch" fit></paper-ripple>
<content select="img"></content>
<content select="h2"></content>
<content select="h3"></content>
</div>
</template>
<script>
Polymer('photo-album', {
publish:{
shadowValue: 1
},
albumTapped: function(event, detail, sender){
this.shadowValue = 3;
}
});
</script>
</polymer-element>