Line 31: | Line 31: | ||
<script> | <script> | ||
window.onload = function() { | window.onload = function() { | ||
− | |||
− | |||
− | |||
− | |||
let lightIntensity = 1.4; | let lightIntensity = 1.4; | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
let windowHalfX = window.innerWidth/2; | let windowHalfX = window.innerWidth/2; | ||
let windowHalfY = window.innerHeight/2; | let windowHalfY = window.innerHeight/2; | ||
Line 56: | Line 39: | ||
let SPEED = 0.01; | let SPEED = 0.01; | ||
− | let | + | let cube = null; |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
init(); | init(); | ||
Line 69: | Line 48: | ||
container = document.createElement('div'); | container = document.createElement('div'); | ||
document.body.appendChild(container); | document.body.appendChild(container); | ||
− | |||
scene = new THREE.Scene(); | scene = new THREE.Scene(); | ||
Line 78: | Line 56: | ||
// initMesh | // initMesh | ||
− | + | let size = 3; | |
− | + | let geometry = new THREE.BoxGeometry( size, size, size ); | |
− | + | for ( var i = 0; i < geometry.faces.length; i ++ ) { | |
− | + | geometry.faces[i].color.setHex(Math.random() * 0xffffff); | |
− | + | } | |
− | + | let material = new THREE.MeshBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } ); | |
− | + | cube = new THREE.Mesh( geometry, material ); | |
− | + | cube.translation = THREE.GeometryUtils.center(geometry); | |
− | + | ||
− | + | ||
− | + | ||
scene.add( cube ); | scene.add( cube ); | ||
Line 112: | Line 87: | ||
camera.updateProjectionMatrix(); | camera.updateProjectionMatrix(); | ||
renderer.setSize(window.innerWidth, window.innerHeight); | renderer.setSize(window.innerWidth, window.innerHeight); | ||
+ | } | ||
+ | |||
+ | function rotateMesh() { | ||
+ | if (!cube) { | ||
+ | return; | ||
+ | } | ||
+ | cube.rotation.x -= SPEED*2; | ||
+ | cube.rotation.y -= SPEED; | ||
+ | cube.rotation.z -= SPEED*3; | ||
} | } | ||
function render() { | function render() { | ||
renderer.render(scene,camera); | renderer.render(scene,camera); | ||
+ | rotateMesh(); | ||
} | } | ||
Revision as of 19:44, 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