Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

CSS animations - Trying to reproduce this animation

I'm trying to reproduce this animation via css https://www.instagram.com/p/CJrYX60AYqS/.

You can find my code here https://codepen.io/giulianomlodi/pen/YzGMVNE.

.container {
  position: relative;
  text-align: center;
  justify-content: center;
  align-content: center;
  animation-name: container1;
  transition: all linear;
  animation-duration: 2s;
  animation-iteration-count: infinite;
  animation-fill-mode: forward;
  animation-timing-function: linear;
  transform-style: preserve-3d;
  transition-delay: 1s;
}

@keyframes container1 {
  0% {}
  100% {
    filter: alpha(opacity=0);
    opacity: 0;
  }
}

.circle1 {
  position: absolute;
  height: 205px;
  width: 205px;
  border-radius: 50%;
  background: #E1E3D1;
  box-shadow: -29px 29px 58px #bfc1b2, 29px -29px 58px #fffff0;
  animation-name: circle1an1;
  transition: all linear;
  animation-duration: 2s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  transform-style: preserve-3d;
  transition-delay: 1s;
}

@keyframes circle1an1 {
  0% {
    filter: alpha(opacity=0);
    opacity: 0;
    transform: scale(1.0);
  }
  100% {
    transform: scale(2.0);
  }
}

.circle2 {
  position: absolute;
  height: 410px;
  width: 410px;
  border-radius: 50%;
  background: #E1E3D1;
  box-shadow: -29px 29px 58px #bfc1b2, 29px -29px 58px #fffff0;
  animation-name: circle2an1;
  transition: all linear;
  animation-duration: 2s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  transition-delay: 2s;
}

@keyframes circle2an1 {
  0% {
    transform: scale(1.0);
  }
  100% {
    transform: scale(2.0);
  }
}

.circle3 {
  position: absolute;
  height: 615px;
  width: 615px;
  border-radius: 50%;
  background: #E1E3D1;
  box-shadow: -29px 29px 58px #bfc1b2, 29px -29px 58px #fffff0;
  animation-name: circle3an1;
  transition: all linear;
  animation-duration: 2s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  transform-style: preserve-3d;
  transition-delay: 3s;
}

@keyframes circle3an1 {
  0% {
    transform: scale(1.0);
  }
  100% {
    filter: alpha(opacity=0);
    opacity: 0;
    transform: scale(2.0);
  }
}
<div id="container1">
  <div class="circle3"></div>
  <div class="circle2"></div>
  <div class="circle1"></div>
</div>
question from:https://stackoverflow.com/questions/65828981/css-animations-trying-to-reproduce-this-animation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to adjust the seconds for delay for each of the wave. In your CSS you have the following two attributes for each wave:

  animation-duration: 2s;
  transition-delay: 2s;

You have to increase these values for all waves, so the wave goes until the end and becomes transparent. So they will start smoothly and end smoothly, like you wish.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...