D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
1wheel
Full window
Github gist
threejs-stars
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> body { background-color: #ffffff; margin: 0; overflow: hidden; } </style> </head> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r73/three.min.js"></script> <script> var camera, scene, renderer; var geometry, material, mesh; function setup() { var W = window.innerWidth, H = window.innerHeight; renderer = new THREE.WebGLRenderer(); renderer.setSize( W, H ); document.body.appendChild( renderer.domElement ); camera = new THREE.PerspectiveCamera( 50, W/H, 1, 10000 ); camera.position.z = 500; scene = new THREE.Scene(); // paste your code from the geometryGUI here geometry = new THREE.Geometry(); for ( i = 0; i < 10; i ++ ) { var vertex = new THREE.Vector3(); vertex.x = Math.round((1000 * Math.random() - 500)/20)*20; vertex.y = Math.round((1000 * Math.random() - 500)/20)*20; vertex.z = Math.round((1000 * Math.random() - 500)/20)*20; geometry.vertices.push( vertex ); } material = new THREE.PointsMaterial( { size: 2, sizeAttenuation: false, transparent: true } ); material.color.setHex( ); particles = new THREE.Points( geometry, material ); particles.sortParticles = true; scene.add( particles ); } var color = [10, 100, 200] function draw() { camera.position.x = Math.sin( Date.now() * 0.003 ) * 10 + Math.cos( Date.now() * 0.003 ) * 10; camera.position.y = Math.cos( Date.now() * 0.006 ) * 10; camera.rotation.z = Math.cos( Date.now() * 0.00006 ) * 50 +500; color = color.map(function(d, i){ return (d + 1 + i) % 256 }) geometry = new THREE.Geometry(); material.color.set( new THREE.Color(color[2], color[2], color[2])) material.color.set( new THREE.Color('red')) for ( i = 0; i < 60; i ++ ) { var vertex = new THREE.Vector3(); vertex.x = Math.round((1000 * Math.random() - 500)/20)*20; vertex.y = Math.round((1000 * Math.random() - 500)/20)*20; vertex.z = Math.round((1000 * Math.random() - 500)/20)*20; geometry.vertices.push( vertex ); } particles = new THREE.Points( geometry, material ); particles.sortParticles = true; scene.add( particles ); requestAnimationFrame( draw ); renderer.render( scene, camera ); } setup(); draw(); </script> </body> </html>
https://cdnjs.cloudflare.com/ajax/libs/three.js/r73/three.min.js