SELF DIRECTED RESEARCH2: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 267: Line 267:
⌨⌨⌨
⌨⌨⌨
http://webgg5.tumblr.com/
http://webgg5.tumblr.com/
<br>
[[File:Χωρssίςs τίτλο.png]]
[[File:Χωρssίςs τίτλο.png]]



Revision as of 20:18, 13 January 2014

⌨ 3D BROWSER✌ Threejs Webgl experiments 2


http://dgagegaegaegaeeagg.tumblr.com/
Χωρ2ίς τίτλο.png


 
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style>
            body { 
                background-color: #ffffff;
                margin: 0;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        
        <script src="http://brangerbriz.net/labs/threejs_playGnd/js/three.min.js"></script>
        <script src="http://brangerbriz.net/labs/threejs_playGnd/js/Detector.js"></script>
        <script>

            if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
            
            var camera, scene1, scene2, scene3, scene4, renderer;
            var geometry, material, cube, cylinder, icosahedron;

            function setup() {

                var W = window.innerWidth/2, H = window.innerHeight;
                renderer1 = new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
				renderer1.autoClearColor = false;
                renderer1.setSize( W, H );
                document.body.appendChild( renderer1.domElement );

                renderer2 = new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
				renderer2.autoClearColor = false;
                renderer2.setSize( W, H );
                document.body.appendChild( renderer2.domElement );

                
                renderer3= new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
				renderer3.autoClearColor = false;
                renderer3.setSize( W, H );
                document.body.appendChild( renderer3.domElement );
                
                renderer4= new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
				renderer4.autoClearColor = false;
                renderer4.setSize( W, H );
                document.body.appendChild( renderer4.domElement );
                
                camera = new THREE.PerspectiveCamera( 510, W/H, 1, 10000 );
                camera.position.z = 300;

                scene1 = new THREE.Scene();
                scene2 = new THREE.Scene();
                scene3 = new THREE.Scene();
                scene4 = new THREE.Scene();

                                 bg = document.body.style;
bg.background = '#000000';

               geometry = new THREE.CubeGeometry( 95, 95, 55 );
for ( var i = 0; i < 100; i ++ ) {
    material = new THREE.MeshNormalMaterial( { color: Math.random()*0xffffff } );
    cube = new THREE.Mesh( geometry, material);
    cube.position.x = Math.random() * 1000 - 500;
    cube.position.y = Math.random() * 1000 - 500;
    cube.position.z = Math.random() * 1000 - 500;
    cube.rotation.x = Math.random() * 2 * Math.PI;
    cube.rotation.y = Math.random() * 2 * Math.PI;
    cube.rotation.z = Math.random() * 2 * Math.PI;
    scene1.add(cube);
    }

                           geometry = new THREE.CubeGeometry(100, 100, 200);
for ( var i = 5; i < 200; i ++ ) {
    material = new THREE.MeshNormalMaterial( { color: Math.random()*0xffffff } );
    cube = new THREE.Mesh( geometry, material);
    cube.position.x = Math.random() * 1000 - 1500;
    cube.position.y = Math.random() * 1000 - 1500;
    cube.position.z = Math.random() * 1000 - 1500;
    cube.rotation.x = Math.random() * 2 * Math.PI;
    cube.rotation.y = Math.random() * 2 * Math.PI;
    cube.rotation.z = Math.random() * 2 * Math.PI;
    scene2.add(cube);
    }
                
            geometry = new THREE.CylinderGeometry(100, 100, 200, 50, 50, false );
for ( var i = 0; i < 300; i ++ ) {
    material = new THREE.MeshNormalMaterial( { color: Math.random()*0xffffff } );
    cylinder = new THREE.Mesh( geometry, material);
    cylinder.position.x = Math.random() * 1000 - 500;
    cylinder.position.y = Math.random() * 1000 - 500;
    cylinder.position.z = Math.random() * 1000 - 500;
    cylinder.rotation.x = Math.random() * 2 * Math.PI;
    cylinder.rotation.y = Math.random() * 2 * Math.PI;
    cylinder.rotation.z = Math.random() * 2 * Math.PI;
    scene3.add(cylinder);
    }
                
                                          geometry = new THREE.IcosahedronGeometry( 110, 0 );
for ( var i = 0; i < 1300; i ++ ) {
    material = new THREE.MeshNormalMaterial( { color: Math.random()*0xffffff } );
    icosahedron = new THREE.Mesh( geometry, material);
    icosahedron .position.x = Math.random() * 1000 - 500;
    icosahedron .position.y = Math.random() * 1000 - 500;
    icosahedron .position.z = Math.random() * 1000 - 500;
    icosahedron .rotation.x = Math.random() * 2 * Math.PI;
    icosahedron .rotation.y = Math.random() * 2 * Math.PI;
    icosahedron .rotation.z = Math.random() * 2 * Math.PI;
    scene4.add(icosahedron );
    }

     }
           

            function draw() {

                requestAnimationFrame( draw );
                
                cube.rotation.x = Date.now() * 0.0005;    
                cube.rotation.y = Date.now() * 0.0002;    
                cube.rotation.z = Date.now() * 0.001;
                cube.position.y = Math.sin( Date.now() * 0.002 ) * 3300;

               
                
                camera.position.z = Math.sin( Date.now() * 0.00112 ) * 5600;
				camera.position.y = Math.sin( Date.now() * 0.00012 ) * 5600;
				camera.lookAt(cube.position);
 
                cylinder.rotation.x = Date.now() * 0.0005;  
                cylinder.rotation.y = Date.now() * 0.0002;  
                cylinder.rotation.z = Date.now() * 0.001;
                
                
                icosahedron.rotation.x = Date.now() * 0.00205;  
                icosahedron.rotation.y = Date.now() * 0.01002;  
                icosahedron.rotation.z = Date.now() * 0.001;

                renderer1.render( scene1, camera );
                renderer2.render( scene2, camera );
                renderer3.render( scene3, camera );
                renderer4.render( scene4, camera );
            }

            setup();
            draw();

        </script>
        
    </body>
</html>


⌨⌨ http://thereisamajorprobleminafstralia.tumblr.com/ Χωρί2ς τίτλο.png

 
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style>
            body {
                background-color: #ffffff;
                margin: 0;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        
        <script src="http://brangerbriz.net/labs/threejs_playGnd/js/three.min.js"></script>
        <script src="http://brangerbriz.net/labs/threejs_playGnd/js/Detector.js"></script>
        <script>

            if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
            
            var camera, scene1, renderer;
            var geometry, material, sphere;

            function setup() {

                var W = window.innerWidth/1, H = window.innerHeight;
                renderer1 = new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
				renderer1.autoClearColor = false;
                renderer1.setSize( W, H );
                document.body.appendChild( renderer1.domElement );

                renderer2 = new THREE.WebGLRenderer( { preserveDrawingBuffer: true } );
				renderer2.autoClearColor = false;
                
                camera = new THREE.PerspectiveCamera( 1196, W/H, 1, 10000 );
                camera.position.z = 120;

                scene1 = new THREE.Scene();
            

                                 bg = document.body.style;
bg.background = '#000000';

              
     geometry = new THREE.SphereGeometry(150, 100, 51.73);
for ( var i = 0; i < 1310; i ++ ) {
    material = new THREE.MeshNormalMaterial( { color: Math.random()*0xffffff } );
    sphere = new THREE.Mesh( geometry, material);
    sphere.position.x = Math.random() * 100000 - 5000;
    sphere.position.y = Math.random() * 10000 - 5000;
    sphere.position.z = Math.random() * 10000 - 5000;
    sphere.rotation.x = Math.random() * 15 * Math.PI;
    sphere.rotation.y = Math.random() * 15 * Math.PI;
   sphere.rotation.z = Math.random() * 15 * Math.PI;
    scene1.add(sphere);
    }

     }
           

            function draw() {

                requestAnimationFrame( draw );
                
             
                       
               sphere.rotation.x = Date.now() * 0.000105;  
                sphere.rotation.y = Date.now() * 0.00002;  
                sphere.rotation.z = Date.now() * 0.00011;
                sphere.position.y = Math.sin( Date.now() * 0.002 ) * 3100;


               
                
                camera.position.z = Math.sin( Date.now() * 0.00112 ) * 1600;
				camera.position.y = Math.sin( Date.now() * 0.001012 ) * 5600;
				camera.lookAt(sphere.position);
 
             
             
                renderer1.render( scene1, camera );
               
            }

            setup();
            draw();

        </script>
        
    </body>
</html>

⌨⌨⌨ http://webgg5.tumblr.com/

Χωρssίςs τίτλο.png


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style>
            body {
                background-color: #ffffff;
                margin: 0;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        
        <script src="http://brangerbriz.net/labs/threejs_playGnd/js/three.min.js"></script>
        <script src="http://brangerbriz.net/labs/threejs_playGnd/js/Detector.js"></script>
        <script>

            if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
            
            var camera, scene1, renderer;
            var geometry, material, torusKnot;

            function setup() {

                var W = window.innerWidth/1, H = window.innerHeight;
                renderer1 = new THREE.WebGLRenderer();
                renderer1.setSize( W, H );
                document.body.appendChild( renderer1.domElement );

               
                camera = new THREE.PerspectiveCamera( 2186, W/H, 1, 10000 );
                camera.position.z = 33;

                scene1 = new THREE.Scene();

 

              
 geometry = new THREE.TorusKnotGeometry(113, 4, 614, 81, 2, 3, 15.39);
for ( var i = 0; i < 15; i ++ ) {
     material = new THREE.MeshNormalMaterial({shading: THREE.FlatShading});
     torusKnot = new THREE.Mesh( geometry, material);
     torusKnot.position.x = Math.random() * 1111 - 500;
     torusKnot.position.y = Math.random() * 1111 - 500;
     torusKnot.position.z = Math.random() * 1111 - 500;
     torusKnot.rotation.x = Math.random() * 212 * Math.PI;
     torusKnot.rotation.y = Math.random() * 212 * Math.PI;
     torusKnot.rotation.z = Math.random() * 212 * Math.PI;
     scene1.add( torusKnot);
    }
                
     }
           

            function draw() {

                requestAnimationFrame( draw );
                
                torusKnot.rotation.x = Date.now() * 0.00105;	
				torusKnot.rotation.y = Date.now() * 0.00102;	
				torusKnot.rotation.z = Date.now() * 0.0101;
                 				
                torusKnot.position.y = Math.sin( Date.now() * 0.002 ) * 1300;
          
                camera.position.z = Math.sin( Date.now() * 0.0001 ) * 1510;
				camera.position.y = Math.sin( Date.now() * 0.0010 ) * 5500;
				camera.lookAt( torusKnot.position);
 
             
             
                renderer1.render( scene1, camera );

            }

            setup();
            draw();

        </script>
        
    </body>
</html>