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.

            
              body{
  background: linear-gradient(to bottom, #920000, #d03a3a);
  overflow: hidden
}
            
          
!
            
              console.clear();
const [ww, wh] = [window.innerWidth, window.innerHeight];

// WebGL Rendering Engine
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setSize(ww, wh);
renderer.shadowMap.enabled = true;
document.body.appendChild(renderer.domElement);

// New Scene
const scene = new THREE.Scene();

// Perspective Camera
const camera = new THREE.PerspectiveCamera(45, ww/wh, 0.1, 150);

// Position x,y,z axis of camera
camera.position.set(0, 0, 50);

// Controls
const controls = new THREE.OrbitControls(camera);

// create the mesh from geometry and material
const tree = new THREE.Group();

const cylinder = new THREE.CylinderGeometry(2, 2, 5, 32);
const cylmaterial = new THREE.MeshLambertMaterial({ color: 0x966F33 });
const wood = new THREE.Mesh(cylinder, cylmaterial);
wood.position.y = -12;
tree.add(wood);

'xmas'.split('').forEach((layer, i) => {
  const geometry = new THREE.ConeGeometry(7, 20, 32);
  const material = new THREE.MeshLambertMaterial({ color: 0x2C9E4B });
  const cone = new THREE.Mesh(geometry, material);
  const scale = 1 - (i * 0.25);
  cone.position.y = i * 3;
  cone.scale.set(scale, scale, scale);
  tree.add(cone);
});

// lights
const light = new THREE.DirectionalLight(0xeaeaea);
light.position.set(5, 25, 50);
light.castShadow = true;

// adding objects to the scene
scene.add(tree);
scene.add(light);

// render the scene
const render = () => {
  requestAnimationFrame(render);
  controls.update();
  renderer.render(scene, camera);
};

render();
            
          
!
999px
Loading ..................

Console