Skip to content

Instantly share code, notes, and snippets.

@molotovbliss
Created August 14, 2018 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save molotovbliss/27b765695e186af2238632348e6910db to your computer and use it in GitHub Desktop.
Save molotovbliss/27b765695e186af2238632348e6910db to your computer and use it in GitHub Desktop.
Oneliner HTML/JS/CSS + 3.JS Mr Doob!
data:text/html,<body oninput="i.srcdoc=h.value+'<style>'+c.value+'</style><script>'+j.value+'</script>'"><style>textarea,iframe{width:100%;height:50%;margin:0;}body{margin:0}textarea{width:33.33%;font-size:18}</style><textarea placeholder=HTML id=h><script src=https://cdn.rawgit.com/mrdoob/three.js/master/build/three.min.js></script><body></textarea><textarea placeholder=CSS id=c></textarea><textarea placeholder=JS id=j>var camera,scene,renderer;var geometry,material,mesh;init();animate();function init(){camera=new THREE.PerspectiveCamera(70,window.innerWidth/window.innerHeight,0.01,10);camera.position.z=1;scene=new THREE.Scene();geometry=new THREE.BoxGeometry(0.2,0.2,0.2);material=new THREE.MeshNormalMaterial();mesh=new THREE.Mesh(geometry,material);scene.add(mesh);renderer=new THREE.WebGLRenderer({antialias:true});renderer.setSize(window.innerWidth,window.innerHeight);document.body.appendChild(renderer.domElement)}function animate(){requestAnimationFrame(animate);mesh.rotation.x+=0.01;mesh.rotation.y+=0.02;renderer.render(scene,camera)}</textarea><iframe id=i>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment