三维文字走光效果
代码语言:html
所属分类:三维
下面为部分代码预览,完整代码请点击下载或在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 translate="no"> <div class="canvas" id="canvas-wrapper" aria-label="bfw.wiki"></div> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/three.js"></script> <script > /* * NEUMORPHISM TYPO * Made with ThreeJS - Enjoy! * * Experimenting with neumorphism in typography. * Use cursor to move around the shiny effect. * On mobile touch + drag screen. * * #034 - #100DaysOfCode * By ilithya | 2020 * https://www.ilithya.rocks/ * https://twitter.com/ilithya_net */ 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("#canvas-wrapper").appendChild(renderer.domElement); const light = new THREE.DirectionalLight(0xffdffd, 1); light.position.set(-15, 0, 70); scene.add(light); // CREATE TYPOGRAPHY const group = new THREE.Group(); const typoLoader = new THREE.FontLoader(); const createTypo = font => { const word = `bfw wiki itstudy`; const typoSize = 120; const typoHeight = Math.round(typoSize / 4); const typoProperties = { font: font, size: typo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0