我在 Apple.com 上发现了一个非常感兴趣的动画效果
http://store.apple.com/au/buy-mac/mac-pro
顶部菜单栏,非常有趣的菜单栏动画,因为图像也是有弹性的。我在下面做了一个快速实验,它可以正常工作,但没有得到弹性效果,有人可以帮忙吗?想将这种影响用于我的项目。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('ul').click(function() {
$('ul li').each(function(i) {
var $li = $(this);
setTimeout(function() {
$li.attr('style', 'styel="-webkit-transform: translateX(500px);"');
}, i*100); // delay 100 ms
});
});
})
</script>
<style type="text/css">
li
{
float: left;
-webkit-transition-property: -webkit-transform,left,-webkit-box-shadow;
-moz-transition-property: -webkit-transform,left,-webkit-box-shadow;
transition-property: -webkit-transform,left,-webkit-box-shadow;
-moz-transition-property: -moz-transform,left,-moz-box-shadow;
-ms-transition-property: -ms-transform,left,box-shadow;
-o-transition-property: -o-transform,left,box-shadow;
-webkit-transition-duration: .4s,0.4s,100ms;
-moz-transition-duration: .4s,0.4s,100ms;
transition-duration: .4s,0.4s,100ms;
-moz-transition-duration: .4s,0.4s,100ms;
-ms-transition-duration: .4s,0.4s,100ms;
-o-transition-duration: .4s,0.4s,100ms;
-webkit-transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
-moz-transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
-moz-transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
-ms-transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
-o-transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
transition-property: transform,left,box-shadow;
transition-duration: .5s,0.5s,100ms;
transition-timing-function: ease-in-out,ease-in-out,ease-in-out;
}
li.what
{
-webkit-transform: translateX(878px);
}
</style>
<ul>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
<li style="-webkit-transform: translateX(100px);"><img src="http://store.storeimages.cdn-apple.com/7415/as-images.apple.com/is/image/AppleInc/dept-shelf-macbook-air?wid=137&hei=56&fmt=png-alpha&qlt=95&.v=1381453600453"></li>
</ul>