svg+css实现星级评分打分动画效果代码

代码语言:html

所属分类:星级评分

代码描述:svg+css实现星级评分打分动画效果代码

代码标签: svg css 星级 评分 打分 动画

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

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

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

  
  
  
<style>
* {
  box-sizing: border-box;
}

:root {
  --background-color: hsl(208.7, 100%, 9%);
  --on-color: #ffc107;
  --off-color: hsl(208.7, 50%, 25%);
  background-color: var(--background-color);
}

body {
  margin: 0;
  display: flex;
  place-items: center;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rating {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0 4px;
  height: 40px;
}

.rating-button {
  appearance: none;
  background: none;
  outline: none;
  border: none;
  padding: 0;
  height: 100%;
  cursor: pointer;
  --transition-delay: 0s;
}

.rating--animatable .rating-button {
  transition: 0.4s cubic-bezier(0.23, 1, 0.32, 1) transform;
}

.rating-button:active {
  transform: scale(0.8);
}

.rating-button--active:active {
  transform: scale(1.1);
}

.star {
  transform: scale(0.5) rotate(0deg);
  height: 100%;
  color: var(--off-color);
}

.rating--animatable .star {
  transition: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) all;
  transition-delay: var(--transition-delay);
}

.rating-button--active .star {
  transform: scale(0.9) rotate(360deg);
  color: var(--on-color);
}
</style>


  
</head>

<body >
  <d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0