Browse Source

More tweaks to CSS3D Youtube example.

Mr.doob 11 năm trước cách đây
mục cha
commit
2eac89431c
1 tập tin đã thay đổi với 10 bổ sung10 xóa
  1. 10 10
      examples/css3d_youtube.html

+ 10 - 10
examples/css3d_youtube.html

@@ -246,7 +246,7 @@
 					( function () {
 
 						var object = scene.children[ i ];
-						var delay = Math.random() * 100;
+						var delay = i * 15;
 
 						new TWEEN.Tween( object.position )
 							.to( { y: - 2000 }, 1000 )
@@ -270,14 +270,6 @@
 
 			}
 			
-			function addToView(data,time) {
-				setTimeout(function(){
-					scene.add(
-						new Element( data )
-					);
-				},time);
-			}
-			
 			function onData( event ) {
 
 				var data = JSON.parse( event.target.responseText );
@@ -287,7 +279,15 @@
 
 				for ( var i = 0; i < entries.length; i ++ ) {
 
-					addToView(entries[ i ], i * 100);
+					( function ( data, time ) {
+
+						setTimeout( function () {
+
+							scene.add( new Element( data ) );
+
+						}, time );
+
+					} )( entries[ i ], i * 15 );
 				
 				}