Skip to content

Instantly share code, notes, and snippets.

@phocks
Last active October 3, 2017 23:08
Show Gist options
  • Select an option

  • Save phocks/1dd978046a11501d22b7547fb5a9a976 to your computer and use it in GitHub Desktop.

Select an option

Save phocks/1dd978046a11501d22b7547fb5a9a976 to your computer and use it in GitHub Desktop.
An orb in three.js
license: gpl-3.0
height: 500
scrolling: no
border: yes
<meta charset="utf-8">
<style>
body {
margin: 0;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1">
<div></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/87/three.js" integrity="sha256-h6ztqmWE0+yhdluR+LyJngYcl3hV/j1vh9a/M2pi4jA="
crossorigin="anonymous"></script>
<script src="index.js"></script>
var camera, scene, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
1,
10000
);
camera.position.z = 1000;
geometry = new THREE.SphereGeometry(500, 32, 32); //THREE.BoxGeometry(200, 200, 200);
material = new THREE.MeshNormalMaterial({ wireframe: true });
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
// console.log( renderer.domElement)
document.body.appendChild(renderer.domElement);
}
function animate() {
requestAnimationFrame(animate);
mesh.rotation.x += 0.0;
mesh.rotation.y += 0.01;
renderer.render(scene, camera);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment