radio点击选择爆炸动画效果代码

代码语言:html

所属分类:其他

代码描述:radio点击选择爆炸动画效果代码

代码标签: 爆炸 动画 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Hind&amp;display=swap'>
  
<style>
* {
	border: 0;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
:root {
	--fg: #17181c;
	--trans: 0.15s;
	font-size: calc(30px + (40 - 30) * (100vw - 320px) / (1280 - 320));
}
body, button, input {
	font: 1em/1.5 "Hind", sans-serif;
}
body {
	background-color: #79934f;
	color: var(--fg);
	display: flex;
	height: 100vh;
}
button, input, label {
	cursor: pointer;
	-webkit-tap-highlight-color: #0000;
}
button, input {
	-webkit-appearance: none;
	appearance: none;
}
button, input[type=radio]:focus {
	outline: 0;
}
button {
	background-color: #255ff4;
	border-radius: 0.2em;
	color: #fff;
	display: block;
	margin: auto;
	padding: 0.5em 1em;
	transition: background-color var(--trans) linear;
}
button:focus, button:hover {
	background-color: #0b46da;
}
button:active {
	transform: translateY(0.1em);
}
form {
	margin: auto;
	padding: 1.5em 0;
}
input[type=radio], input[type=radio]:before, input[type=radio]:after, .dirt, .dust, .dust-fog {
	border-radius: 50%;
}
input[type=radio]:before, input[type=radio]:after, .dirt, .dust, .dust-fog {
	position: absolute;
}
input[type=radio], label {
	position: relative;
}
input[type=radio] {
	--dur: 0.6s;
	animation: createHole var(--dur) steps(1);
	background-image:
		radial-gradient(1em 1em at 0.5em 0.5em,#b38d56 49%,#b38d5600 50%),
		radial-gradient(1em 1em at 1.5em 0.5em,#2f2215 9%,#523c25 10% 19%,#7c6139 20% 29%,#a8824c 30% 39%,#b38d56 40% 49%,#b38d5600 50%);
	background-position: -1em 0;
	background-repeat: no-repeat;
	background-size: 2em 1em;
	font-size: 2em;
	margin-right: 0.5rem;
	width: 1em;
	height: 1em;
}
input[type=radio]:before, input[type=radio]:after {
	content: "";
	display: block;
	transform: scale(0);
}
input[type=radio]:before {
	animation: burrow var(--dur) linear;
	background-image:
		radial-gradient(100% 100% at center,#45495400 19%,#454954 20% 24%,#818897 25% 39%,#81889700 40%),
		repeating-conic-gradient(from 0 at center,#737a8c 0deg 10deg,#737a8c00 11deg 29deg,#737a8c 30deg 40deg);
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
input[type=radio]:after {
	animation: hubIn var(--dur) linear;
	background-color: #255ff4;
	box-shadow: 0 -0.1em 0 #0b46da inset;
	top: 30%;
	left: 30%;
	width: 40%;
	height: 40%;
}
input[type=radio]:checked:before, input[type=radio]:checked:after {
	transform: scale(1);
}
input[type=radio]:checked:before {
	animation: surface var(--dur) linear;
}
input[type=radio]:checked:after {
	animation: hubOut var(--dur) linear;
}
input[type=radio].pristine, input[type=radio].pristine:before, input[type=radio].pristine:after {
	animation: none;
}
input[type=radio].pristine {
	background-position: 0 0;
}
input[type=radio] + span {
	transition: color var(--trans) linear;
}
input[type=radio]:focus + span {
	color: #dbc9a4;
}
label {
	background-color: #a8824c;
	border-radius: 0.25em;
	box-shadow: 0 0.05em 0 0.05em #5e723d inset;
	display: flex;
	align-items: center;
	margin-bottom: 0.5em;
	padding: 0.25em 0.5em 0.25em 0.25em;
}
.dirt, .dust, .dust-fog {
	display: block;
	top: 50%;
	left: 1.25em;
	pointer-events: none;
}
.dirt {
	background-color: #7c6139;
	width: 0.4em;
	height: 0.4em;
	z-index: 1;
	transform: translate(-0.2em,-0.2em) scale(0);
}
.dust {
	background-color: #ccb380;
	width: 0.8em;
	height: 0.8em;
	z-index: 2;
	transform: translate(-0.4em,-0.4em) scale(0);
}
.dust-fog {
	background-color: #ccb38020;
	width: 1em;
	height: 1em;
	z-index: 3;
	transform: translate(-0.5em,-0.5em) scale(0);
}
/* Animations */
@keyframes burrow {
	from {
		transform: rotate(0turn) scale(1);
	}
	50% {
		transform: rotate(0.5turn) scale(1.2);
	}
	to {
		transform: rotate(1turn) scale(0);
	}
}
@keyframes createHole {
	from {
		background-position: 0 0;
	}
	to {
		background-position: -1em 0;
	}
}
@keyframes hubIn {
	from {
		transform: scale(1);
	}
	50% {
		transform: scale(1.2);
	}
	to {
		transform: scale(0);
	}
}
@keyframes hubOut {
	from {
		transform: scale(0);
	}
	50% {
		transform: scale(1.2);
	}
	to {
		transform: scale(1);
	}
}
@keyframes surface {
	from {
		transform: rotate(0turn) scale(0);
	}
	50% {
		transform: rotate(0.5turn) scale(1.2);
	}
	to {
		transform: rotate(1turn) scale(1);
	}
}
</style>

</head>

<body>
  <form>
	<label>
		<input type=&q.........完整代码请登录后点击上方下载按钮下载查看

网友评论0