Explorar o código

Merge pull request #14986 from looeee/examples_fix_linter_errors

Fix linter errors in canvas examples
Mr.doob %!s(int64=6) %!d(string=hai) anos
pai
achega
d0edf71c9d

+ 3 - 3
examples/canvas_camera_orthographic.html

@@ -112,9 +112,9 @@
 
 				var aspect = window.innerWidth / window.innerHeight;
 
-				camera.left   = - frustumSize * aspect / 2;
-				camera.right  =   frustumSize * aspect / 2;
-				camera.top    =   frustumSize / 2;
+				camera.left = - frustumSize * aspect / 2;
+				camera.right = frustumSize * aspect / 2;
+				camera.top = frustumSize / 2;
 				camera.bottom = - frustumSize / 2;
 
 				camera.updateProjectionMatrix();

+ 29 - 30
examples/canvas_geometry_birds.html

@@ -43,15 +43,15 @@
 
 				THREE.Geometry.call( this );
 
-				v(   5,   0,   0 );
-				v( - 5, - 2,   1 );
-				v( - 5,   0,   0 );
+				v( 5, 0, 0 );
+				v( - 5, - 2, 1 );
+				v( - 5, 0, 0 );
 				v( - 5, - 2, - 1 );
 
-				v(   0,   2, - 6 );
-				v(   0,   2,   6 );
-				v(   2,   0,   0 );
-				v( - 3,   0,   0 );
+				v( 0, 2, - 6 );
+				v( 0, 2, 6 );
+				v( 2, 0, 0 );
+				v( - 3, 0, 0 );
 
 				f3( 0, 2, 1 );
 
@@ -72,7 +72,7 @@
 
 				}
 
-			}
+			};
 
 			Bird.prototype = Object.create( THREE.Geometry.prototype );
 			Bird.prototype.constructor = Bird;
@@ -82,8 +82,8 @@
 			var Boid = function () {
 
 				var vector = new THREE.Vector3(),
-				_acceleration, _width = 500, _height = 500, _depth = 200, _goal, _neighborhoodRadius = 100,
-				_maxSpeed = 4, _maxSteerForce = 0.1, _avoidWalls = false;
+					_acceleration, _width = 500, _height = 500, _depth = 200, _goal, _neighborhoodRadius = 100,
+					_maxSpeed = 4, _maxSteerForce = 0.1, _avoidWalls = false;
 
 				this.position = new THREE.Vector3();
 				this.velocity = new THREE.Vector3();
@@ -193,12 +193,12 @@
 
 				this.checkBounds = function () {
 
-					if ( this.position.x >   _width ) this.position.x = - _width;
-					if ( this.position.x < - _width ) this.position.x =   _width;
-					if ( this.position.y >   _height ) this.position.y = - _height;
-					if ( this.position.y < - _height ) this.position.y =  _height;
-					if ( this.position.z >  _depth ) this.position.z = - _depth;
-					if ( this.position.z < - _depth ) this.position.z =  _depth;
+					if ( this.position.x > _width ) this.position.x = - _width;
+					if ( this.position.x < - _width ) this.position.x = _width;
+					if ( this.position.y > _height ) this.position.y = - _height;
+					if ( this.position.y < - _height ) this.position.y = _height;
+					if ( this.position.z > _depth ) this.position.z = - _depth;
+					if ( this.position.z < - _depth ) this.position.z = _depth;
 
 				};
 
@@ -250,7 +250,7 @@
 					var count = 0;
 					var velSum = new THREE.Vector3();
 
-					for ( var i = 0, il = boids.length; i < il; i++ ) {
+					for ( var i = 0, il = boids.length; i < il; i ++ ) {
 
 						if ( Math.random() > 0.6 ) continue;
 
@@ -260,7 +260,7 @@
 						if ( distance > 0 && distance <= _neighborhoodRadius ) {
 
 							velSum.add( boid.velocity );
-							count++;
+							count ++;
 
 						}
 
@@ -300,7 +300,7 @@
 						if ( distance > 0 && distance <= _neighborhoodRadius ) {
 
 							posSum.add( boid.position );
-							count++;
+							count ++;
 
 						}
 
@@ -353,15 +353,14 @@
 
 				};
 
-			}
+			};
 
 			var SCREEN_WIDTH = window.innerWidth,
-			SCREEN_HEIGHT = window.innerHeight,
-			SCREEN_WIDTH_HALF = SCREEN_WIDTH  / 2,
-			SCREEN_HEIGHT_HALF = SCREEN_HEIGHT / 2;
+				SCREEN_HEIGHT = window.innerHeight,
+				SCREEN_WIDTH_HALF = SCREEN_WIDTH / 2,
+				SCREEN_HEIGHT_HALF = SCREEN_HEIGHT / 2;
 
-			var camera, scene, renderer,
-			birds, bird;
+			var camera, scene, renderer, birds, bird;
 
 			var boid, boids;
 
@@ -393,7 +392,7 @@
 					boid.setAvoidWalls( true );
 					boid.setWorldSize( 500, 500, 400 );
 
-					bird = birds[ i ] = new THREE.Mesh( new Bird(), new THREE.MeshBasicMaterial( { color:Math.random() * 0xffffff, side: THREE.DoubleSide } ) );
+					bird = birds[ i ] = new THREE.Mesh( new Bird(), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, side: THREE.DoubleSide } ) );
 					bird.phase = Math.floor( Math.random() * 62.83 );
 					scene.add( bird );
 
