javascript实现简单加载随机色方块

前端之家收集整理的这篇文章主要介绍了javascript实现简单加载随机色方块前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

用碎片加载小方块实现简单的随机色块,直接上代码效果图:

具体代码

<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <Meta charset="utf-8"> koringz

css代码

.colorful > a {
float: left;
display: block;
width: 50px;
height: 50px;
zoom:2;
}

.colorful > a:hover {
-webkit-animation:infinite 2s ease-in-out start-roll;
-moz-animation:infinite 2s ease-in-out start-roll;
animation:infinite 2s ease-in-out start-roll;
}
@-webkit-keyframes start-roll{
0% {
-webkit-transform: rotate(0deg); /chrome/
-moz-transform: rotate(0deg); /火狐/
-ms-transform: rotate(0deg); /IE/
transform: rotate(0deg);
-webkit-transition: opacity .3s linear;
transition: opacity .3s linear;
opacity: .5;
filter: alpha(opacity=50);
zoom:1;
}
50% {
-webkit-transform: rotate(180deg); /chrome/
-moz-transform: rotate(180deg); /火狐/
-ms-transform: rotate(180deg); /IE/
transform: rotate(180deg);
-webkit-transition: opacity 1s linear;
transition: opacity 1s linear;
opacity: 1;
filter: alpha(opacity=100);
zoom:2;
}
100% {
-webkit-transform: rotate(360deg); /chrome/
-moz-transform: rotate(360deg); /火狐/
-ms-transform: rotate(360deg); /IE/
transform: rotate(360deg);
-webkit-transition: opacity .3s linear;
transition: opacity .3s linear;
opacity: .5;
filter: alpha(opacity=50);
zoom:1;
}
}
@-moz-keyframes start-roll{
0% {
-webkit-transform: rotate(0deg); /chrome/
-moz-transform: rotate(0deg); /火狐/
-ms-transform: rotate(0deg); /IE/
transform: rotate(0deg);
-webkit-transition: opacity .3s linear;
transition: opacity .3s linear;
opacity: .5;
filter: alpha(opacity=50);
}
50% {
-webkit-transform: rotate(180deg); /chrome/
-moz-transform: rotate(180deg); /火狐/
-ms-transform: rotate(180deg); /IE/
transform: rotate(180deg);
-webkit-transition: opacity 1s linear;
transition: opacity 1s linear;
opacity: .5;
filter: alpha(opacity=50);
}
100% {
-webkit-transform: rotate(360deg); /chrome/
-moz-transform: rotate(360deg); /火狐/
-ms-transform: rotate(360deg); /IE/
transform: rotate(360deg);
-webkit-transition: opacity .3s linear;
transition: opacity .3s linear;
opacity: .5;
filter: alpha(opacity=50);
}
}
@keyframes start-roll{
0% {
-webkit-transform: rotate(0deg); /chrome/
-moz-transform: rotate(0deg); /火狐/
-ms-transform: rotate(0deg); /IE/
transform: rotate(0deg);
-webkit-transition: opacity .3s linear;
transition: opacity .3s linear;
opacity: .5;
filter: alpha(opacity=50);
}
50% {
-webkit-transform: rotate(180deg); /chrome/
-moz-transform: rotate(180deg); /火狐/
-ms-transform: rotate(180deg); /IE/
transform: rotate(180deg);
-webkit-transition: opacity 1s linear;
transition: opacity 1s linear;
opacity: .5;
filter: alpha(opacity=50);
}
100% {
-webkit-transform: rotate(360deg); /chrome/
-moz-transform: rotate(360deg); /火狐/
-ms-transform: rotate(360deg); /IE/
transform: rotate(360deg);
-webkit-transition: opacity .3s linear;
transition: opacity .3s linear;
opacity: .5;
filter: alpha(opacity=50);
}
}

js代码

0) { a = document.createElement('a'); a.style.backgroundColor = grc(); df.appendChild(a); } el.appendChild(df); } on(window,'load',function () { fbc(); }); })(window)

希望本文所述对大家学习javascript程序设计有所帮助。

原文链接:https://www.f2er.com/js/50903.html

猜你在找的JavaScript相关文章