喜欢收藏按钮点击动画特效

代码语言:html

所属分类:表单美化

代码描述:喜欢收藏按钮点击动画特效

代码标签: 点击 动画 特效

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

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

<style>
* {
  box-sizing: border-box;
}
body {
  min-height: 100vh;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  background: #fafafa;
}
body > * + * {
  margin-right: 24px;
}
:root {
  --transition: 0.3;
  --heart-fill: #e63b19;
}
.heart {
  height: 100%;
  width: 100%;
  position: absolute;
}
.heart--stroke {
  stroke: var(--heart-stroke);
  stroke-width: 2.5px;
  fill: none;
}
.heart--fill {
  stroke: none;
  fill: var(--heart-fill);
  -webkit-transform: scale(var(--scale, 0));
          transform: scale(var(--scale, 0));
}
.heart__particle {
  height: 16px;
  width: 16px;
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  background: hsl(var(--h), 80%, 70%);
  -webkit-transform: translate(-50%, -50%) rotate(calc(var(--r, 0) * 1deg)) translate(0, calc(var(--radius, 0) * 1px)) scale(0);
          transform: translate(-50%, -50%) rotate(calc(var(--r, 0) * 1deg)) translate(0, calc(var(--radius, 0) * 1px)) scale(0);
}
.button {
  height: 40px;
  border: 0;
  cursor: pointer;
  border-radius: 6px;
  position: relative;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  width: 100px;
  font-family: sans-serif;
  text-align: left;
  outline: transparent;
  color: var(--stroke);
  background: var(--fill);
  background: hsl(var(--hue), calc(var(--saturation) * 1%), calc(var(--lightness) * 1%));
  box-shadow: 2px 4px 4px rgba(26,26,26,0.5);
  -webkit-transition: box-shadow 0.2s, background 0.2s;
  transition: box-shadow 0.2s, background 0.2s;
}
.button--primary {
  --hue: 260;
  --saturation: 50;
  --lightness: 20;
  --stroke: #fff;
  --heart-stroke: #fff;
  margin-right: 24px;
}
.button--secondary {
  --hue: 0;
  --saturation: 0;
  --lightness: 100;
  --stroke: #666;
  --heart-stroke: #999;
}
.button__text {
  margin-right: 6px;
  opacity: var(--opacity);
}
.button__icon {
  position: relative;
  height: 24px;
  width: 24px;
}
.button:hover {
  --scale: 0.3;
  background: hsl(var(--hue), calc(var(--saturation) * 1%), calc(var(--lightness) * 0.96%));
  box-shadow: 2px 2px 4px rgba(26,26,26,0.5);
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0