@@ -408,7 +407,7 @@
 				document.body.appendChild( renderer.domElement );
 
 				stats = new Stats();
-				document.getElementById( 'container' ).appendChild(stats.dom);
+				document.getElementById( 'container' ).appendChild( stats.dom );
 
 				//
 
@@ -429,7 +428,7 @@
 
 				var vector = new THREE.Vector3( event.clientX - SCREEN_WIDTH_HALF, - event.clientY + SCREEN_HEIGHT_HALF, 0 );
 
-				for ( var i = 0, il = boids.length; i < il; i++ ) {
+				for ( var i = 0, il = boids.length; i < il; i ++ ) {
 
 					boid = boids[ i ];
 
@@ -455,7 +454,7 @@
 
 			function render() {
 
-				for ( var i = 0, il = birds.length; i < il; i++ ) {
+				for ( var i = 0, il = birds.length; i < il; i ++ ) {
 
 					boid = boids[ i ];
 					boid.run( boids );
@@ -469,7 +468,7 @@
 					bird.rotation.y = Math.atan2( - boid.velocity.z, boid.velocity.x );
 					bird.rotation.z = Math.asin( boid.velocity.y / boid.velocity.length() );
 
-					bird.phase = ( bird.phase + ( Math.max( 0, bird.rotation.z ) + 0.1 )  ) % 62.83;
+					bird.phase = ( bird.phase + ( Math.max( 0, bird.rotation.z ) + 0.1 ) ) % 62.83;
 					bird.geometry.vertices[ 5 ].y = bird.geometry.vertices[ 4 ].y = Math.sin( bird.phase ) * 5;
 
 				}

+ 2 - 4
examples/canvas_geometry_cube.html

@@ -37,7 +37,6 @@
 			var mouseXOnMouseDown = 0;
 
 			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
 
 			init();
 			animate();
@@ -112,7 +111,6 @@
 			function onWindowResize() {
 
 				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
@@ -144,7 +142,7 @@
 
 			}
 
-			function onDocumentMouseUp( event ) {
+			function onDocumentMouseUp() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
@@ -152,7 +150,7 @@
 
 			}
 
-			function onDocumentMouseOut( event ) {
+			function onDocumentMouseOut() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );

+ 2 - 4
examples/canvas_geometry_hierarchy.html

@@ -27,9 +27,7 @@
 
 			var container, stats;
 
-			var camera, scene, renderer;
-
-			var geometry, group;
+			var camera, scene, renderer, group;
 
 			var mouseX = 0, mouseY = 0;
 
@@ -99,7 +97,7 @@
 
 			}
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 				mouseX = ( event.clientX - windowHalfX ) * 10;
 				mouseY = ( event.clientY - windowHalfY ) * 10;

+ 2 - 4
examples/canvas_geometry_nurbs.html

@@ -49,7 +49,6 @@
 			var mouseXOnMouseDown = 0;
 
 			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
 
 			init();
 			animate();
@@ -149,7 +148,6 @@
 			function onWindowResize() {
 
 				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
@@ -181,7 +179,7 @@
 
 			}
 
-			function onDocumentMouseUp( event ) {
+			function onDocumentMouseUp() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
@@ -189,7 +187,7 @@
 
 			}
 
-			function onDocumentMouseOut( event ) {
+			function onDocumentMouseOut() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );

+ 9 - 12
examples/canvas_geometry_panorama.html

@@ -42,14 +42,11 @@
 			var camera, scene, renderer;
 
 			var texture_placeholder,
-			isUserInteracting = false,
-			onMouseDownMouseX = 0, onMouseDownMouseY = 0,
-			onPointerDownPointerX = 0, onPointerDownPointerY = 0,
-			onPointerDownLon = 0, onPointerDownLat = 0,
-			lon = 90, onMouseDownLon = 0,
-			lat = 0, onMouseDownLat = 0,
-			phi = 0, theta = 0,
-			target = new THREE.Vector3();
+				isUserInteracting = false,
+				onPointerDownPointerX = 0, onPointerDownPointerY = 0,
+				onPointerDownLon = 0, onPointerDownLat = 0,
+				lon = 90, lat = 0, phi = 0, theta = 0,
+				target = new THREE.Vector3();
 
 			init();
 			animate();
@@ -79,7 +76,7 @@
 					loadTexture( 'textures/cube/skybox/py.jpg' ), // top
 					loadTexture( 'textures/cube/skybox/ny.jpg' ), // bottom
 					loadTexture( 'textures/cube/skybox/pz.jpg' ), // back
-					loadTexture( 'textures/cube/skybox/nz.jpg' )  // front
+					loadTexture( 'textures/cube/skybox/nz.jpg' ) // front
 
 				];
 
@@ -160,7 +157,7 @@
 
 			}
 
-			function onDocumentMouseUp( event ) {
+			function onDocumentMouseUp() {
 
 				isUserInteracting = false;
 
@@ -199,8 +196,8 @@
 
 					event.preventDefault();
 
-					lon = ( onPointerDownPointerX - event.touches[0].pageX ) * 0.1 + onPointerDownLon;
-					lat = ( event.touches[0].pageY - onPointerDownPointerY ) * 0.1 + onPointerDownLat;
+					lon = ( onPointerDownPointerX - event.touches[ 0 ].pageX ) * 0.1 + onPointerDownLon;
+					lat = ( event.touches[ 0 ].pageY - onPointerDownPointerY ) * 0.1 + onPointerDownLat;
 
 				}
 

+ 9 - 11
examples/canvas_geometry_panorama_fisheye.html

@@ -42,14 +42,11 @@
 			var camera, scene, renderer;
 
 			var texture_placeholder,
-			isUserInteracting = false,
-			onMouseDownMouseX = 0, onMouseDownMouseY = 0,
-			onPointerDownPointerX = 0, onPointerDownPointerY = 0,
-			onPointerDownLon = 0, onPointerDownLat = 0,
-			lon = 90, onMouseDownLon = 0,
-			lat = 0, onMouseDownLat = 0,
-			phi = 0, theta = 0,
-			target = new THREE.Vector3();
+				isUserInteracting = false,
+				onPointerDownPointerX = 0, onPointerDownPointerY = 0,
+				onPointerDownLon = 0, onPointerDownLat = 0,
+				lon = 90, lat = 0, phi = 0, theta = 0,
+				target = new THREE.Vector3();
 
 			init();
 			animate();
@@ -168,9 +165,10 @@
 					lat = ( event.clientY - onPointerDownPointerY ) * 0.1 + onPointerDownLat;
 
 				}
+
 			}
 
