温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

怎么用css3绘制汤勺捞起汤圆的动画特效

发布时间:2022-02-15 14:31:13 阅读:116 作者:iii 栏目:web开发
前端开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

这篇文章主要介绍了怎么用css3绘制汤勺捞起汤圆的动画特效的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇怎么用css3绘制汤勺捞起汤圆的动画特效文章都会有所收获,下面我们一起来看看吧。

HTML代码:

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>汤勺捞起汤圆动画</title>
<link rel="stylesheet" href="css/style.css">
</head>

<body>

<div class="bowl">
  <div class="back"></div>
  <div class="spoon">
    <div class="scoop"></div>
  </div>
  <div class="contents">
    <div class="syrup"></div>
    <div class="riceball uno">
      <div class="face"></div>
    </div>
    <div class="riceball dos">
      <div class="face"></div>
    </div>
    <div class="riceball tres">
      <div class="face"></div>
    </div>
  </div>
</div>

</body>
</html>

style.css代码:

html,
body {
  width100%;
  height100%;
  margin0;
  padding0;
  overflow: hidden;
}

body {
  background#f7e5d7;
}

.riceball {
  position: absolute;
  width200px;
  height200px;
  background#fff;
  border-radius50%;
  backgroundurl("../img/1.jpg"0 0/10em 10em#fff;
  background-blend-mode: hard-light;
  box-shadow: inset -25px -25px 25px rgba(2292192110.8), 5px 5px 15px 5px rgba(2162001900.3);
  -webkit-clip-pathinset(-40px -30px 25% -20px);
          clip-pathinset(-40px -30px 25% -20px);
}
.riceball .face {
  position: absolute;
  top50%;
  left50%;
  -webkit-transformtranslate(-50%, -50%rotate(5deg);
          transformtranslate(-50%, -50%rotate(5deg);
  width30px;
  height20px;
  background#000;
  border-radius50%;
  border-top-left-radius3px;
  border-top-right-radius3px;
}
.riceball .face::before.riceball .face::after {
  display: block;
  content"";
  position: absolute;
  top: -5px;
  width12px;
  height12px;
  background#000;
  border-radius50%;
}
.riceball .face::before {
  left: -40px;
}
.riceball .face::after {
  right: -40px;
}
.riceball.uno {
  left150px;
  bottom65px;
  -webkit-animation3s rice-up infinite;
          animation3s rice-up infinite;
}
.riceball.uno .face {
  -webkit-transformtranslate(-50%, -50%rotate(-20deg);
          transformtranslate(-50%, -50%rotate(-20deg);
  -webkit-animation3s face-bob infinite;
          animation3s face-bob infinite;
}
.riceball.uno .face::before.riceball.uno .face::after {
  -webkit-animation3s eye-bulge infinite;
          animation3s eye-bulge infinite;
}
.riceball.dos {
  left20px;
  bottom: -35px;
  -webkit-animation1s little-bob1 linear infinite;
          animation1s little-bob1 linear infinite;
}
.riceball.dos .face {
  -webkit-transformtranslate(-50%, -50%rotate(-5deg);
          transformtranslate(-50%, -50%rotate(-5deg);
}
.riceball.tres {
  bottom0;
  right30px;
  -webkit-animation1.2s little-bob2 linear infinite;
          animation1.2s little-bob2 linear infinite;
}

.syrup {
  position: absolute;
  bottom: -50px;
  width500px;
  height200px;
  border-radius50%;
  backgroundurl("../img/1.jpg"0 0/10em 10emradial-gradient(ellipse at bottom center, #f0ad42 0%#feda90 31%#f0ad42 66%#feda90 86%#f0ad42 100%);
  background-blend-mode: hard-light;
}

.bowl {
  position: absolute;
  topcalc(50% + 100px);
  left50%;
  -webkit-transformtranslate(-50%, -50%);
          transformtranslate(-50%, -50%);
  width500px;
  height250px;
  backgroundurl("../img/1.jpg"0 0/15em 15emradial-gradient(ellipse at top left, #fff 0%#fcfcfc 35%#f1ccbb 60%#fdf1dd 70%#fff 80%);
  background-blend-mode: hard-light;
  border-bottom-left-radius230px;
  border-bottom-right-radius230px;
  box-shadow15px 40px 80px -30px #C5AE9F;
}

.back {
  position: absolute;
  top: -100px;
  width500px;
  height200px;
  border-radius50%;
  backgroundurl("../img/1.jpg"0 0/10em 10emradial-gradient(ellipse at bottom right, #fff 0%#fcfcfc 35%#f1ccbb 60%#fdf1dd 75%#fff 90%);
  background-blend-mode: hard-light;
}

.contents {
  position: fixed;
  bottom150px;
  width500px;
  height400px;
  border-bottom-left-radius50% 100px;
  border-bottom-right-radius50% 100px;
  border-top-left-radius0;
  border-top-right-radius0;
  overflow: hidden;
}

.spoon {
  position: absolute;
  top: -60%;
  left: -200px;
  -webkit-transformrotate(25deg);
          transformrotate(25deg);
  width300px;
  height40px;
  backgroundurl("../img/1.jpg"0 0/5em 10emlinear-gradient(to bottom, #fff 40%#e2d7cb 100%);
  background-blend-mode: hard-light;
  border-top-left-radius20px;
  border-bottom-left-radius20px;
  -webkit-animation: spoon-up 3s infinite;
          animation: spoon-up 3s infinite;
}
.spoon .scoop {
  position: absolute;
  top50%;
  right: -200px;
  -webkit-transformtranslateY(-50%);
          transformtranslateY(-50%);
  width220px;
  height140px;
  border-radius50%;
  backgroundurl("../img/1.jpg"0 0/10em 10em#fff;
  background-blend-mode: hard-light;
  box-shadow: inset -10px -5px 15px #ceb49910px 10px 50px -10px #C5AE9F;
}
.spoon .scoop::before {
  display: block;
  content"";
  position: absolute;
  top2px;
  left50%;
  -webkit-transformtranslateX(-50%);
          transformtranslateX(-50%);
  width200px;
  height120px;
  backgroundurl("../img/1.jpg"0 0/10em 10emlinear-gradient(to bottom, #e2d7cb 20%#fff 100%);
  background-blend-mode: hard-light;
  border-radius50%;
}

@-webkit-keyframes spoon-up {
  0% {
    top: -60%;
    left: -200px;
  }
  25% {
    top: -80%;
    -webkit-transformrotate(15deg);
            transformrotate(15deg);
  }
  50% {
    top: -90%;
    left: -300px;
    -webkit-transformrotate(25deg);
            transformrotate(25deg);
  }
  100% {
    top: -60%;
    left: -200px;
    -webkit-transformrotate(25deg);
            transformrotate(25deg);
  }
}

@keyframes spoon-up {
  0% {
    top: -60%;
    left: -200px;
  }
  25% {
    top: -80%;
    -webkit-transformrotate(15deg);
            transformrotate(15deg);
  }
  50% {
    top: -90%;
    left: -300px;
    -webkit-transformrotate(25deg);
            transformrotate(25deg);
  }
  100% {
    top: -60%;
    left: -200px;
    -webkit-transformrotate(25deg);
            transformrotate(25deg);
  }
}
@-webkit-keyframes rice-up {
  0% {
    left150px;
    bottom65px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
  25% {
    bottom160px;
    -webkit-clip-pathinset(-40px -30px 0 -20px);
            clip-pathinset(-40px -30px 0 -20px);
  }
  50% {
    left20px;
    bottom140px;
    -webkit-clip-pathinset(-40px -30px 0 -20px);
            clip-pathinset(-40px -30px 0 -20px);
  }
  55% {
    -webkit-clip-pathinset(-40px -30px 0 -20px);
            clip-pathinset(-40px -30px 0 -20px);
  }
  100% {
    left150px;
    bottom65px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
}
@keyframes rice-up {
  0% {
    left150px;
    bottom65px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
  25% {
    bottom160px;
    -webkit-clip-pathinset(-40px -30px 0 -20px);
            clip-pathinset(-40px -30px 0 -20px);
  }
  50% {
    left20px;
    bottom140px;
    -webkit-clip-pathinset(-40px -30px 0 -20px);
            clip-pathinset(-40px -30px 0 -20px);
  }
  55% {
    -webkit-clip-pathinset(-40px -30px 0 -20px);
            clip-pathinset(-40px -30px 0 -20px);
  }
  100% {
    left150px;
    bottom65px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
}
@-webkit-keyframes face-bob {
  0% {
    -webkit-transformtranslate(-50%, -50%rotate(10deg);
            transformtranslate(-50%, -50%rotate(10deg);
  }
  50% {
    height10px;
    -webkit-transformtranslate(-50%, -50%rotate(-10deg);
            transformtranslate(-50%, -50%rotate(-10deg);
  }
  100% {
    -webkit-transformtranslate(-50%, -50%rotate(10deg);
            transformtranslate(-50%, -50%rotate(10deg);
  }
}
@keyframes face-bob {
  0% {
    -webkit-transformtranslate(-50%, -50%rotate(10deg);
            transformtranslate(-50%, -50%rotate(10deg);
  }
  50% {
    height10px;
    -webkit-transformtranslate(-50%, -50%rotate(-10deg);
            transformtranslate(-50%, -50%rotate(-10deg);
  }
  100% {
    -webkit-transformtranslate(-50%, -50%rotate(10deg);
            transformtranslate(-50%, -50%rotate(10deg);
  }
}
@-webkit-keyframes eye-bulge {
  0% {
    width12px;
    height12px;
  }
  50% {
    width18px;
    height18px;
  }
  100% {
    width12px;
    height12px;
  }
}
@keyframes eye-bulge {
  0% {
    width12px;
    height12px;
  }
  50% {
    width18px;
    height18px;
  }
  100% {
    width12px;
    height12px;
  }
}
@-webkit-keyframes little-bob1 {
  0% {
    bottom: -35px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
  50% {
    bottom: -33px;
    -webkit-clip-pathinset(-40px -30px 23% -20px);
            clip-pathinset(-40px -30px 23% -20px);
  }
  100% {
    bottom: -35px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
}
@keyframes little-bob1 {
  0% {
    bottom: -35px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
  50% {
    bottom: -33px;
    -webkit-clip-pathinset(-40px -30px 23% -20px);
            clip-pathinset(-40px -30px 23% -20px);
  }
  100% {
    bottom: -35px;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
}
@-webkit-keyframes little-bob2 {
  0% {
    bottom0;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
  50% {
    bottom: -2px;
    -webkit-clip-pathinset(-40px -30px 26% -20px);
            clip-pathinset(-40px -30px 26% -20px);
  }
  100% {
    bottom0;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
}
@keyframes little-bob2 {
  0% {
    bottom0;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
  50% {
    bottom: -2px;
    -webkit-clip-pathinset(-40px -30px 26% -20px);
            clip-pathinset(-40px -30px 26% -20px);
  }
  100% {
    bottom0;
    -webkit-clip-pathinset(-40px -30px 25% -20px);
            clip-pathinset(-40px -30px 25% -20px);
  }
}

运行效果:

怎么用css3绘制汤勺捞起汤圆的动画特效

关于“怎么用css3绘制汤勺捞起汤圆的动画特效”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“怎么用css3绘制汤勺捞起汤圆的动画特效”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注亿速云行业资讯频道。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI

开发者交流群×