css动画集锦

html-css052

css动画集锦,第1张

1.渐变动画背景

body {

background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab)

background-size: 400% 400%

animation: gradient 15s ease infinite

height: 100vh

}

@keyframes gradient {

0% {

background-position: 0% 50%

}

50% {

background-position: 100% 50%

}

100% {

background-position: 0% 50%

}

}

2.浮动动画效果

div {

box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6)

transform: translatey(0px)

animation: float 6s ease-in-out infinite

}

@keyframes float {

0% {

box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6)

transform: translatey(0px)

}

50% {

box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2)

transform: translatey(-20px)

}

100% {

box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6)

transform: translatey(0px)

}

}

background-attachment: fixed

background-size: cover

实现背景图平铺展开,各自显示各自区域的背景图

上面transition: all 0.4s ease-in-out

下面opacity: 0.7transform: scale(0.99)

实现动画效果过度,缩放