根据CSS3殊效之动漫:animation的运用

日期:2021-03-10 类型:科技新闻 

关键词:自助建站,专业建站,建站网站,建站平台,网站在线制作app

animation

渐变色情况动漫

拷贝编码
编码以下:

@-webkit-keyframes changeBg{
0%{background-color:#000;}
20%{background-color:#300;}
40%{background-color:#600;}
60%{background-color:#900;}
80%{background-color:#f00;}
}
@-moz-keyframes changeBg{
0%{background-color:#000;}
20%{background-color:#300;}
40%{background-color:#600;}
60%{background-color:#900;}
80%{background-color:#f00;}
}
@keyframes changeBg{
0%{background-color:#000;}
20%{background-color:#300;}
40%{background-color:#600;}
60%{background-color:#900;}
80%{background-color:#f00;}
}
.animation⑴{ width:200px; height:30px; line-height:30px; text-align:center; background-color:#000; color:#fff; }
.animation⑴:hover{ -webkit-animation:changeBg 2s linear; -moz-animation:changeBg 2s linear; animation:changeBg 2s linear; background-color:#f00; }

文本挪动动漫

拷贝编码
编码以下:

@-webkit-keyframes textMove{
0%{ padding-left:0px;}
20%{ padding-left:50px;}
40%{ padding-left:100px;}
50%{ padding-left:125px;}
60%{ padding-left:100px;}
80%{ padding-left:50px;}
}
@-moz-keyframes textMove{
0%{ padding-left:0px;}
20%{ padding-left:50px;}
40%{ padding-left:100px;}
50%{ padding-left:125px;}
60%{ padding-left:100px;}
80%{ padding-left:50px;}
}
@keyframes textMove{
0%{ padding-left:0px;}
20%{ padding-left:50px;}
40%{ padding-left:100px;}
50%{ padding-left:125px;}
60%{ padding-left:100px;}
80%{ padding-left:50px;}
}
.animation⑵{ background-color:pink; padding:10px 0;}
.animation⑵:hover{ -webkit-animation:textMove 2s linear; -moz-animation:textMove 2s linear; animation:textMove 2s linear;}

简易的复合型动漫

拷贝编码
编码以下:

/*因为编码较多,此处只附上加-webkit前缀*/
.animation⑶{ position:relative; width:200px; height:100px; padding:10px; background-color:#ccc;}
.animation⑶ p{ opacity:0;}
.txt⑴{
margin-left:60px;
-webkit-animation:txt⑴-move 2s ease-out;
-moz-animation:txt⑴-move 2s ease-out;
animation:txt⑴-move 2s ease-out;
}
@-webkit-keyframes txt⑴-move{
0%{margin-left:0px;opacity:0;}
50%{margin-left:30px;opacity:1; -webkit-transform:skew(⑴5deg);}
70%{margin-left:35px;opacity:1;}
100%{margin-left:60px;opacity:0; -webkit-transform:skew(⑶0deg);}
}</p> <p>.txt⑵{
opacity:1;
height:36px;
margin-top:10px;
font:18px/36px "Microsoft Yahei";
-webkit-animation:txt⑵-move 4s ease-out 4s;
-moz-animation:txt⑵-move 4s ease-out 4s;
animation:txt⑵-move 4s ease-out 4s;
}
@-webkit-keyframes txt⑵-move{
0%{margin-left:0px; opacity:0;}
30%{margin-left:50px; opacity:1;}
35%{margin-left:55px; opacity:1;}
40%{margin-left:55px; opacity:1;}
41%{margin-left:55px; opacity:1; -webkit-transform:skew(⑶0deg)}
45%{margin-left:55px; opacity:1;}
50%{margin-left:50px; opacity:1;}
60%{margin-left:50px; opacity:.5;}
70%{margin-left:50px; opacity:1;}
80%{margin-left:50px; opacity:.5;}
90%{margin-left:50px; opacity:1;}
100%{margin-left:50px; opacity:1;}
}</p> <p>.txt⑶{
position:absolute;
bottom:10px;
right:0px;
margin-left:⑹0px;
-webkit-animation:txt⑶-move 2s ease-out 2s;
-moz-animation:txt⑶-move 2s ease-out 2s;
animation:txt⑶-move 2s ease-out 2s;
}
@-webkit-keyframes txt⑶-move{
0%{margin-right:0px; opacity:0;}
50%{margin-right:30px; opacity:1; -webkit-transform:skew(⑴5deg);}
70%{margin-right:35px; opacity:1;}
100%{margin-right:60px; opacity:0; -webkit-transform:skew(⑶0deg);}
}