瀏覽代碼

Examples: FlakesTexture clean up.

Mr.doob 5 年之前
父節點
當前提交
146ec4d27f
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      examples/jsm/textures/FlakesTexture.js

+ 10 - 10
examples/jsm/textures/FlakesTexture.js

@@ -6,25 +6,25 @@ class FlakesTexture {
 
 	constructor( width = 512, height = 512 ) {
 
-		var canvas = document.createElement( 'canvas' );
+		const canvas = document.createElement( 'canvas' );
 		canvas.width = width;
 		canvas.height = height;
 
-		var context = canvas.getContext( '2d' );
+		const context = canvas.getContext( '2d' );
 		context.fillStyle = 'rgb(127,127,255)';
 		context.fillRect( 0, 0, width, height );
 
-		for ( var i = 0; i < 4000; i ++ ) {
+		for ( let i = 0; i < 4000; i ++ ) {
 
-			var x = Math.random() * width;
-			var y = Math.random() * height;
-			var r = Math.random() * 3 + 3;
+			const x = Math.random() * width;
+			const y = Math.random() * height;
+			const r = Math.random() * 3 + 3;
 
-			var nx = Math.random() * 2 - 1;
-			var ny = Math.random() * 2 - 1;
-			var nz = 1.5;
+			let nx = Math.random() * 2 - 1;
+			let ny = Math.random() * 2 - 1;
+			let nz = 1.5;
 
-			var l = Math.sqrt( nx * nx + ny * ny + nz * nz );
+			const l = Math.sqrt( nx * nx + ny * ny + nz * nz );
 
 			nx /= l; ny /= l; nz /= l;