gsap实现鼠标悬浮摇晃星级评分打分效果代码
代码语言:html
所属分类:星级评分
代码描述:gsap实现鼠标悬浮摇晃星级评分打分效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
html {
height: 100%;
background-color: #2e3139;
}
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 3vh;
height: 100%;
}
.rating-set {
display: flex;
}
.rating-unit {
padding: min(5vw, 4vh);
position: relative;
cursor: pointer;
}
.dot {
width: 20%;
aspect-ratio: 1 / 1;
border-radius: 50%;
background-color: #666;
box-shadow: inset 1px 1px 5px rgba(0,0,0,0.4);
position: absolute;
translate: -50% -50%;
z-index: -1; /* Prevents overlap with star on iOS */
}
.star {
rotate: y -90deg;
width: 100%;
transform-origin: 50% 50%;
position: absolute;
translate: -50% -50% !important; /* Important is here so that GSAP doesn't override the translate value */
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
transition: filter 1s;
}
.star.hover {
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4)) brightness(150%);
transition: filter 1s;
}
/* Define SVG graphic */
.star {
aspect-ratio: 64 / 61;
background-size: contain;
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nNjQnIGhlaWdodD0nNjEnIHZpZXdCb3g9JzAgMCA2NCA2MScgZmlsbD0nbm9uZScgeG1sbn.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0