-			function onDocumentMouseUp( event ) {
+			function onDocumentMouseUp() {
 
 				isUserInteracting = false;
 
@@ -208,8 +206,8 @@
 
 					event.preventDefault();
 
-					lon = ( onPointerDownPointerX - event.touches[0].pageX ) * 0.1 + onPointerDownLon;
-					lat = ( event.touches[0].pageY - onPointerDownPointerY ) * 0.1 + onPointerDownLat;
+					lon = ( onPointerDownPointerX - event.touches[ 0 ].pageX ) * 0.1 + onPointerDownLon;
+					lat = ( event.touches[ 0 ].pageY - onPointerDownPointerY ) * 0.1 + onPointerDownLat;
 
 				}
 

+ 58 - 62
examples/canvas_geometry_shapes.html

@@ -36,9 +36,7 @@
 
 			var container, stats;
 
-			var camera, scene, renderer;
-
-			var group, text, plane;
+			var camera, scene, renderer, group;
 
 			var targetRotation = 0;
 			var targetRotationOnMouseDown = 0;
@@ -47,7 +45,6 @@
 			var mouseXOnMouseDown = 0;
 
 			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
 
 			init();
 			animate();
@@ -100,28 +97,28 @@
 
 				var californiaPts = [];
 
-				californiaPts.push( new THREE.Vector2 ( 610, 320 ) );
-				californiaPts.push( new THREE.Vector2 ( 450, 300 ) );
-				californiaPts.push( new THREE.Vector2 ( 392, 392 ) );
-				californiaPts.push( new THREE.Vector2 ( 266, 438 ) );
-				californiaPts.push( new THREE.Vector2 ( 190, 570 ) );
-				californiaPts.push( new THREE.Vector2 ( 190, 600 ) );
-				californiaPts.push( new THREE.Vector2 ( 160, 620 ) );
-				californiaPts.push( new THREE.Vector2 ( 160, 650 ) );
-				californiaPts.push( new THREE.Vector2 ( 180, 640 ) );
-				californiaPts.push( new THREE.Vector2 ( 165, 680 ) );
-				californiaPts.push( new THREE.Vector2 ( 150, 670 ) );
-				californiaPts.push( new THREE.Vector2 (  90, 737 ) );
-				californiaPts.push( new THREE.Vector2 (  80, 795 ) );
-				californiaPts.push( new THREE.Vector2 (  50, 835 ) );
-				californiaPts.push( new THREE.Vector2 (  64, 870 ) );
-				californiaPts.push( new THREE.Vector2 (  60, 945 ) );
-				californiaPts.push( new THREE.Vector2 ( 300, 945 ) );
-				californiaPts.push( new THREE.Vector2 ( 300, 743 ) );
-				californiaPts.push( new THREE.Vector2 ( 600, 473 ) );
-				californiaPts.push( new THREE.Vector2 ( 626, 425 ) );
-				californiaPts.push( new THREE.Vector2 ( 600, 370 ) );
-				californiaPts.push( new THREE.Vector2 ( 610, 320 ) );
+				californiaPts.push( new THREE.Vector2( 610, 320 ) );
+				californiaPts.push( new THREE.Vector2( 450, 300 ) );
+				californiaPts.push( new THREE.Vector2( 392, 392 ) );
+				californiaPts.push( new THREE.Vector2( 266, 438 ) );
+				californiaPts.push( new THREE.Vector2( 190, 570 ) );
+				californiaPts.push( new THREE.Vector2( 190, 600 ) );
+				californiaPts.push( new THREE.Vector2( 160, 620 ) );
+				californiaPts.push( new THREE.Vector2( 160, 650 ) );
+				californiaPts.push( new THREE.Vector2( 180, 640 ) );
+				californiaPts.push( new THREE.Vector2( 165, 680 ) );
+				californiaPts.push( new THREE.Vector2( 150, 670 ) );
+				californiaPts.push( new THREE.Vector2( 90, 737 ) );
+				californiaPts.push( new THREE.Vector2( 80, 795 ) );
+				californiaPts.push( new THREE.Vector2( 50, 835 ) );
+				californiaPts.push( new THREE.Vector2( 64, 870 ) );
+				californiaPts.push( new THREE.Vector2( 60, 945 ) );
+				californiaPts.push( new THREE.Vector2( 300, 945 ) );
+				californiaPts.push( new THREE.Vector2( 300, 743 ) );
+				californiaPts.push( new THREE.Vector2( 600, 473 ) );
+				californiaPts.push( new THREE.Vector2( 626, 425 ) );
+				californiaPts.push( new THREE.Vector2( 600, 370 ) );
+				californiaPts.push( new THREE.Vector2( 610, 320 ) );
 
 				var californiaShape = new THREE.Shape( californiaPts );
 
@@ -129,10 +126,10 @@
 				// Triangle
 
 				var triangleShape = new THREE.Shape();
-				triangleShape.moveTo(  80, 20 );
-				triangleShape.lineTo(  40, 80 );
+				triangleShape.moveTo( 80, 20 );
+				triangleShape.lineTo( 40, 80 );
 				triangleShape.lineTo( 120, 80 );
-				triangleShape.lineTo(  80, 20 ); // close path
+				triangleShape.lineTo( 80, 20 ); // close path
 
 
 				// Heart
@@ -143,7 +140,7 @@
 
 				heartShape.moveTo( x + 25, y + 25 );
 				heartShape.bezierCurveTo( x + 25, y + 25, x + 20, y, x, y );
-				heartShape.bezierCurveTo( x - 30, y, x - 30, y + 35,x - 30,y + 35 );
+				heartShape.bezierCurveTo( x - 30, y, x - 30, y + 35, x - 30, y + 35 );
 				heartShape.bezierCurveTo( x - 30, y + 55, x - 10, y + 77, x + 25, y + 95 );
 				heartShape.bezierCurveTo( x + 60, y + 77, x + 80, y + 55, x + 80, y + 35 );
 				heartShape.bezierCurveTo( x + 80, y + 35, x + 80, y, x + 50, y );
@@ -155,7 +152,7 @@
 				var sqLength = 80;
 
 				var squareShape = new THREE.Shape();
-				squareShape.moveTo( 0,0 );
+				squareShape.moveTo( 0, 0 );
 				squareShape.lineTo( 0, sqLength );
 				squareShape.lineTo( sqLength, sqLength );
 				squareShape.lineTo( sqLength, 0 );
@@ -167,7 +164,7 @@
 				var rectLength = 120, rectWidth = 40;
 
 				var rectShape = new THREE.Shape();
-				rectShape.moveTo( 0,0 );
+				rectShape.moveTo( 0, 0 );
 				rectShape.lineTo( 0, rectWidth );
 				rectShape.lineTo( rectLength, rectWidth );
 				rectShape.lineTo( rectLength, 0 );
@@ -178,12 +175,12 @@
 
 				var roundedRectShape = new THREE.Shape();
 
-				( function roundedRect( ctx, x, y, width, height, radius ){
+				( function roundedRect( ctx, x, y, width, height, radius ) {
 
 					ctx.moveTo( x, y + radius );
 					ctx.lineTo( x, y + height - radius );
 					ctx.quadraticCurveTo( x, y + height, x + radius, y + height );
-					ctx.lineTo( x + width - radius, y + height) ;
+					ctx.lineTo( x + width - radius, y + height );
 					ctx.quadraticCurveTo( x + width, y + height, x + width, y + height - radius );
 					ctx.lineTo( x + width, y + radius );
 					ctx.quadraticCurveTo( x + width, y, x + width - radius, y );
@@ -199,9 +196,9 @@
 				var circleShape = new THREE.Shape();
 				circleShape.moveTo( 0, circleRadius );
 				circleShape.quadraticCurveTo( circleRadius, circleRadius, circleRadius, 0 );
-				circleShape.quadraticCurveTo( circleRadius, -circleRadius, 0, -circleRadius );
-				circleShape.quadraticCurveTo( -circleRadius, -circleRadius, -circleRadius, 0 );
-				circleShape.quadraticCurveTo( -circleRadius, circleRadius, 0, circleRadius );
+				circleShape.quadraticCurveTo( circleRadius, - circleRadius, 0, - circleRadius );
+				circleShape.quadraticCurveTo( - circleRadius, - circleRadius, - circleRadius, 0 );
+				circleShape.quadraticCurveTo( - circleRadius, circleRadius, 0, circleRadius );
 
 
 				// Fish
@@ -210,23 +207,23 @@
 
 				var fishShape = new THREE.Shape();
 
-				fishShape.moveTo(x,y);
-				fishShape.quadraticCurveTo(x + 50, y - 80, x + 90, y - 10);
-				fishShape.quadraticCurveTo(x + 100, y - 10, x + 115, y - 40);
-				fishShape.quadraticCurveTo(x + 115, y, x + 115, y + 40);
-				fishShape.quadraticCurveTo(x + 100, y + 10, x + 90, y + 10);
-				fishShape.quadraticCurveTo(x + 50, y + 80, x, y);
+				fishShape.moveTo( x, y );
+				fishShape.quadraticCurveTo( x + 50, y - 80, x + 90, y - 10 );
+				fishShape.quadraticCurveTo( x + 100, y - 10, x + 115, y - 40 );
+				fishShape.quadraticCurveTo( x + 115, y, x + 115, y + 40 );
+				fishShape.quadraticCurveTo( x + 100, y + 10, x + 90, y + 10 );
+				fishShape.quadraticCurveTo( x + 50, y + 80, x, y );
 
 
 				// Arc circle
 
 				var arcShape = new THREE.Shape();
 				arcShape.moveTo( 50, 10 );
-				arcShape.absarc( 10, 10, 40, 0, Math.PI*2, false );
+				arcShape.absarc( 10, 10, 40, 0, Math.PI * 2, false );
 
 				var holePath = new THREE.Path();
 				holePath.moveTo( 20, 10 );
-				holePath.absarc( 10, 10, 10, 0, Math.PI*2, true );
+				holePath.absarc( 10, 10, 10, 0, Math.PI * 2, true );
 				arcShape.holes.push( holePath );
 
 
@@ -234,18 +231,18 @@
 
 				var smileyShape = new THREE.Shape();
 				smileyShape.moveTo( 80, 40 );
-				smileyShape.absarc( 40, 40, 40, 0, Math.PI*2, false );
+				smileyShape.absarc( 40, 40, 40, 0, Math.PI * 2, false );
 
 				var smileyEye1Path = new THREE.Path();
 				smileyEye1Path.moveTo( 35, 20 );
 				// smileyEye1Path.absarc( 25, 20, 10, 0, Math.PI*2, true );
-				smileyEye1Path.absellipse( 25, 20, 10, 10, 0, Math.PI*2, true );
+				smileyEye1Path.absellipse( 25, 20, 10, 10, 0, Math.PI * 2, true );
 
 				smileyShape.holes.push( smileyEye1Path );
 
 				var smileyEye2Path = new THREE.Path();
 				smileyEye2Path.moveTo( 65, 20 );
-				smileyEye2Path.absarc( 55, 20, 10, 0, Math.PI*2, true );
+				smileyEye2Path.absarc( 55, 20, 10, 0, Math.PI * 2, true );
 				smileyShape.holes.push( smileyEye2Path );
 
 				var smileyMouthPath = new THREE.Path();
@@ -268,28 +265,28 @@
 				// Spline shape + path extrusion
 
 				var splinepts = [];
-				splinepts.push( new THREE.Vector2 ( 350, 100 ) );
-				splinepts.push( new THREE.Vector2 ( 400, 450 ) );
-				splinepts.push( new THREE.Vector2 ( -140, 350 ) );
-				splinepts.push( new THREE.Vector2 ( 0, 0 ) );
+				splinepts.push( new THREE.Vector2( 350, 100 ) );
+				splinepts.push( new THREE.Vector2( 400, 450 ) );
+				splinepts.push( new THREE.Vector2( - 140, 350 ) );
+				splinepts.push( new THREE.Vector2( 0, 0 ) );
 
-				var splineShape = new THREE.Shape(  );
+				var splineShape = new THREE.Shape( );
 				splineShape.moveTo( 0, 0 );
 				splineShape.splineThru( splinepts );
 
 
 				// addShape( shape, color, x, y, z, rx, ry,rz, s );
 
-				addShape( californiaShape, 0xffaa00, -300, -100, 0, 0, 0, 0, 0.25 );
-				addShape( triangleShape, 0xffee00, -180, 0, 0, 0, 0, 0, 1 );
-				addShape( roundedRectShape, 0x005500, -150, 150, 0, 0, 0, 0, 1 );
+				addShape( californiaShape, 0xffaa00, - 300, - 100, 0, 0, 0, 0, 0.25 );
+				addShape( triangleShape, 0xffee00, - 180, 0, 0, 0, 0, 0, 1 );
+				addShape( roundedRectShape, 0x005500, - 150, 150, 0, 0, 0, 0, 1 );
 				addShape( squareShape, 0x0055ff, 150, 100, 0, 0, 0, 0, 1 );
 				addShape( heartShape, 0xff1100, 60, 100, 0, 0, 0, Math.PI, 1 );
 				addShape( circleShape, 0x00ff11, 120, 250, 0, 0, 0, 0, 1 );
-				addShape( fishShape, 0x222222, -60, 200, 0, 0, 0, 0, 1 );
-				addShape( smileyShape, 0xee00ff, -200, 250, 0, 0, 0, Math.PI, 1 );
+				addShape( fishShape, 0x222222, - 60, 200, 0, 0, 0, 0, 1 );
+				addShape( smileyShape, 0xee00ff, - 200, 250, 0, 0, 0, Math.PI, 1 );
 				addShape( arcShape, 0xbb4422, 150, 0, 0, 0, 0, 0, 1 );
-				addShape( splineShape, 0x888888, -50, -100, 0, 0, 0, 0, 0.2 );
+				addShape( splineShape, 0x888888, - 50, - 100, 0, 0, 0, 0, 0.2 );
 
 				//
 
@@ -315,7 +312,6 @@
 			function onWindowResize() {
 
 				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
@@ -347,7 +343,7 @@
 
 			}
 
-			function onDocumentMouseUp( event ) {
+			function onDocumentMouseUp() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
@@ -355,7 +351,7 @@
 
 			}
 
-			function onDocumentMouseOut( event ) {
+			function onDocumentMouseOut() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );

+ 4 - 6
examples/canvas_geometry_text.html

@@ -39,7 +39,6 @@
 			var mouseXOnMouseDown = 0;
 
 			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
 
 			var loader = new THREE.FontLoader();
 			loader.load( 'fonts/helvetiker_regular.typeface.json', function ( font ) {
@@ -87,11 +86,11 @@
 					height: 20,
 					curveSegments: 2
 
-				});
+				} );
 
 				geometry.computeBoundingBox();
 
-				var centerOffset = -0.5 * ( geometry.boundingBox.max.x - geometry.boundingBox.min.x );
+				var centerOffset = - 0.5 * ( geometry.boundingBox.max.x - geometry.boundingBox.min.x );
 
 				var materials = [
 					new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, overdraw: 0.5 } ),
@@ -133,7 +132,6 @@
 			function onWindowResize() {
 
 				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
@@ -165,7 +163,7 @@
 
 			}
 
-			function onDocumentMouseUp( event ) {
+			function onDocumentMouseUp() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );
@@ -173,7 +171,7 @@
 
 			}
 
-			function onDocumentMouseOut( event ) {
+			function onDocumentMouseOut() {
 
 				document.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.removeEventListener( 'mouseup', onDocumentMouseUp, false );

+ 3 - 2
examples/canvas_interactive_cubes.html

@@ -127,8 +127,8 @@
 
 				event.preventDefault();
 
-				event.clientX = event.touches[0].clientX;
-				event.clientY = event.touches[0].clientY;
+				event.clientX = event.touches[ 0 ].clientX;
+				event.clientY = event.touches[ 0 ].clientY;
 				onDocumentMouseDown( event );
 
 			}
@@ -163,6 +163,7 @@
 
 				}
 				*/
+
 			}
 
 			//

