yskang

threejs-workflow

Apr 15th, 2020
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 舞台佈置
  2. const scene = new THREE.Scene();
  3.  
  4. // 演員完妝上台
  5. const geometry = new THREESphereGeometry ( 5, 32, 32 );
  6. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  7. const sphere = new THREE.Mesh( geometry, material );
  8. scene.add( sphere );
  9.  
  10. // 設定攝影機
  11. const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 50 );
  12. camera.position.z = 30;
  13.  
  14. // 舞台打光
  15. const light = new THREE.PointLight( 0xffffff, 1, 0 );
  16. light.position.set( 100, 200, 100 );
  17. scene.add( light );
  18.  
  19. // Action 開拍
  20. const renderer = new THREE.WebGLRenderer( { antialias: true } );
  21. renderer.setSize( window.innerWidth, window.innerHeight );
  22. renderer.setClearColor( 0x000000, 1 );
  23. document.body.appendChild( renderer.domElement );
  24.  
  25. renderer.render( scene, camera );
Advertisement
Add Comment
Please, Sign In to add comment