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.

            
              window.onload = function() {
  init();
  render();
}
window.onresize = onResize;

var camera, scene, renderer;
var stats;
var controller;


function init() {
  rotation = new THREE.Euler();

  initGui();
  initStats();

  initScene();
  initCamera();
  initRenderer();
}

function initStats() {
  stats = new Stats();
  stats.setMode(0);
  stats.domElement.style.position = 'absolute';
  stats.domElement.style.left = '0px';
  stats.domElement.style.top = '0px';
  document.body.appendChild(stats.domElement);
}

function initGui() {
  controller = new function() {

  };

  gui = new dat.GUI();

}

function initRenderer() {
  renderer = new THREE.WebGLRenderer();
  renderer.setClearColor(new THREE.Color(0x000000));
  renderer.setSize(window.innerWidth, window.innerHeight);
  document.body.appendChild(renderer.domElement);
}

function initCamera() {
  camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
  camera.position.set(0, 0, 130);
  camera.lookAt(scene.position);
}

function initScene() {
  scene = new THREE.Scene();

  var geometry = new THREE.Geometry();
  var material = new THREE.PointsMaterial({
    color: 0xffffff,
    size: 0.3,
    vertexColors: true
  });

  for (var i = 0; i < 200000; i++) {
    var vec = new THREE.Vector3(Math.random(), Math.random(), Math.random());
    var pos = new THREE.Vector3(
      map(vec.x, 0, 1, -30, 30),
      map(vec.y, 0, 1, -30, 30),
      map(vec.z, 0, 1, -30, 30)
    );
    geometry.vertices.push(pos);
    var color1 = new THREE.Color(0xc71585);
    var color2 = new THREE.Color(0x16c757);
    color1.lerp(color2, vec.length() / Math.sqrt(3));
    geometry.colors.push(color1);
  }

  var points = new THREE.Points(geometry, material);
  scene.add(points);
}

function getRandom(min, max) {
  return Math.random() * (max - min) + min;
}

function map(v, min1, max1, min2, max2) {
  return (v / (max1 - min1)) * (max2 - min2) + min2;
}


function render() {
  scene.rotation.x += 0.005;
  scene.rotation.y += 0.005;
  scene.rotation.z += 0.005;
  stats.update();
  renderer.render(scene, camera);
  requestAnimationFrame(render);
}

function onResize() {
  camera.aspect = window.innerWidth / window.innerHeight;
  camera.updateProjectionMatrix();
  renderer.setSize(window.innerWidth, window.innerHeight);
}
            
          
!
999px
Loading ..................

Console