Login / Join
3D Rotating Cube (three.js)
submitted on 31/07/2014 by
Codicode
+ infos
Config
Embed
Share
3D Rotating Cube (three.js)
by
Codicode
3d rotating cube using javascript & the three.js framework
Framework 1 :
-- None --
jQuery 2.0.3
jQuery 1.9.1
jQuery 1.9.0
jQuery 1.8.0
jQuery 1.7.1
jQuery 1.6.3
jQuery UI 1.10.3
MooTools 1.4.5
AngularJS 1.0.4
Prototype 1.7.1.0
Dojo 1.8.3
Chrome Frame 1.0.3
Ext Core 3.1.0
SWFObject 2.2
WebFont Loader 1.1.2
Framework 2 :
-- None --
jQuery 2.0.3
jQuery 1.9.1
jQuery 1.9.0
jQuery 1.8.0
jQuery 1.7.1
jQuery 1.6.3
jQuery UI 1.10.3
MooTools 1.4.5
AngularJS 1.0.4
Prototype 1.7.1.0
Dojo 1.8.3
Chrome Frame 1.0.3
Ext Core 3.1.0
SWFObject 2.2
WebFont Loader 1.1.2
+ Js file(s) :
//cdnjs.cloudflare.com/ajax/libs/three.js/r57/three.min.js
+ Css file(s) :
Apply
Link :
Direct http link :
Fork button :
Html code :
Embed preview :
Copy the following html code to your page to embed the preview,
To include many previews on a single page, just repeat the first line.
You can change the width, height and border color (bcolor).
<div class="refork-widget" code="bac" style="width:100%;height:200px;" bcolor="#ccc"></div>
<script type="text/javascript" src="//snippet.run/d/z.js"></script>
HTML
CSS
body { background-color: #ffffff; }
Javascript
var camera, scene, renderer; var geometry, material, mesh; var init = function () { renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement ); camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 1000); camera.position.z = 600; geometry = new THREE.CubeGeometry( 250, 250, 250 ); material = new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, wireframeLinewidth: 5 } ); mesh = new THREE.Mesh( geometry, material ); scene = new THREE.Scene(); scene.add( mesh ); } var animation = function () { requestAnimationFrame( animation ); mesh.rotation.x = Date.now() * 0.0006; mesh.rotation.y = Date.now() * 0.0008; renderer.render( scene, camera ); } init(); animation();
©2013 Copyright snippet.run
Privacy
-
Terms of use
-
About
-
Contact