+ 13 - 12
examples/canvas_interactive_cubes_tween.html

@@ -27,7 +27,7 @@
 
 			var container, stats;
 			var camera, scene, renderer;
-			
+
 			var raycaster;
 			var mouse;
 
@@ -71,16 +71,16 @@
 					scene.add( object );
 
 				}
-				
+
 				//
-				
+
 				raycaster = new THREE.Raycaster();
 				mouse = new THREE.Vector2();
 
 				renderer = new THREE.CanvasRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild(renderer.domElement);
+				container.appendChild( renderer.domElement );
 
 				stats = new Stats();
 				container.appendChild( stats.dom );
@@ -102,16 +102,16 @@
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 			}
-			
+
 			function onDocumentTouchStart( event ) {
-				
+
 				event.preventDefault();
-				
-				event.clientX = event.touches[0].clientX;
-				event.clientY = event.touches[0].clientY;
+
+				event.clientX = event.touches[ 0 ].clientX;
+				event.clientY = event.touches[ 0 ].clientY;
 				onDocumentMouseDown( event );
 
-			}	
+			}
 
 			function onDocumentMouseDown( event ) {
 
@@ -130,13 +130,13 @@
 						x: Math.random() * 800 - 400,
 						y: Math.random() * 800 - 400,
 						z: Math.random() * 800 - 400 }, 2000 )
