纯css实现沙漏动画效果
代码语言:html
所属分类:动画
代码描述:纯css实现沙漏动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css2?family=Yellowtail&display=swap");
* {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
font-family: 'Yellowtail', cursive;
background-color: #eee;
color: #777;
min-height: 100vh;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
}
.title {
font-size: 24px;
width: 420px;
text-align: left;
}
.container {
position: relative;
width: 420px;
height: 420px;
border: 2px solid #fff;
border-radius: 4px;
}
.hourglass {
position: relative;
width: 100;
height: 100%;
-webkit-animation: rotateGlass 60s ease-in-out infinite;
animation: rotateGlass 60s ease-in-out infinite;
}
@-webkit-keyframes rotateGlass {
0%, 90% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.15));
filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.15));
}
100% {
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-filter: drop-shadow(-2px -4px 8px rgba(0, 0, 0, 0.15));
filter: drop-shadow(-2px -4px 8px rgba(0, 0, 0, 0.15));
}
}
@keyframes rotateGlass {
0%, 90% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.15));
filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.15));
}
100% {
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
-webkit-filter: drop.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0