gsap+svg实现可爱零正数负数拖动效果代码

代码语言:html

所属分类:拖放

代码描述:gsap+svg实现可爱零正数负数拖动效果代码

代码标签: gsap svg 可爱 正数 负数 拖动

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

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

<head>

  <meta charset="UTF-8">
  

  
  <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Quicksand:wght@700&amp;display=swap'>
  
<style>
body {
  height: 100vh;
  margin: 0;
  padding: 0;
  background: #bdc5ff;
}

.grid {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  place-items: center;
}

.runner {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 300vw;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

.number {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: 100vw;
  height: 100vh;
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  width: 200px;
  position: fixed;
  bottom: 2rem;
  left: calc(50% - 100px);
}

input[type=range]::-webkit-slider-runnable-track {
  background: #fcfcfc;
  height: 1rem;
  border-radius: 0.25rem;
  border: 3px solid black;
}

input[type=range]::-moz-range-track {
  background: #fcfcfc;
  height: 1rem;
  border-radius: 0.25rem;
  border: 3px solid black;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -0.75rem;
  background-color: #ffd433;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 3px solid black;
  box-shadow: 2px 2px 0 0 black;
}

input[type=range]::-moz-range-thumb {
  margin-top: -0.75rem;
  background-color: #ffd433;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 3px solid black;
  box-shadow: 2px 2px 0 0 black;
}

svg {
  overflow: visible;
}

.shadow {
  fill: rgba(0, 0, 0, 0.1);
}

.leg, .foot, .mouth, .body, .eyebrows {
  fill: none;
  stroke: #000;
  stroke-linecap: round;
  stroke-width: 6px;
}

.foot, .mouth {
  stroke-width: 8px;
}

.neutral {
  fill: #99a1ff;
}
.neutral.dark {
  fill: #808aff;
}
.neutral.shadow {
  fill: #6672ff;
  fill-opacity: 0.2;
}

.negative {
  fill: #ff4d6f;
}
.negative.dark {
  fill: #ff345a;
}
.negative.shadow {
  fill: #ff1a46;
  fill-opacity: 0.2;
}

.positive {
  fill: #2fda98;
}
.positive.dark {
  fill: #24cb8b;
}
.positive.shadow {
  fill: #20b67c;
  fill-opacity: 0.2;
}
</style>


</head>

<body >
  <div class="grid">
	<div class="runner">
		<!-- 
			Negative
		-->
		<div class="number">
				<svg id="Negative" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 400 400">
					<defs>
					 <clipPath id="neg-eye-clip">
							<path d="M216.15,172c0,8.28-5.6,15-12.5,15-6.9,0-12.5-6.72-12.5-15,0-8.28,5.6-15,12.5-15s12.5,6.72,12.5,15Z" style="fill: none;"/>
						</clipPath>
						<g id="neg-eye" clip-path="url(#neg-eye-clip)&qu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0