CSS3 中有两个用来做动画的属性,一个是 Transition,另一个是 Animation。
Animation 起手式
div{ animation: sample 2s ;//八个属性中至少要有名称、时间}//设定开始与结束状态@keyframes change{ from{ background:red} to{ background: yellow;}}from 就是0%,to 为100%。
animation-name:动画名称animation-duration:动画持续时间,预设 0,单位 s 或 ms。animation-delay:动画延迟播放时间,预设 0,单位 s 或 ms。animation-iteration-count:动画播放次数,预设 1。animation-timing-function:动画加速度函式,预设 ease。animation-direction:动画播放方向,预设 normal。animation-fill-mode:动画播放前后模式,预设 none。animation-play-state:动画播放或暂停状态,预设 running。实作球滚动範例