微信掃碼顯示特效:下麵是實際效果:(可以自己移動滑鼠,嘗試效果)(由於篇幅長度,沒有加相容性首碼,演示環境為谷歌瀏覽器。)現在就一個一個效果單獨演示:演示demo的HTML內容為:魔芋CSS:div { width:200px; height:200px; background: red; marg...
微信掃碼顯示特效:
下麵是實際效果:(可以自己移動滑鼠,嘗試效果) (由於篇幅長度,沒有加相容性首碼,演示環境為谷歌瀏覽器。)現在就一個一個效果單獨演示:
演示demo的HTML內容為:<div class="moyu">魔芋</div>
div {
width:200px;
height:200px;
background: red;
margin:50px;
color:#fff;
line-height:200px;
font-size:30px;
text-align:center;
}
淡入:(改變透明度)
.moyu {
-webkit-animation: change 2s ease;
animation: change 2s ease;
}
@-webkit-keyframes change {
0%{
opacity:0;
}
100%{
opacity:1;
}
}
@keyframes change {
0%{
opacity:0;
}
100%{
opacity:1;
}
}
淡出就是調整opacity從1到0.
淡入-從下
說明:就是加是transform 的translate.moyu {
-webkit-animation: change 2s ease infinite;
animation: change 2s ease infinite;
}
@-webkit-keyframes change {
0%{
opacity:0;
-webkit-transform:translateY(-100px);
transform:translateY(-100px);
}
100%{
opacity:1;
-webkit-transform:translateY(0px);
transform:translateY(0px);
}
}
@keyframes change {
0%{
opacity:0;
-webkit-transform:translateY(-100px);
transform:translateY(-100px);
}
100%{
opacity:1;
-webkit-transform:translateY(0px);
transform:translateY(0px);
}
}
彈跳
改變transform:translateY的值@-webkit-keyframes change {
0%,
20%,
50%,
80%,
100%{
-webkit-transform: translateY(0);
}
40%{
-webkit-transform: translateY(-30px);
}
60%{
-webkit-transform: translateY(-15px);
}
}
彈入
透明度結合transform:scale@-webkit-keyframes change {
0%{
opacity:0;
-webkit-transform: scale(0.3);
}
50%{
opacity:1;
-webkit-transform: scale(1.05);
}
70%{
-webkit-transform: scale(0.9);
}
100%{
-webkit-transform: scale(1);
}
}
轉入
@-webkit-keyframes change {
0%{
opacity:0;
-webkit-transform: rotate(-200deg);
}
100%{
opacity:1;
-webkit-transform: rotate(0);
}
}
翻轉
@keyframes change {
0%{
transform: perspective(400px) rotateY(0);
animation-timing-function: ease-out;
}
40%{
transform: perspective(400px) translateZ(150px) rotateY(170deg);
animation-timing-function: ease-out;
}
80%{
transform: perspective(400px) rotateY(360deg) scale(0.95);
animation-timing-function: ease-in;
}
100%{
transform: perspective(400px) scale(1);
animation-timing-function: ease-in;
}
}
閃爍
@keyframes change {
0%,
50%,
100%{
opacity:1;
}
25%,
75%{
opacity:0;
}
}
震顫
@keyframes change{
0%,
100%{
transform: translateX(0);
}
10%,
30%,
50%,
70%,
90%{
transform: translateX(-10px);
}
20%,
40%,
60%,
80%{
transform: translateX(10px);
}
}
搖擺:
@keyframes change{
20%{
transform: rotate(15deg);
}
40%{
transform: rotate(-10deg);
}
60%{
transform: rotate(5deg);
}
80%{
transform: rotate(-5deg);
}
100%{
transform: rotate(0);
}
}
搖晃:
@keyframes change{
0%{
transform: translateX(0);
}
15%{
transform: translateX(-100px) rotate(-5deg);
}
30%{
transform: translateX(80px) rotate(3deg);
}
45%{
transform: translateX(-65px) rotate(-3deg);
}
60%{
transform: translateX(40px) rotate(2deg);
}
75%{
transform: translateX(-20px) rotate(-1deg);
}
100%{
transform: translateX(0);
}
}
響鈴:
@keyframes change {
0%{
transform: scale(1);
}
10%,
20%{
transform: scale(0.9) rotate(-3deg);
}
30%,
50%,
70%,
90%{
transform: scale(1.1) rotate(3deg);
}
40%,
60%,
80%{
transform: scale(1.1) rotate(-3deg);
}
100%{
transform: scale(1) rotate(0);
}
}