Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
  <head>
    </head>
    <body
      </body>
  <script src="./main.js"></script>
</html>
              
            
!

CSS

              
                canvas {
        position: fixed;
        top: 0;
        left: 0;
}
              
            
!

JS

              
                var width = window.innerWidth;
var height = window.innerHeight;
var renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(width, height);
document.body.appendChild(renderer.domElement);

let colorMesh1 = 0xff0000
let colorMesh2 = 0x0000ff

var scene = new THREE.Scene();
scene.background = new THREE.Color();

var camera = new THREE.OrthographicCamera(
  width / -2,
  width / 2,
  height / 2,
  height / -2,
  1,
  1000
);
camera.position.set(50, 50, 50);
camera.zoom = 3.5;
camera.updateProjectionMatrix();

var cone = new THREE.Mesh(
  new THREE.ConeBufferGeometry(10, 20, 20),
  new THREE.MeshBasicMaterial({ color: colorMesh1, side: THREE.BackSide })
);

scene.add(cone);
cone.position.set(20, 20, 20);

let circle = new THREE.Mesh(
  new THREE.RingBufferGeometry(10, 10.5, 20),
  new THREE.MeshBasicMaterial({ color: colorMesh1, side: THREE.DoubleSide })
);
circle.rotation.set(1.57, 0, 0);
circle.position.set(20, 0, 20);
scene.add(circle);

let linGeom = new THREE.BufferGeometry();
linGeom.setAttribute(
  "position",
  new THREE.BufferAttribute(
    new Float32Array([10, 10, 0, 20, 30, 0, 30, 10, 0, 10, 10, 0]),
    3
  )
);
let triangle1 = new THREE.Line(
  linGeom,
  new THREE.LineBasicMaterial({ color: colorMesh1 })
);
scene.add(triangle1);

let linGeom2 = new THREE.BufferGeometry();
linGeom2.setAttribute(
  "position",
  new THREE.BufferAttribute(
    new Float32Array([0, 10, 10, 0, 30, 20, 0, 10, 30, 0, 10, 10]),
    3
  )
);
let triangle2 = new THREE.Line(
  linGeom2,
  new THREE.LineBasicMaterial({ color: colorMesh1 })
);
scene.add(triangle2);

///
var cone2 = new THREE.Mesh(
  new THREE.ConeBufferGeometry(5, 10, 20),
  new THREE.MeshBasicMaterial({ color: colorMesh2, side: THREE.BackSide })
);

scene.add(cone2);
cone2.position.set(40, 20, 20);

let circle2 = new THREE.Mesh(
  new THREE.RingBufferGeometry(5, 5.5, 20),
  new THREE.MeshBasicMaterial({ color: colorMesh2, side: THREE.DoubleSide })
);
circle2.rotation.set(1.57, 0, 0);
circle2.position.set(40, 0, 20);
scene.add(circle2);

let linGeom12 = new THREE.BufferGeometry();
linGeom12.setAttribute(
  "position",
  new THREE.BufferAttribute(
    new Float32Array([35, 15, 0, 40, 25, 0, 45, 15, 0, 35, 15, 0]),
    3
  )
);
let triangle12 = new THREE.Line(
  linGeom12,
  new THREE.LineBasicMaterial({ color: colorMesh2 })
);
scene.add(triangle12);

var pointLight = new THREE.PointLight(0xffffff);
pointLight.position.set(0, 300, 200);
scene.add(pointLight);
var axesHelper = new THREE.AxesHelper(50);
scene.add(axesHelper);

var controls = new THREE.OrbitControls(camera, renderer.domElement);

let i = 0;
function render() {
  requestAnimationFrame(render);
  renderer.render(scene, camera);
  if (i++ % 60 > 30) {
    cone.visible = false;
    circle.visible = true;
    triangle1.visible = true;
    triangle2.visible = true;
    cone2.visible = false;
    circle2.visible = true;
    triangle12.visible = true;
  } else {
    cone.visible = true;
    circle.visible = false;
    triangle1.visible = false;
    triangle2.visible = false;
    cone2.visible = true;
    circle2.visible = false;
    triangle12.visible = false;
  }
}

render();

              
            
!
999px

Console