纯css布局实现一个心跳动画

代码语言:html

所属分类:布局界面

代码描述:纯css布局实现一个心跳动画

代码标签: 实现 一个 心跳 动画

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
@import url("https://fonts.googleapis.com/css?family=Pacifico&display=swap");
body {
  background-color: #0b0b0b;
  font-family: 'Pacifico', cursive;
}

.title {
  color: #fff;
  text-align: center;
  font-size: 60px;
  position: relative;
  top: 50px;
}

.heart {
  position: absolute;
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background-color: transparent;
  -webkit-animation: heart 1s linear infinite;
          animation: heart 1s linear infinite;
}
.heart:before, .heart:after {
  content: '';
  position: absolute;
  top: 0;
  border-radius: 50% 50% 0 0;
  width: 105px;
  height: 150px;
  background-color: #ff3e3e;
}
.heart:before {
  left: 0px;
  -webkit-transform: rotate(-49deg);
          transform: rotate(-49deg);
}
.heart:after {
  right: 0px;
  -webkit-transform: rotate(49deg);
          transform: rotate(49deg);
}
.heart span {
  background-color: rgba(255, 255, 255, 0.5);
  width: 35px;
  height: 15px;
  border-radius: 40%;
  display: inline-block;
  position: absolute;
  right: 15px;
  top: 25px;
  z-index: 5;
}
.heart span:after {
  content: '';
  position: absolute;
  bottom: -2px;
  width: 130%;
  background-color: #ff3e3e;
  height: 11px;
  border-radius: 50% 50% 0 0;
  left: 50%;
  -webkit-transform: translateX(-50%);
          transform: translateX(-50%);
}

@-webkit-keyframes heart {
  0% {
    -webkit-transform: translate(-50%, -50%) scale(1, 1);
            transform: translat.........完整代码请登录后点击上方下载按钮下载查看

网友评论0