纯css实现一个泡泡checkbox选中未选中动画效果

代码语言:html

所属分类:表单美化

代码描述:纯css实现一个泡泡checkbox选中未选中动画效果

代码标签: 一个 泡泡 checkbox 选中 选中 动画 效果

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


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

<head>

  <meta charset="UTF-8">

  
  
<style>
* {
	border: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
:root {
	--bubbleTiming: cubic-bezier(0.5,0.15,0.25,1.75);
	font-size: calc(40px + (60 - 40) * (100vw - 320px) / (1280 - 320))
}
body, input {
	font: 1em/1.5 sans-serif;
}
body {
	background: hsl(223,90%,65%);
	display: grid;
	height: 100vh;
	place-items: center;
}
label, .bubble {
	display: block;
	-webkit-tap-highlight-color: transparent;
}
label {
	animation: float 4s ease-in-out infinite;
}
.bubble, .bubble:before, .bubble:after  {
	transition-duration: 0.2s;
}
.bubble, .bubble:after {
	border-radius: 50%;
}
.bubble {
	background-image:
		radial-gradient(8% 8% at 22% 28%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%),
		radial-gradient(8% 8% at 23% 27%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%),
		radial-gradient(8% 8% at 24% 26%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%),
		radial-gradient(8% 8% at 25% 25%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%),
		radial-gradient(8% 8% at 26% 24%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%),
		radial-gradient(8% 8% at 27% 23%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%),
		radial-gradient(8% 8% at 28% 22%,hsl(0,0%,100%) 45%,hsla(0,0%,100%,0) 50%);
	box-shadow:
		0 -0.06em 0.1em hsl(0,90%,100%) inset,
		0 -0.15em 0.4em hsl(0,90%,45%) inset,
		0 0.05em 0.05em hsl(0,90%,45%) inset,
		0.05em 0 0.1em hsl(0,90%,100%) inset,
		-0.05em 0 0.1em hsl(0,90%,100%) inset,
		0 0.1em 0.4em hsl(0,90%,60%) inset;
	cursor: pointer;
	position: relative;
	width: 3em;
	height: 3em;
	transform-style: preserve-3d;
	transition-property: box-shadow, transform, width, height;
	transition-timing-function: ease-in-out, ease-in-out, var(--bubbleTiming), var(--bubbleTiming);
	will-change: transform;
	-webkit-appearance: none;
	appearance: none;
	z-index: 0;
}
.bubble:before, .bubble:after {
	content: "";
	display: block;
	position: absolute;
	transition-timing-function: var(--bubbleTiming);
}
.bubble:before {
	border-radius: 0.75em;
	box-shadow:
		0 0 0 0.5em hsl(0,0%,.........完整代码请登录后点击上方下载按钮下载查看

网友评论0