CSS3之过渡和动画

2017-06-07  本文已影响0人  greenteaObject

过渡

transition-property:none | all | property
transition-duration:time
transition-timing-function:ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(<integer>[start | end]?) | cubic-bezier(<number>,<number>,<number>,<number>)

transition-delay-time:time
简写方式
transition:property duration timing-function delay

transition:transform 2s ease-in-out 1s;

动画

animation-name:keyframename | none;

animation-duration:time;
animation-timing-function:ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(<integer>[start | end]?) | cubic-bezier(<number>,<number>,<number>,<number>)
animation-delay:time;
animation-iteration-count:infinite | <number>;
检索或设置对象动画的循环次数
animation-direction:normal | reverse | alternate | alternate-reverse | initial | inherit
检索或设置对象动画在循环中是否反向运动

animation-fill-mode:none | forwards | backwards | both | initial | inherit
规定当动画不播放时(当动画完成或当动画有延迟未开始播放时),要应用到元素的样式

animation-play-state:paused | running;
指定动画是否正在运行或已暂停
简写方式

animation: name duration timing-function delay iteration-count direction fill-mode play-state

name duration 是必须的,会优先判断这两个值

@keyframes

创建动画,通过逐步改变一个CSS样式设定到另一个,在动画过程中可以通过@keyframes规则多次更改CSS样式的设定

@keyframes animationname{
    keyframes-selector{
        css-styles;
    }
}

参数说明:
animationname:必写项,定义animation的名称
keyframes-selector:必写项,动画持续时间的百分比,0-100%,from(0%),to(100%)
css-styles:必写项,一个或多个合法的CSS样式属性

上一篇 下一篇

猜你喜欢

热点阅读