cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <script src="http://bacae.com/js/three.min.js"></script>
<script src="http://bacae.com/js/three.controls.orbit.js"></script>
            
          
!
            
              body {
  
  background-color: #fafafa;
  margin: 0;
  padding: 0;
  
}

            
          
!
            
              /*
 * Waves - Cláudio Marinho (claudio@bacae.com)
 */

'use strict'


var camera, scene, renderer, controls;
var geometry, material, mesh, light;

var angles = Array();
var speed = 0.05;
var range = 200;

function init() {

	
	// Camera
	camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
	camera.position.x = 0;
	camera.position.y = 0;
	camera.position.z = 1500;
		
		
	// Controls
	controls = new THREE.OrbitControls( camera );
	controls.noPan = true;
	controls.noZoom = true;
	//controls.noKeys = true;
	//controls.noRotate = true;
	
	// Scene
	scene = new THREE.Scene();
	
	
	// Geometry
	geometry = new THREE.PlaneGeometry(1000, 1000, 4, 4);
		
	
	// Material
	material = new THREE.MeshBasicMaterial( { color:0x0000ff, wireframe:true, wireframeLinewidth:0.5 } ); 
	
	
	// Mesh
	mesh = new THREE.Mesh( geometry, material );
	mesh.rotation.x = -0.5;	
	scene.add( mesh );
	
	
	// Angles 
	for(var i in geometry.vertices)
	{
		angles.push( i * 0.2 );
	}
	

	// renderer
  renderer = new THREE.CanvasRenderer( { antialias: false } );
  renderer.setClearColor( 0xfafafa, 1 );
	renderer.setSize( window.innerWidth, window.innerHeight );
	
	
	// Canvas
	document.body.appendChild( renderer.domElement );

	
	// Listener
	window.addEventListener( 'resize', onWindowResize, false );
	

}


function animate() {

   
	requestAnimationFrame( animate );
	
	for(var i in geometry.vertices)
	{
	
		mesh.geometry.vertices[i].z = 0 + Math.sin(angles[i])*range; 
		angles[i] += speed;
		
	}
		
	controls.update();		
	renderer.render( scene, camera );

}



function onWindowResize() {

	camera.aspect = window.innerWidth / window.innerHeight;
	camera.updateProjectionMatrix();
	renderer.setSize( window.innerWidth, window.innerHeight );
}


window.onload = function()
{
	
	init();
	animate();

};


            
          
!
999px
Loading ..................

Console