-
Notifications
You must be signed in to change notification settings - Fork 12
/
devicepixelratio.html
34 lines (27 loc) · 1.02 KB
/
devicepixelratio.html
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
30
31
32
33
34
<!DOCTYPE html>
<script src="vendor/three.js/build/three.min.js"></script>
<script src="../threex.windowresize.js"></script>
<body style='margin: 0px; background-color: #bbbbbb;overflow: hidden;'><script>
var renderer = new THREE.WebGLRenderer()
renderer.setSize( window.innerWidth, window.innerHeight )
document.body.appendChild( renderer.domElement )
var scene = new THREE.Scene()
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000)
camera.position.z = 3
var winResize = new THREEx.WindowResize(renderer, camera)
var geometry = new THREE.CubeGeometry( 1, 1, 1);
var material = new THREE.MeshNormalMaterial();
var mesh = new THREE.Mesh( geometry, material );
scene.add( mesh )
// change the devicePixelRatio after one second
setTimeout(function(){
renderer.devicePixelRatio = 1/16
winResize.trigger()
}, 1000)
;(function animate(){
requestAnimationFrame( animate )
mesh.rotation.x += 0.005
mesh.rotation.y += 0.01
renderer.render( scene, camera )
})()
</script></body>