查看 Polymer core-animated-pages 元素https://elements.polymer-project.org/elements/neon-animation
他们有一些很棒的演示,与有意义的过渡非常相似https://elements.polymer-project.org/elements/neon-animation?view=demo:demo/index.html&active=neon-animated-pages
“图标到顶部栏”演示可能与您引用的最相似(您可以查看源代码以查看使用的 Polymer Web 组件以及必要的 CSS 和 JS
您可以通过 Bower 导入到您的项目中:
bower install Polymer/core-animated-pages
并用属性包装你的元素并定义转换
这是该交叉淡入淡出示例的代码:
<style>
#hero1 {
position: absolute;
top: 0;
left: 0;
width: 300px;
height: 300px;
background-color: orange;
}
#hero2 {
position: absolute;
top: 200px;
left: 300px;
width: 300px;
height: 300px;
background-color: orange;
}
#bottom1, #bottom2 {
position: absolute;
bottom: 0;
top: 0;
left: 0;
height: 50px;
}
#bottom1 {
background-color: blue;
}
#bottom2 {
background-color: green;
}
</style>
// hero-transition and cross-fade are declared elsewhere
<core-animated-pages transitions="hero-transition cross-fade">
<section id="page1">
<div id="hero1" hero-id="hero" hero></div>
<div id="bottom1" cross-fade></div>
</section>
<section id="page2">
<div id="hero2" hero-id="hero" hero></div>
<div id="bottom2" cross-fade></div>
</section>
</core-animated-pages>