标签:
本次项目中动画放大缩小代码小结
.fix .phone{ -moz-animation: myfirst 1s infinite; -webkit-animation: myfirst 1s infinite; -o-animation: myfirst 1s infinite; animation: myfirst 1s infinite;} @keyframes myfirst{ 0% { transform: scale(.8); } 50% { transform: scale(1); } 100% { transform: scale(.8); } } @-moz-keyframes myfirst{ 0% {-moz-transform: scale(.8);} 50% {-moz-transform: scale(1);} 100% {-moz-transform: scale(.8);} } @-webkit-keyframes myfirst{ 0% {-webkit-transform: scale(.8);} 50% {-webkit-transform: scale(1);} 100% {-webkit-transform: scale(.8);} } @-o-keyframes myfirst{ 0% {-o-transform: scale(.8);} 50% {-o-transform: scale(1);} 100% {-o-transform: scale(.8);} }
参考代码:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5 div 6 { 7 width:100px; 8 height:100px; 9 background:red; 10 position:relative; 11 animation:mymove 5s infinite; 12 -moz-animation:mymove 5s infinite; /* Firefox */ 13 -webkit-animation:mymove 5s infinite; /* Safari and Chrome */ 14 -o-animation:mymove 5s infinite; /* Opera */ 15 } 16 17 @keyframes mymove 18 { 19 0% {top:0px; left:0px; background:red;} 20 25% {top:0px; left:100px; background:blue;} 21 50% {top:100px; left:100px; background:yellow;} 22 75% {top:100px; left:0px; background:green;} 23 100% {top:0px; left:0px; background:red;} 24 } 25 26 @-moz-keyframes mymove /* Firefox */ 27 { 28 0% {top:0px; left:0px; background:red;} 29 25% {top:0px; left:100px; background:blue;} 30 50% {top:100px; left:100px; background:yellow;} 31 75% {top:100px; left:0px; background:green;} 32 100% {top:0px; left:0px; background:red;} 33 } 34 35 @-webkit-keyframes mymove /* Safari and Chrome */ 36 { 37 0% {top:0px; left:0px; background:red;} 38 25% {top:0px; left:100px; background:blue;} 39 50% {top:100px; left:100px; background:yellow;} 40 75% {top:100px; left:0px; background:green;} 41 100% {top:0px; left:0px; background:red;} 42 } 43 44 @-o-keyframes mymove /* Opera */ 45 { 46 0% {top:0px; left:0px; background:red;} 47 25% {top:0px; left:100px; background:blue;} 48 50% {top:100px; left:100px; background:yellow;} 49 75% {top:100px; left:0px; background:green;} 50 100% {top:0px; left:0px; background:red;} 51 } 52 </style> 53 </head> 54 <body> 55 56 <p><b>注释:</b>本例在 Internet Explorer 中无效。</p> 57 58 <div></div> 59 60 </body> 61 </html>
标签:
原文地址:http://www.cnblogs.com/jeremylee/p/5501858.html