js+css实现发光魔法棒跟随鼠标移动点击换色效果代码

代码语言:html

所属分类:其他

代码描述:js+css实现发光魔法棒跟随鼠标移动点击换色效果代码

代码标签: js css 发光 魔法 跟随 鼠标 移动 点击 换色

下面为部分代码预览,完整代码请点击下载或在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: peru;
}

#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 {
	height: 5px;
	border-radius: 50%;
	background: linear-gradient(to right, transparent, var(--color-spark), white, var(--color-spark), transparent);
	box-shadow: 0 0 30px var(--color-spark);
	position: absolute;
	transition: .5s linear;
	z-index: 100;
}
</style>


</head>

<body>
  click to change color
<div id='sparkler'&g.........完整代码请登录后点击上方下载按钮下载查看

网友评论0