css实现一个漏斗漏沙子动画计时效果代码

代码语言:html

所属分类:动画

代码描述:css实现一个漏斗漏沙子动画计时效果代码,当漏完后自动翻转。

代码标签: 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-shadow(-2px -4px 8px rgba(0, 0, 0, 0.15));
            filter: d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0