css+js实现水流瀑布动画效果代码

代码语言:html

所属分类:动画

代码描述:css+js实现水流瀑布动画效果代码

代码标签: css js 水流 瀑布 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

  
  
<style>
html {
  min-height: 100vh;
  display: grid;
  place-items: center;  
  background: linear-gradient(to bottom, forestgreen 9%, green 9% 42.3%, forestgreen 42.3%);
}

body {
  perspective: 50vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

.box {
  width: 50vh;
  aspect-ratio: 1/1;
  background: lightblue;
  position: relative;  
}
.box:nth-child(2):hover .row {
  opacity: .25;
}

.box:first-child {
  transform-origin: 50% 100%;
  transform: translateY(-73%) rotateX(25deg);
}
.box:nth-child(2) {
  transform: translateY(-73%);
}

.box:nth-child(2):before {
  content: '';
  width: 50%;
  height: 75%;
  position: absolute;
  left: 25%;
  bottom: 0;
  border-radius: 50% 50% 0 0;
  background: radial-gradient(at 50% 100%, black 25%, gray 80%);
  box-shadow: 
    inset -2rem 2rem 0 gray,
    inset 2rem 2rem 0 gray;
}
.box:nth-child(2):hover .row {
  opacity: .1;
}

.box:nth-child(3) {
  transform-origin: 50% 0%;
  transform: translateY(-73%) rotateX(45deg);
}

.row {
  width: 100%;
  height: 10%;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity .5s;
}

.barrel {
  width: 3vh;
  aspect-ratio: 1/1.5;
  background:
    linear-gradient(to bottom, transparent 60%, sienna 60%),
    linear-gradient(to right, transparent 4px, sienna 4px 5px), 
    peru;
  background-size: 100% 35%, 5px 100%;
  position: absolute;
  top: -3vh;
  left: calc(50% - 1.5vh);
  border-radius: 50% 50% / 100% 100%;
  border-top: 3px solid saddlebrown;
  border-bottom: 3px solid saddlebrown;
  z-index: 999999;
  clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 0% 75%);
  box-shadow: inset 0 0 10px rgba(0,0,0,.25);
  animation: bar 10s linear infinite;
}
@keyframes bar {
  9% { top: 9vh; transform: rotate(0deg); clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 0% 75%); }
  9.25% { clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%); }
  25% { top: 60vh; transform: rotate(720deg); clip-path: polygon(0% 0%, 100% 0%, 1.........完整代码请登录后点击上方下载按钮下载查看

网友评论0