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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              /**
 * OMEGA 3D Framework - http://lab.rackdoll.nl/js/omega/
 * v.0.0.1.6 Alpha - Sexy lights Demo.
 * author: Rackdoll.
 */
document.getElementsByTagName("body")[0].onload = timeout();
var images, scene, cam, light1, light2, light3, torus, renderer, chain;

function timeout() {
  setTimeout(function() {
    init();
  }, 1000);
}

function init() {
  //adjust on window
  Omega3D.Recalibrate();

  //scene
  scene = new Omega3D.Scene();
  scene.setColor( 0, 0, 0);

  //camera.
  cam = new Omega3D.cameras.Camera();
  cam.LookAt(0, 0, 0, [0, -1, -3]);

  //lights
  light1 = new Omega3D.Light(Omega3D.POINT_LIGHT);
  light1.SetSpecular(1.0, 1.0, 1.0);
  light1.SetDiffuse(1.0, 0.0, 0.0);
  light1.SetAmbient(0, 0, 0);
  light1.SetPosition(1, -1, -1);
  scene.addLight(light1);

  light2 = new Omega3D.Light(Omega3D.POINT_LIGHT);
  light2.SetSpecular(1.0, 1.0, 1.0);
  light2.SetDiffuse(0, 1.0, 0.0);
  light2.SetPosition(-1, -1, -1);
  scene.addLight(light2);

  light3 = new Omega3D.Light(Omega3D.DIRECTIONAL_LIGHT);
  light3.SetDirection(-1, 0, 0);
  light3.SetSpecular(1.0, 1.0, 1.0);
  light3.SetDiffuse(0.0, 0.0, 1.0);
  scene.addLight(light3);

  //object
  torus = new Omega3D.Object3D(new Omega3D.Mesh(new Omega3D.Geometry.TorusGeometry(0.75, 0.35, 60, 60)),
    new Omega3D.BasicMaterial([], scene, [1, 1, 1]));

  //add object to scene.
  scene.addChild(torus);

  //create render chain.
  renderer = new Omega3D.WebGLRenderer;
  chain = new Omega3D.RenderChain();
  chain.AddRenderPass(new RenderPass(renderer, scene, cam));
  renderer.SetRenderChain(chain);

  //start render.
  render();
}

//RENDER.
function render() {
  requestAnimationFrame(render);

  //rotate torus.
  torus.Rotate(0.01, 0.02, 0.03);

  //render step.
  renderer.render();
}
            
          
!
999px
Loading ..................

Console