首页 > 技术文章 > CSS3之ball弹起

zlinger 2018-09-01 11:38 原文

一、效果图

二、源码

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS3-ball</title>
<style>
body {
height: 100%;
}
.radial-gradient {
width: 180px;
height: 180px;
position: relative;
top: 0px;
left: 400px;
border-radius: 90px;
background-color: #a946ff;
animation-name: change;
animation-duration: 0.5s;
animation-timing-function: ease-in;
animation-iteration-count: infinite;
animation-direction: alternate;

background-image: radial-gradient(120px at 50px 50px, rgba(0,0,0,0), rgba(0,0,0,0.6));
}
.shadow {
width: 180px;
height: 50px;
margin-top: 300px;
margin-left: 400px;
background-color: #ccc;
border-radius: 50%;
}
@keyframes change {
0% {
top: 0px;
left: 400px;
}
50% {
top: 180px;
left: 400px;
background-color: #acee28;
transform: rotate(145deg);

}
75% {
top: 260px;
left: 400px;
transform: scale(0.5,0.5);
}
100% {
top: 345px;
left: 400px;
background-color: #ee7fc8;
}
}
</style>
</head>
<body>
<div class="radial-gradient"></div>
<div class="shadow"></div>
</body>
</html>

 

推荐阅读