Line 30: | Line 30: | ||
<!-- BODY END --> | <!-- BODY END --> | ||
<script> | <script> | ||
− | + | window.onload = function() { | |
+ | let loadTime = window.performance.timing.domContentLoadedEventEnd-window.performance.timing.navigationStart; | ||
+ | console.log('Page load time is '+ loadTime); | ||
+ | |||
+ | let container, scene, camera, renderer, light, controls; | ||
+ | let lightIntensity = 1.4; | ||
+ | |||
+ | let targetRotationX = 0; | ||
+ | let targetRotationOnMouseDownX = 0; | ||
+ | |||
+ | let targetRotationY = 0; | ||
+ | let targetRotationOnMouseDownY = 0; | ||
+ | |||
+ | let mouseX = 0; | ||
+ | let mouseXOnMouseDown = 0; | ||
+ | |||
+ | let mouseY = 0; | ||
+ | let mouseYOnMouseDown = 0; | ||
+ | |||
+ | let windowHalfX = window.innerWidth/2; | ||
+ | let windowHalfY = window.innerHeight/2; | ||
+ | |||
+ | let WIDTH = window.innerWidth; | ||
+ | let HEIGHT = window.innerHeight; | ||
+ | let SPEED = 0.01; | ||
+ | |||
+ | let raycaster = new THREE.Raycaster(); | ||
+ | let mouse = new THREE.Vector2(), INTERSECTED, CLICKINTERSECTED; | ||
+ | let intersects; | ||
+ | let currentMeshName; | ||
+ | |||
+ | |||
+ | init(); | ||
+ | animate(); | ||
+ | |||
+ | function init() { | ||
+ | |||
+ | container = document.createElement('div'); | ||
+ | document.body.appendChild(container); | ||
+ | |||
+ | scene = new THREE.Scene(); | ||
+ | |||
+ | // initCamera | ||
+ | camera = new THREE.PerspectiveCamera(70, WIDTH / HEIGHT, 1, 500); | ||
+ | camera.position.set(0, 3.5, 10); | ||
+ | camera.lookAt(scene.position); | ||
+ | |||
+ | // initMesh | ||
+ | // let mesh = null; | ||
+ | // let loader = new THREE.JSONLoader(); | ||
+ | // let name = './marmelab.json'; | ||
+ | // loader.load(name, function(geometry, materials) { | ||
+ | // mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials)); | ||
+ | // mesh.rotation.y= -10; | ||
+ | // scene.add(mesh); | ||
+ | // }); | ||
+ | var geometry = new THREE.BoxGeometry( 1, 1, 1 ); | ||
+ | var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); | ||
+ | var cube = new THREE.Mesh( geometry, material ); | ||
+ | scene.add( cube ); | ||
+ | |||
+ | // initLight | ||
+ | light = new THREE.PointLight(0xffffff, lightIntensity); | ||
+ | light.position.set(50,50,50); | ||
+ | scene.add(light); | ||
+ | console.log(scene.children); | ||
+ | |||
+ | // initRenderer | ||
+ | renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); | ||
+ | renderer.setPixelRatio(window.devicePixelRatio); | ||
+ | renderer.setSize(WIDTH, HEIGHT); | ||
+ | renderer.sortObjects = false; | ||
+ | |||
+ | container.appendChild(renderer.domElement); | ||
+ | } | ||
+ | |||
+ | function onResize() { | ||
+ | windowHalfX = window.innerWidth/2; | ||
+ | windowHalfY = window.innerHeight/2; | ||
+ | camera.aspect = window.innerWidth/window.innerHeight; | ||
+ | camera.updateProjectionMatrix(); | ||
+ | renderer.setSize(window.innerWidth, window.innerHeight); | ||
+ | } | ||
+ | |||
+ | function render() { | ||
+ | renderer.render(scene,camera); | ||
+ | } | ||
+ | |||
+ | function animate() { | ||
+ | requestAnimationFrame(animate); | ||
+ | render(); | ||
+ | } | ||
+ | |||
+ | window.addEventListener('resize',onResize,false); | ||
+ | } | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 19:26, 17 May 2018
RESEARCH JOURNAL
This is where you write things.
5/16/18; Super Cool Protein Purification
Today we purified this super cool protein.
Test Hello