three实现文字三维探照灯走光交互效果代码
代码语言:html
所属分类:三维
代码描述:three实现文字三维探照灯走光交互效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
body {
height: 100vh;
background-color: hotpink;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
<div class="canvas" id="canvas-wrapper" aria-label="neumorphism"></div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.108.js"></script>
<script >
const colorBg = 'hotpink'; // #ff69b4
const colorTypo = '#ff49a4'; // dark pink
const nearDist = 0.1;
const farDist = 10000;
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
nearDist,
farDist);
camera.position.z = Math.round(farDist / 20);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(colorBg);
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.querySelector(&q.........完整代码请登录后点击上方下载按钮下载查看
网友评论0