korede shikaku ga mawaru

var args = { w : window.innerWidth, h : window.innerHeight, cam : null, lt : null, scn : null, cube : null, renderer : null } function set_renderer(){ args.renderer = new THREE.WebGLRenderer(); args.renderer.setSize( args.w, args.h ); args.renderer.setClearColor( 0x333333 ); document.getElementById("cv").appendChild( args.renderer.domElement ); } function camera(){ args.cam = new THREE.PerspectiveCamera( 30,args.w/args.h); args.cam.position.x = 100; args.cam.position.y = 100; args.cam.position.z = 100; args.cam.lookAt({x:0, y:0, z:0}); } function scene() { args.scn = new THREE.Scene(); } function light() { args.lt = new THREE.DirectionalLight(); args.lt.position.set( 300,200,100 ); args.scn.add( args.lt ); } function set_obj() { args.cube = new THREE.Mesh( new THREE.CubeGeometry(30, 30, 30), new THREE.MeshLambertMaterial({color:0x66FF66}) ); args.scn.add(args.cube); args.cube.position.set(0,0,0); } window.onload = function(){ set_renderer(); camera(); scene(); light(); set_obj(); args.renderer.render( args.scn, args.cam ); setInterval(function(){ args.cube.rotation.x += 適当な数字; args.cube.rotation.y += 適当な数字; args.renderer.render( args.scn, args.cam ); }, 30); } すごい立体が廻る

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.