龙空技术网

CSS3 transition动画 圆角、rgba

IT技术资源共享 303

前言:

此刻咱们对“html圆角盒子”都比较关切,朋友们都想要剖析一些“html圆角盒子”的相关资讯。那么小编也在网摘上收集了一些关于“html圆角盒子””的相关内容,希望大家能喜欢,小伙伴们一起来学习一下吧!

CSS3 transition动画

1、transition-property 设置过渡的属性,比如:width height background-color

2、transition-duration 设置过渡的时间,比如:1s 500ms

3、transition-timing-function 设置过渡的运动方式,常用有 linear(匀速)|ease(缓冲运动)

4、transition-delay 设置动画的延迟

5、transition: property duration timing-function delay 同时设置四个属性

综合练习:

制作鼠标移入图片时,图片说明滑入的效果

CSS3 transform变换

1、translate(x,y) 设置盒子位移

2、scale(x,y) 设置盒子缩放

3、rotate(deg) 设置盒子旋转

4、skew(x-angle,y-angle) 设置盒子斜切

5、perspective 设置透视距离

6、transform-style flat | preserve-3d 设置盒子是否按3d空间显示

7、translateX、translateY、translateZ 设置三维移动

8、rotateX、rotateY、rotateZ 设置三维旋转

9、scaleX、scaleY、scaleZ 设置三维缩放

10、tranform-origin 设置变形的中心点

11、backface-visibility 设置盒子背面是否可见

举例:(翻面效果)

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>翻面</title> <style type="text/css"> .box{ width:300px; height:272px; margin:50px auto 0; transform-style:preserve-3d; position:relative;  } .box .pic{ width:300px; height:272px; position:absolute; background-color:cyan; left:0; top:0; transform:perspective(800px) rotateY(0deg); backface-visibility:hidden; transition:all 500ms ease; } .box .back_info{ width:300px; height:272px; text-align:center; line-height:272px; background-color:gold; position:absolute; left:0; top:0; transform:rotateY(180deg); backface-visibility:hidden; transition:all 500ms ease;  } .box:hover .pic{ transform:perspective(800px) rotateY(180deg); } .box:hover .back_info{ transform:perspective(800px) rotateY(0deg); } </style></head><body> <div class="box">  <div class="pic"><img src="images/location_bg.jpg"></div> <div class="back_info">背面文字说明</div> </div></body></html>
CSS3 animation动画

1、@keyframes 定义关键帧动画

2、animation-name 动画名称

3、animation-duration 动画时间

4、animation-timing-function 动画曲线 linear(匀速)|ease(缓冲)|steps(步数)

5、animation-delay 动画延迟

6、animation-iteration-count 动画播放次数 n|infinite

7、animation-direction 动画结束后是否反向还原 normal|alternate

8、animation-play-state 动画状态 paused(停止)|running(运动)

9、animation-fill-mode 动画前后的状态 none(缺省)|forwards(结束时停留在最后一帧)|backwards(开始时停留在定义的开始帧)|both(前后都应用)

10、animation:name duration timing-function delay iteration-count direction;同时设置多个属性

理解练习:

1、风车动画

2、loading动画

3、人物走路动画

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>走路动画</title> <style type="text/css">  .box{ width:120px; height:180px; border:1px solid #ccc;  margin:50px auto 0; position:relative; overflow:hidden;  } .box img{ display:block; width:960px; height:182px; position: absolute; left:0; top:0; animation:walking 1.0s steps(8) infinite;  } @keyframes walking{ from{ left:0px; } to{ left:-960px; } } </style></head><body> <div class="box"><img src="images/walking.png"></div></body></html>

动画中使用的图片如下:

CSS3圆角、rgba

CSS3圆角

设置某一个角的圆角,比如设置左上角的圆角:

border-top-left-radius:30px 60px;

同时分别设置四个角: border-radius:30px 60px 120px 150px;

设置四个圆角相同:

border-radius:50%;

rgba(新的颜色值表示法)

1、盒子透明度表示法:

 .box { opacity:0.1; /* 兼容IE */ filter:alpha(opacity=10);  }

2、rgba(0,0,0,0.1) 前三个数值表示颜色,第四个数值表示颜色的透明度

标签: #html圆角盒子 #html设置盒子圆角属性 #图片圆角html #html图片圆角处理

上一篇教你怎样给一段视频换背景

下一篇没有了