使用 CSS3 实现超炫的div模块动画效果

HTML 代码:<div class="spinner"></div>

效果1  css

.spinner {

width:60px;

height:60px;

background-color:#67CF22;

margin:100pxauto;

-webkit-animation: rotateplane1.2s infinite ease-in-out;

animation: rotateplane1.2s infinite ease-in-out;

}

@-webkit-keyframes rotateplane {

0%{ -webkit-transform: perspective(120px) }

50%{ -webkit-transform: perspective(120px) rotateY(180deg) }

100%{ -webkit-transform: perspective(120px) rotateY(180deg)  rotateX(180deg) }

}

@keyframes rotateplane {

0%{

transform: perspective(120px) rotateX(0deg) rotateY(0deg);

-webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)

}50%{

transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);

-webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)

}100%{

transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);

-webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);

}

}

效果2css

.spinner {

margin:100pxauto;

width:32px;

height:32px;

position:relative;

}

.cube1, .cube2{

background-color:#67CF22;

width:30px;

height:30px;

position:absolute;

top:0;

left:0;

-webkit-animation: cubemove1.8s infinite ease-in-out;

animation: cubemove1.8s infinite ease-in-out;

}

.cube2{

-webkit-animation-delay:-0.9s;

animation-delay:-0.9s;

}

@-webkit-keyframes cubemove {

25%{ -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5) }

50%{ -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg) }

75%{ -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5) }

100%{ -webkit-transform: rotate(-360deg) }

}

@keyframes cubemove {

25%{

transform: translateX(42px) rotate(-90deg) scale(0.5);

-webkit-transform: translateX(42px) rotate(-90deg) scale(0.5);

}50%{

transform: translateX(42px) translateY(42px) rotate(-179deg);

-webkit-transform: translateX(42px) translateY(42px) rotate(-179deg);

}50.1%{

transform: translateX(42px) translateY(42px) rotate(-180deg);

-webkit-transform: translateX(42px) translateY(42px) rotate(-180deg);

}75%{

transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5);

-webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5);

}100%{

transform: rotate(-360deg);

-webkit-transform: rotate(-360deg);

}

}


效果3css

.spinner {

width:40px;

height:40px;

margin:100pxauto;

background-color:#333;

border-radius:100%;

-webkit-animation: scaleout1.0s infinite ease-in-out;

animation: scaleout1.0s infinite ease-in-out;

}

@-webkit-keyframes scaleout {

0%{ -webkit-transform: scale(0.0) }

100%{

-webkit-transform: scale(1.0);

opacity:0;

}

}

@keyframes scaleout {

0%{

transform: scale(0.0);

-webkit-transform: scale(0.0);

}100%{

transform: scale(1.0);

-webkit-transform: scale(1.0);

opacity:0;

}

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,351评论 0 11
  • 关于css3变形 CSS3变形是一些效果的集合,比如平移、旋转、缩放和倾斜效果,每个效果都被称作为变形函数(Tra...
    hopevow阅读 6,434评论 2 13
  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 1,677评论 0 7
  • 作者:blue(又名一书and一世界) 我的github**用途: **当作字典来查 some websites ...
    一书and一世界阅读 1,220评论 2 19
  • 看了很多视频、文章,最后却通通忘记了,别人的知识依旧是别人的,自己却什么都没获得。此系列文章旨在加深自己的印象,因...
    DCbryant阅读 1,904评论 0 4