css+js实现魔法棒变色粒子喷射动画效果代码

代码语言:html

所属分类:动画

代码描述:css+js实现魔法棒变色粒子喷射动画效果代码

代码标签: css js 魔法棒 变色 粒子 喷射 动画

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

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

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

  
  
<style>
html {
	cursor: none;
	font-family: system-ui;
	display: grid;
	place-items: center;
	min-height: 100vh;
	user-select: none;
}
body {
	background: black;
	overflow: hidden;
	color: white;
	--color-spark: gold;
}

#sparkler {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 1px;
	height: 1px;
	transform: rotate(-25deg);
	border-radius: 50%;
	box-shadow: 0 0 2500px 100px var(--color-spark);
}
#sparkler:before {
	content: '';
	width: 10px;
	height: 25vh;
	background: linear-gradient(to right, dimgray, silver);
	position: absolute;
	top: 0;
	left: 0;
	border-radius: 1rem;
}
#sparkler:after {
	content: '';
	width: 4px;
	height: 25vh;
	background: linear-gradient(to right, dimgray, gray);
	position: absolute;
	top: calc(25vh - 1px);
	left: 3px;
/* 	border-radius: 1rem; */
}

.particle {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: radial-gradient(rgba(255,255,255,.5) 10%, var(--color-spark) 50%);
	box-shadow: 0 0 30px var(--color-spark);
	filter: blur(3px);
	position: absolute;
	transition: .5s linear;
	z-index: 100;
}
</style>

  
</head>

<body>
  click to change color
<div id='sparkler'></div>

  
      <script>
const div = document.querySelector('#sparkler');

function sparkle() {.........完整代码请登录后点击上方下载按钮下载查看

网友评论0