-					.easing( TWEEN.Easing.Elastic.Out).start();
+						.easing( TWEEN.Easing.Elastic.Out ).start();
 
 					new TWEEN.Tween( intersects[ 0 ].object.rotation ).to( {
 						x: Math.random() * 2 * Math.PI,
 						y: Math.random() * 2 * Math.PI,
 						z: Math.random() * 2 * Math.PI }, 2000 )
-					.easing( TWEEN.Easing.Elastic.Out).start();
+						.easing( TWEEN.Easing.Elastic.Out ).start();
 
 				}
 
@@ -148,6 +148,7 @@
 
 				}
 				*/
+
 			}
 
 			//

+ 5 - 4
examples/canvas_interactive_voxelpainter.html

@@ -96,7 +96,7 @@
 				renderer = new THREE.CanvasRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild(renderer.domElement);
+				container.appendChild( renderer.domElement );
 
 				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
 				document.addEventListener( 'keydown', onDocumentKeyDown, false );
@@ -163,7 +163,7 @@
 
 			function onDocumentKeyDown( event ) {
 
-				switch( event.keyCode ) {
+				switch ( event.keyCode ) {
 
 					case 16: isShiftDown = true; break;
 
@@ -173,16 +173,17 @@
 
 			function onDocumentKeyUp( event ) {
 
-				switch( event.keyCode ) {
+				switch ( event.keyCode ) {
 
 					case 16: isShiftDown = false; break;
 
 				}
+
 			}
 
 			function save() {
 
-				window.open( renderer.domElement.toDataURL('image/png'), 'mywindow' );
+				window.open( renderer.domElement.toDataURL( 'image/png' ), 'mywindow' );
 				return false;
 
 			}

+ 2 - 2
examples/canvas_lights_pointlights.html

@@ -47,8 +47,8 @@
 		<script>
 
 			var camera, scene, renderer,
-			light1, light2, light3,
-			loader, mesh;
+				light1, light2, light3,
+				loader, mesh;
 
 			init();
 			animate();

+ 6 - 7
examples/canvas_lines.html

@@ -26,19 +26,18 @@
 		<script>
 
 			var mouseX = 0, mouseY = 0,
+				windowHalfX = window.innerWidth / 2,
+				windowHalfY = window.innerHeight / 2,
 
-			windowHalfX = window.innerWidth / 2,
-			windowHalfY = window.innerHeight / 2,
-
-			camera, scene, renderer;
+				camera, scene, renderer;
 
 			init();
 			animate();
 
 			function init() {
 
-				var container = document.createElement('div');
-				document.body.appendChild(container);
+				var container = document.createElement( 'div' );
+				document.body.appendChild( container );
 
 				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.z = 100;
@@ -114,7 +113,7 @@
 
 			//
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 				mouseX = event.clientX - windowHalfX;
 				mouseY = event.clientY - windowHalfY;

+ 2 - 1
examples/canvas_lines_colors.html

@@ -202,6 +202,7 @@
 
 					mouseX = event.touches[ 0 ].pageX - windowHalfX;
 					mouseY = event.touches[ 0 ].pageY - windowHalfY;
+
 				}
 
 			}
@@ -230,7 +231,7 @@
 
 					if ( object.isLine ) {
 
-						object.rotation.y = time * ( i % 2 ? 1 : -1 );
+						object.rotation.y = time * ( i % 2 ? 1 : - 1 );
 
 					}
 

+ 1 - 1
examples/canvas_lines_dashed.html

@@ -61,7 +61,7 @@
 				var subdivisions = 3;
 				var recursion = 1;
 
-				var points = hilbert3D( new THREE.Vector3( 0,0,0 ), 25.0, recursion, 0, 1, 2, 3, 4, 5, 6, 7 );
+				var points = hilbert3D( new THREE.Vector3( 0, 0, 0 ), 25.0, recursion, 0, 1, 2, 3, 4, 5, 6, 7 );
 				var spline = new THREE.CatmullRomCurve3( points );
 
 				var samples = spline.getPoints( points.length * subdivisions );

+ 4 - 18
examples/canvas_materials.html

@@ -34,8 +34,8 @@
 
 			function init() {
 
-				container = document.createElement('div');
-				document.body.appendChild(container);
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
 				camera.position.set( 0, 200, 800 );
@@ -132,7 +132,7 @@
 				container.appendChild( renderer.domElement );
 
 				stats = new Stats();
-				container.appendChild(stats.dom);
+				container.appendChild( stats.dom );
 
 				//
 
@@ -149,20 +149,6 @@
 
 			}
 
-			function loadImage( path ) {
-
-				var image = document.createElement( 'img' );
-				var texture = new THREE.Texture( image, THREE.UVMapping );
-
-				image.onload = function () { texture.needsUpdate = true; };
-				image.src = path;
-
-				return texture;
-
-			}
-
-			//
-
 			function animate() {
 
 				requestAnimationFrame( animate );
@@ -180,7 +166,7 @@
 				camera.position.z = Math.sin( timer ) * 1000;
 				camera.lookAt( scene.position );
 
-				for ( var i = 0, l = objects.length; i < l; i++ ) {
+				for ( var i = 0, l = objects.length; i < l; i ++ ) {
 
 					var object = objects[ i ];
 

+ 7 - 9
examples/canvas_materials_video.html

@@ -29,15 +29,13 @@
 
 		<script>
 
-			var AMOUNT = 100;
-
 			var container, stats;
 
 			var camera, scene, renderer;
 
 			var video, image, imageContext,
-			imageReflection, imageReflectionContext, imageReflectionGradient,
-			texture, textureReflection;
+				imageReflection, imageReflectionContext, imageReflectionGradient,
+				texture, textureReflection;
 
 			var mesh;
 
@@ -107,10 +105,10 @@
 
 				mesh = new THREE.Mesh( plane, material );
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5;
-				scene.add(mesh);
+				scene.add( mesh );
 
 				mesh = new THREE.Mesh( plane, materialReflection );
-				mesh.position.y = -306;
+				mesh.position.y = - 306;
 				mesh.rotation.x = - Math.PI;
 				mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5;
 				scene.add( mesh );
@@ -135,13 +133,13 @@
 
 				} );
 
-				for ( var ix = 0; ix < amountx; ix++ ) {
+				for ( var ix = 0; ix < amountx; ix ++ ) {
 
-					for ( var iy = 0; iy < amounty; iy++ ) {
+					for ( var iy = 0; iy < amounty; iy ++ ) {
 
 						var sprite = new THREE.Sprite( material );
 						sprite.position.x = ix * separation - ( ( amountx * separation ) / 2 );
-						sprite.position.y = -153;
+						sprite.position.y = - 153;
 						sprite.position.z = iy * separation - ( ( amounty * separation ) / 2 );
 						sprite.scale.setScalar( 2 );
 						scene.add( sprite );

+ 3 - 4
examples/canvas_morphtargets_horse.html

@@ -27,8 +27,7 @@
 		<script>
 
 			var container, stats;
-			var camera, scene, projector, renderer;
-			var mesh, mixer;
+			var camera, scene, renderer, mixer;
 
 			init();
 			animate();
@@ -62,7 +61,7 @@
 				scene.add( light );
 
 				var light = new THREE.DirectionalLight( 0xffefef, 1.5 );
-				light.position.set( -1, -1, -1 ).normalize();
+				light.position.set( - 1, - 1, - 1 ).normalize();
 				scene.add( light );
 
 				var loader = new THREE.GLTFLoader();
@@ -86,7 +85,7 @@
 				renderer = new THREE.CanvasRenderer();
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild(renderer.domElement);
+				container.appendChild( renderer.domElement );
 
 				//
 

+ 6 - 8
examples/canvas_particles_floor.html

@@ -53,9 +53,9 @@
 
 				var material = new THREE.SpriteMaterial();
 
-				for ( var ix = 0; ix < AMOUNTX; ix++ ) {
+				for ( var ix = 0; ix < AMOUNTX; ix ++ ) {
 
-					for ( var iy = 0; iy < AMOUNTY; iy++ ) {
+					for ( var iy = 0; iy < AMOUNTY; iy ++ ) {
 
 						particle = new THREE.Sprite( material );
 						particle.scale.y = 20;
@@ -79,8 +79,6 @@
 				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
 				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
 
-				//
-
 				window.addEventListener( 'resize', onWindowResize, false );
 
 			}
@@ -97,12 +95,11 @@
 
 			}
 
-			//
-
 			function onDocumentMouseMove( event ) {
 
 				mouseX = event.clientX - windowHalfX;
 				mouseY = event.clientY - windowHalfY;
+
 			}
 
 			function onDocumentTouchStart( event ) {
@@ -113,7 +110,9 @@
 
 					mouseX = event.touches[ 0 ].pageX - windowHalfX;
 					mouseY = event.touches[ 0 ].pageY - windowHalfY;
+
 				}
+
 			}
 
 			function onDocumentTouchMove( event ) {
@@ -124,12 +123,11 @@
 
 					mouseX = event.touches[ 0 ].pageX - windowHalfX;
 					mouseY = event.touches[ 0 ].pageY - windowHalfY;
+
 				}
 
 			}
 
-			//
-
 			function animate() {
 
 				requestAnimationFrame( animate );

+ 3 - 1
examples/canvas_particles_random.html

@@ -59,7 +59,7 @@
 				group = new THREE.Group();
 				scene.add( group );
 
-				for ( var i = 0; i < 1000; i++ ) {
+				for ( var i = 0; i < 1000; i ++ ) {
 
 					var material = new THREE.SpriteCanvasMaterial( {
 						color: Math.random() * 0x808008 + 0x808080,
@@ -72,6 +72,7 @@
 					particle.position.z = Math.random() * 2000 - 1000;
 					particle.scale.x = particle.scale.y = Math.random() * 20 + 10;
 					group.add( particle );
+
 				}
 
 				renderer = new THREE.CanvasRenderer();
@@ -110,6 +111,7 @@
 
 				mouseX = event.clientX - windowHalfX;
 				mouseY = event.clientY - windowHalfY;
+
 			}
 
 			function onDocumentTouchStart( event ) {

+ 3 - 1
examples/canvas_particles_sprites.html

@@ -54,13 +54,14 @@
 					blending: THREE.AdditiveBlending
 				} );
 
-				for ( var i = 0; i < 1000; i++ ) {
+				for ( var i = 0; i < 1000; i ++ ) {
 
 					particle = new THREE.Sprite( material );
 
 					initParticle( particle, i * 10 );
 
 					scene.add( particle );
+
 				}
 
 				renderer = new THREE.CanvasRenderer();
@@ -145,6 +146,7 @@
 
 				mouseX = event.clientX - windowHalfX;
 				mouseY = event.clientY - windowHalfY;
+
 			}
 
 			function onDocumentTouchStart( event ) {

+ 1 - 1
examples/canvas_particles_waves.html

@@ -170,7 +170,7 @@
 
 					for ( var iy = 0; iy < AMOUNTY; iy ++ ) {
 
-						particle = particles[ i++ ];
+						particle = particles[ i ++ ];
 						particle.position.y = ( Math.sin( ( ix + count ) * 0.3 ) * 50 ) +
 							( Math.sin( ( iy + count ) * 0.5 ) * 50 );
 						particle.scale.x = particle.scale.y = ( Math.sin( ( ix + count ) * 0.3 ) + 1 ) * 4 +

+ 1 - 1
examples/canvas_performance.html

@@ -85,7 +85,7 @@
 				container.appendChild( renderer.domElement );
 
 				stats = new Stats();
-				container.appendChild(stats.dom);
+				container.appendChild( stats.dom );
 
 				//
 

+ 3 - 4
examples/canvas_sandbox.html

@@ -27,8 +27,7 @@
 
 			var container, stats;
 
-			var camera, scene, renderer;
-			var controls, group;
+			var camera, scene, renderer, group;
 
 			init();
 			animate();
@@ -87,7 +86,7 @@
 				container.appendChild( renderer.domElement );
 
 				stats = new Stats();
-				container.appendChild(stats.dom);
+				container.appendChild( stats.dom );
 
 				//
 
@@ -117,7 +116,7 @@
 
 			function render() {
 
-				for ( var i = 0, l = group.children.length; i < l; i++ ) {
+				for ( var i = 0, l = group.children.length; i < l; i ++ ) {
 
 					var object = group.children[ i ];