css3 实现动画效果,怎样使他无限循环动下去?

html-css0177

css3 实现动画效果,怎样使他无限循环动下去?,第1张

一、实现CSS3无限循环动画代码示例。

代码如下:

CSS:

@-webkit-keyframes gogogo {

0%{

-webkit-transform: rotate(0deg)

border:5px solid red

}

50%{

-webkit-transform: rotate(180deg)

background:black

border:5px solid yellow

}

100%{

-webkit-transform: rotate(360deg)

background:white

border:5px solid red

}

}

.loading{

border:5px solid black

border-radius:40px

width: 28px

height: 188px

-webkit-animation:gogogo 2s infinite linear

margin:100px

}

扩展资料

实现动画无限循环所需要的CSS属性说明:

1、infinite

在animation后面加上infinite就可以无限循环,另外还可以做反向循环使用animation-direction

2、animation-name

规定需要绑定到选择器的 keyframe 名称。

3、animation-duration

规定完成动画所花费的时间,以秒或毫秒计。

4、animation-timing-function

规定动画的速度曲线。

5、animation-delay

规定在动画开始之前的延迟。

6、animation-iteration-count

规定动画应该播放的次数。

7、animation-direction

规定是否应该轮流反向播放动画。

transition使用

为鼠标指针的滑过状态设置一些动画效果。图标在1秒内匀速旋转360度。

.close:hover::before{

-webkit-transform:rotate(360deg)

transform:rotate(360deg)

-webkit-transition:-webkit-transform 1s linear

transition:transform 1s linear

}

添加修改CSS代码如下 :

.logo-site,.logo-sites{position:relativefloat:leftmargin:18px 0 0 10pxwidth:220pxmax-height:50pxoverflow:hiddentransition-duration:.5s}

.logo-site img,.logo-sites img{width:220pxmax-height:50px}@media screen and (max-width:480px){

.logo-site,.logo-sites{width:140px}}@media screen and (min-width:900px){

.logo-site:before{content:""position:absoluteleft:-665pxtop:-460pxwidth:220pxheight:15pxbackground-color:rgba(255,255,255,.5)-webkit-transform:rotate(-45deg)-moz-transform:rotate(-45deg)-ms-transform:rotate(-45deg)-o-transform:rotate(-45deg)transform:rotate(-45deg)-webkit-animation:searchLights 1s ease-in 1s infinite-o-animation:searchLights 1s ease-in 1s infiniteanimation:searchLights 1s ease-in 1s infinite}}@-webkit-keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}@-o-keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}@-moz-keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}@keyframes searchLights{0%{left:-100pxtop:0}to{left:120pxtop:100px}}

.site-title{font-size:24pxfont-size:2.4remfont-weight:700padding:0 0 2px 0}

.site-name{display:none}@media screen and (min-width:900px){

.logo-site img,.logo-sites img{transition-duration:.8s}

操作流程

把css代码当中的logo-site改成你网站包围logo的css即可(f12键审核元素,即可找到你的logo的css元素)。找到你logo的css名称然后把上面的css代码修改成你的css名称,放入css代码当中即可(防止出错,记得备份!)

以上就是logo添加css扫光效果的方法,当然你也可以运用到其他的地方。

注意,有些模板CSS代码不相同,不能贸然的使用,可能会出现错误,新手不要尝试。