-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyyooy.js
29 lines (26 loc) · 1.01 KB
/
yyooy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var scene = new THREE.Scene();
scene.background=new THREE.Color("black");
var camera= new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,1,2300);
camera.position.set(0,0,0)
var renderer = new THREE.WebGLRenderer({antialias:true,alpha:true});
renderer.setSize(window.innerWidth,window.innerHeight);
var controls = new OrbitControls(camera,renderer.domElement);
var tex= new THREE.TextureLoader().load("backg.jpg");
var geo= new THREE.SphereGeometry(1000,128,128);
var mat= new THREE.MeshPhongMaterial({map:tex});
mat.side=THREE.BackSide;
controls.minDistance=1;
var obj = new THREE.Mesh(geo,mat);
var light = new THREE.PointLight(0xffffff,1,1000,0);
light.position.set(0,0,0);
scene.add(light);
scene.add(obj);
document.body.appendChild(renderer.domElement);
renderer.render(scene,camera);
window.onresize=()=>{
renderer.setSize(window.innerWidth,window.innerHeight);
renderer.render(scene,camera);
};
renderer.setAnimationLoop(()=>{
renderer.render(scene,camera);
});