請讓我對這個代碼有第二個看法。有些不對勁,但是我似乎就是不能把這件事做好。下面是git帖子的鏈接和我的代碼 https://codepen.io/soju22/full/wvyBorP
我嘗試過導(dǎo)入three.js,盡管我知道我不需要它。我認為問題在于依賴關(guān)系的javascript導(dǎo)入。
import { neonCursor } from 'threejs-toys'
neonCursor({
el: document.getElementById('app'),
shaderPoints: 16,
curvePoints: 80,
curveLerp: 0.5,
radius1: 5,
radius2: 30,
velocityTreshold: 10,
sleepRadiusX: 100,
sleepRadiusY: 100,
sleepTimeCoefX: 0.0025,
sleepTimeCoefY: 0.0025
})
body, html, #app {
margin: 0;
width: 100%;
height: 100%;
}
#app {
overflow: hidden;
touch-action: pan-up;
color: #ffffff;
font-family: 'Montserrat', sans-serif;
text-align: center;
text-shadow: 0 0 5px #ffffff, 0 0 20px #000, 0 0 30px #000;
}
#app h1 {
--fontSize: 60px;
--lineHeight: 80px;
width: auto;
height: calc(2 * var(--lineHeight));
line-height: var(--lineHeight);
margin: calc(50vh - var(--lineHeight)) auto 0;
font-size: var(--fontSize);
text-transform: uppercase;
}
#app a {
margin-top: 10px;
display: inline-block;
text-decoration: none;
color: #fff;
}
#app canvas {
display: block;
position: fixed;
z-index: -1;
top: 0;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VD Capital</title>
<link rel="stylesheet" href="test.css">
<script src="https://kit.fontawesome.com/365cb50038.js" crossorigin="anonymous"></script>
<link rel="preconnect" >
<link rel="preconnect" crossorigin>
<link rel="stylesheet">
</head>
<body>
<div id="app">
<div id="hero">
<h1>NEON<br/>CURSOR</h1>
<a target="_blank" >github/threejs-toys</a>
</div>
</div>
<script type="module" src="test.js"></script>
</body>
</html>