css3动画属性有哪些?css3动画特效翻转
各位老铁们好,相信很多人对css3动画属性有哪些都不是特别的了解,因此呢,今天就来为大家分享下关于css3动画属性有哪些以及css3动画特效翻转的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!
css3里面动画有没有用过动画的属性有哪些具体是什么
CSS3动画属性
下面的表格列出了@keyframes规则和所有动画属性:
@keyframes规定动画。
animation所有动画属性的简写属性,除了 animation-play-state属性。
animation-name规定@keyframes动画的名称。
animation-duration规定动画完成一个周期所花费的秒或毫秒。默认是 0。 3
animation-timing-function规定动画的速度曲线。默认是"ease"。 3
animation-delay规定动画何时开始。默认是 0。 3
animation-iteration-count规定动画被播放的次数。默认是 1。
animation-direction规定动画是否在下一周期逆向地播放。默认是"normal"。
animation-play-state规定动画是否正在运行或暂停。默认是"running"。
animation-fill-mode规定对象动画时间之外的状态。
下面的两个例子设置了所有动画属性:
实例
运行名为 myfirst的动画,其中设置了所有动画属性:
div
{
animation-name: myfirst;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
/* Firefox:*/
-moz-animation-name: myfirst;
-moz-animation-duration: 5s;
-moz-animation-timing-function: linear;
-moz-animation-delay: 2s;
-moz-animation-iteration-count: infinite;
-moz-animation-direction: alternate;
-moz-animation-play-state: running;
/* Safari和 Chrome:*/
-webkit-animation-name: myfirst;
-webkit-animation-duration: 5s;
-webkit-animation-timing-function: linear;
-webkit-animation-delay: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-webkit-animation-play-state: running;
/* Opera:*/
-o-animation-name: myfirst;
-o-animation-duration: 5s;
-o-animation-timing-function: linear;
-o-animation-delay: 2s;
-o-animation-iteration-count: infinite;
-o-animation-direction: alternate;
-o-animation-play-state: running;
}
css3有哪些新特性 包含哪些模块
1、CSS3圆角表格圆角表格,对应属性:border-radius。
2、以往对网页上的文字加特效只能用filter这个属性,这次CSS3中专门制订了一个加文字特效的属性,而且不止加阴影这种效果。对应属性:font-effect。
3、丰富了对链接下划线的样式,以往的下划线都是直线,这次可不一样了,有波浪线、点线、虚线等等,更可对下划线的颜色和位置进行任意改变。(还有对应顶线和中横线的样式,效果与下划线类似)对应属性:text-underline-style,text-underline-color,text-underline-mode,text-underline-position。
4、在文字下点几个点或打个圈以示重点,CSS3也开始加入了这项功能,这应该在某些特定网页上很有用。对应属性:font-emphasize-style和font-emphasize-position。
边框(Borders)
border-color:控制边框颜色,并且有了更大的灵活性,可以产生渐变效果
border-image:控制边框图象 CSS3边框border-corner-image:控制边框边角的图象
border-radius:能产生类似圆角矩形的效果
背景(Backgrounds)
background-origin:决定了背景在盒模型中的初始位置,提供了3个值,border, padding和content
border:控制背景起始于左上角的边框
padding:控制背景起始于左上角的留白
content:控制背景起始于左上角的内容 CSS3背景background-clip:决定边框是否覆盖住背景(默认是不覆盖),提供了两个值,border和padding
border:会覆盖住背景
padding:不会覆盖背景
background-size:可以指定背景大小,以象素或百分比显示。当指定为百分比时,大小会由所在区域的宽度、高度,以及background-origin的位置决定
multiple backgrounds:多重背景图象,可以把不同背景图象只放到一个块元素里。
文字效果(Text effects)
text-shadow:文字投影,可能是因为MAC OSX的Safari浏览器开始支持投影才特意增加的。
text-overflow:当文字溢出时,用“…”提示。包 CSS3文字效果括ellipsis、clip、ellipsis-word、inherit,前两个CSS2就有了,目前还是部分支持,但有趣的是IE6居然也支持。ellipsis-word可以省略掉最后一个单词,对中文意义不大,inherit可以继承父级元素。
颜色(Color)
HSL colors:除了支持RGB颜色外,还支持HSL(色相、饱和度、亮度)。以前一般都是作图的时候用HSL色谱,但这样一来会包括更多的颜色。H用度表示,S和L用百分比表示,比如hsl(0,100%, 50%)
HSLA colors:加了个不透明度(Apacity),用0到1之间的数来表示,比如hsla(0,100%,50%,0.2)
opacity:直接控制不透明度,用0到1之间的数来表示
RGBA colors:和HSLA colors类似,加了个不透明度。一直以来,浏览器的透明一直无法实现单纯的颜色透明,每次使用alpha后就会把透明的属性继承到子节点上。换句话说,很难实现背景颜色透明而文字不透明的效果。直到RGBA颜色的出现这一切将成为现实。
实现这样的效果非常简单,设置颜色的时候我们使用标准的rgba()单位即可,例如rgba(255,0,0,0.4)这样就出现了一个红色同时拥有alpha透明为0.4的颜色。
经过测试firefox3.0、safari3.2、opera10都支持了rgba单位。
用户界面(User-interface)
resize:可以由用户自己调整div的大小,有horizontal(水平)vertical(垂直)或者both(同时),或者同时调整。如果再加上max-width或min-width的话还可以防止破坏布局
选择器(Selectors)
CSS3增加了更多的CSS选择器,可以实现更简单但是更强大的功能,比如:nth-child()等。
Attribute selectors:在属性中可以加入通配符,包括^,$,*
[att^=val]:表示开始字符是val的att属性 CSS3选择器[att$=val]:表示结束字符是val的att属性
[att*=val]:表示包含至少有一个val的att属性
其它模块:
(Other modules)
media queries:感觉叫媒体选择比较合适,可以为网页中不同的对象设置不同的浏览设备。比如可以为某一块分别设置屏幕浏览样式和手机浏览样式,以前则只能设置整个网页。
multi-column layout:多列布局,让文字以多列显示,包括column-width、column-count、column-gap三个值
column-width:指定每列宽度
column-count:指定列数
column-gap:指定每列之间的间距
column-rule-color:控制列间的颜色
column-rule-style:控制列间的样式
column-rule-width:控制列间的宽度
column-space-distribution:平均分配列间距
css3的常用变形方法有哪些写出核心代码
css3中的变形
Chrome和safai需前缀加-webkit-,Foxfire需加前缀-moz-
1,旋转 rotate()
div{
width: 300px;
height: 300px;
transform:rotate(20deg);
}
2,扭曲 skew()
div{
width: 300px;
height: 300px;
transform:skew(45deg,-10deg);
}
3,缩放 scale()
scale(X,Y)使元素水平方向和垂直方向同时缩放(也就是X轴和Y轴同时缩放)
也可以只缩放 x轴,或只缩放y轴。
div{
width: 200px;
height: 200px;
background: orange;
}
.wrapper div:hover{
opacity:.5;
transform: scale(0.8);
}
4,位移 translate()
translate()函数可以将元素向指定的方向移动,类似于position中的relative。
或以简单的理解为,使用translate()函数,可以把元素从原来的位置移动,
而不影响在X、Y轴上的任何Web组件。
5,原点 transform-origin
CSS变形进行的旋转、位移、缩放,扭曲等操作都是以元素自己中心位置进行变形。
但很多时候,我们可以通过transform-origin来对元素进行原点位置改变,使元素
原点不在元素的中心位置,以达到需要的原点位置。
div{
transform: skew(45deg);
transform-origin:top;
}
6,过渡
div{
width: 200px;
height: 200px;
background: red;
margin: 20px auto;
-webkit-transition-property: all;
transition-property: all;//指定过渡或动态模拟的css属性(all是指所有)
-webkit-transition-duration:5s;
transition-duration:5s;//指定完成过渡的时间
-webkit-transition-timing-function: linear;
transition-timing-function: linear;//指定过渡的函数 linear/ease/ease-in/ease-out/ease-in-out/cubicbezier(n,n,n,n) n为0-1
-webkit-transition-delay:.18s;
transition-delay:.18s;//指定开始出现的延迟时间
}
div:hover{
width: 400px;
height:400px;
}
7,Keyframes被称为关键帧,css3中以“@keyframes”开头,后面紧跟着是动画名称加上一对花括号“{...}”
@keyframes changecolor{
0%{
background: red;
}
20%{
background:blue;
}
40%{
background:orange;
}
60%{
background:green;
}
80%{
background:yellow;
}
100%{
background: red;
}
}
div{
width: 300px;
height: 200px;
}
div:hover{
animation: changecolor 5s ease-out.2s;
}
等价于
div:hover{
animation-name:changecolor;
animation-duration:5s;
animation-timing-function:ease-out;
animation-delay:1;
animation-iteration-count:infinite;//动画播放次数整数。
animation-play-state:paused;//主要用来控制元素动画的播放状态。
animation-direction:alternate;//动画方向,normal每次循环向前,alternate偶次向前,奇数相反。
animation-fill-mode: both;//设置动画时间外属性none、forwards、backwords和both
}
OK,本文到此结束,希望对大家有所帮助。