我在網站上使用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>