jquery+svg实现爱心点赞动画效果代码

代码语言:html

所属分类:其他

代码描述:jquery+svg实现爱心点赞动画效果代码

代码标签: jquery svg 爱心 点赞 动画

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

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

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

  
  
  
  
<style>
body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #101010;
}

* {
  box-sizing: border-box;
}

.like {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.like svg {
  margin: 11px 9px 7px 9px;
  transform: translate3d(0, 0, 0);
}
.like svg .heart {
  opacity: 1;
  transition: all 0.3s ease;
  transform-origin: center;
}
.like svg .thread {
  stroke-dashoffset: 87;
  stroke-dasharray: 87;
  transform: scale(0.5);
  transform-origin: center;
}

.like.liked svg {
  animation: bounce 0.8s ease;
}
.like.liked svg .heart {
  opacity: 0;
  transform: scale(0.5);
}
.like.liked svg .thread {
  animation: threadheart 0.6s ease-in forwards;
}

@keyframes bounce {
  0% {
    transform: scale(1);
  }
  60% {
    transform: scale(1);
  }
  80% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes threadheart {
  0% {
    fill: rgba(255, 48, 64, 0);
    transform: scale(0.5);
    stroke-dashoffset: 87;
  }
  95% {
    fill: rgba(255, 48, 64, 0);
    transform: scale(1);
    stroke-dashoffset: 0;
  }
  10.........完整代码请登录后点击上方下载按钮下载查看

网友评论0