动画

@keyframes myfirst{
    from {background: red;}
    to {background: yellow;}
}

@keyframes myfirst{
    0%   {background: red;}
    25%  {background: yellow;}
    50%  {background: blue;}
    100% {background: green;}
}

div{
    animation:myfirst 5s
}

@keyframes 规定动画
animation 所有动画属性的简写属性,除了 animation-play-state 属性。
animation-name 规定 @keyframes 动画的名称。
animation-duration 规定动画完成一个周期所花费的秒或毫秒。默认是 0。
animation-timing-function 规定动画的速度曲线。默认是 "ease"
animation-delay 规定动画何时开始。默认是 0。
animation-iteration-count 规定动画被播放的次数。默认是 1。
animation-direction 规定动画是否在下一周期逆向地播放。默认是 "normal"
animation-play-state 规定动画是否正在运行或暂停。默认是 "running"
animation-fill-mode 规定对象动画时间之外的状态

transform:translateX(50px)
transform:translateY(50px)
translate(dx, dy)

 

posted @ 2026-05-27 13:41  青春☞自由☜旅行  阅读(4)  评论(0)    收藏  举报