three加载三维游戏人物模型动画效果代码
代码语言:html
所属分类:三维
代码描述:three加载三维游戏人物模型动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { margin: 0px; overflow: hidden; } </style> </head> <body > <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.115.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/inflate.min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/FBXLoader.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.min.js"></script> <script type="module"> var container, controls; var camera, scene, renderer, light; var clock = new THREE.Clock(); var xMixer, yMixer, zMixer; init(); animate(); function init() { container = document.createElement("div"); document.body.appendChild(container); camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000); camera.position.set(100, 200, 300); scene = new THREE.Scene(); scene.background = new THREE.TextureLoader().load( "//repo.bfw.wiki/bfwrepo/image/5fa47c96a51e2.png"); scene.fog = new THREE.Fog(0xa0a0a0, 200, 1000); light = new THREE.HemisphereLight(0xffffff, 0x444444); light.position.set(0, 200, 0); scene.add(light); light = new THREE.DirectionalLight(0xffffff); light.position.set(0, 200, 100); light.castShadow = true; light.shadow.camera.top = 180; light.shadow.camera.bottom = -100; light.shadow.camera.left = -120; light.shadow.camera.right = 120; scene.add(light); // ground var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry(2000, 2000), new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false })); mesh.rotation.x = -Math.PI / 2; mesh.receiveShadow = true; scene.add(mesh); var grid = new THREE.GridHelper(2000, 20, 0x00000.........完整代码请登录后点击上方下载按钮下载查看
网友评论0