js+css实现图片跟随鼠标移动交互代码
代码语言:html
所属分类:其他
代码描述:js+css实现图片跟随鼠标移动交互代码
代码标签: js css 图片 跟随 鼠标 移动 交互 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>交互数字人 - 视线跟随系统</title>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Noto+Sans+SC:wght@200;400;700&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--bg: #060a12;
--fg: #dce4f0;
--muted: #4e6180;
--accent: #00ffc8;
--accent2: #00a8ff;
--card: rgba(10, 16, 28, 0.92);
--border: rgba(0, 255, 200, 0.1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: var(--bg);
color: var(--fg);
font-family: 'Noto Sans SC', sans-serif;
overflow: hidden;
width: 100vw;
height: 100vh;
cursor: none;
}
/* 网格背景 */
body::before {
content: '';
position: fixed;
inset: 0;
background-image:
linear-gradient(rgba(0,255,200,0.025) 1px, transparent 1px),
linear-gradient(90deg, rgba(0,255,200,0.025) 1px, transparent 1px);
background-size: 50px 50px;
z-index: 0;
pointer-events: none;
}
/* 背景Canvas */
#bgCanvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
z-index: 1;
pointer-events: none;
}
/* 主容器 */
.main-container {
position: relative;
z-index: 2;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.2rem;
}
/* 标题 */
.title-area { text-align: center; }
.title {
font-family: 'Orbitron', sans-serif;
font-size: clamp(1.4rem, 4vw, 2.4rem);
font-weight: 900;
letter-spacing: 0.15em;
background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 0.25rem;
}
.subtitle {
font-size: 0.8rem;
font-weight: 200;
color: var(--muted);
letter-spacing: 0.35em;
}
/* 头像容器 */
.avatar-container {
position: relative;
perspective: 1000px;
}
.avatar-fr.........完整代码请登录后点击上方下载按钮下载查看















网友评论0