Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                
<div id="container"></div>

              
            
!

CSS

              
                body {
  margin: 0;
  padding: 0;
  overflow:hidden ;
}
              
            
!

JS

              
                //Forked from http://jsfiddle.net/3listone/0555Lt3f/.

var camera, controls, scene, renderer;
var hoop;
init();
animate();

function init() {

  scene = new THREE.Scene();

  renderer = new THREE.WebGLRenderer({
    alpha: true
  });
  renderer.setClearColor(0xddeeff, 1);
  renderer.setSize(window.innerWidth, window.innerHeight);

  // find and setup container
  var container = document.getElementById('container');
  container.appendChild(renderer.domElement);

  // create a camera
  camera = new THREE.PerspectiveCamera(60,
                 window.innerWidth /  window.innerHeight, 1, 1000);
  camera.position.z = 50;

  // setup orbit controls
  controls = new THREE.OrbitControls(camera, renderer.domElement);
  controls.enableDamping = true;
  controls.dampingFactor = 0.25;
  controls.enableZoom = true;
  controls.autoRotate = true ;
	controls.autoRotateSpeed = 0.1 ;

  // lights
  light = new THREE.DirectionalLight(0xffffff, 0.5);
  light.position.set(1, 1, 1);
  scene.add(light);
  light = new THREE.DirectionalLight(0x0167a0, 0.5);
  light.position.set(-1, -1, -1);
  scene.add(light);
  light = new THREE.AmbientLight(0x5a5a5a);
  scene.add(light);

  // outer torus
  hoopTape1 =  new THREE.TorusGeometry(20, 9, 20, 100);

  var loader = new THREE.TextureLoader();
  
  var hoopTape1texture = loader.load(
    "https://brainjam.netlify.app/codepen-assets/Aurora-seamless.jpg",   

    function(texture) {
    texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
    texture.repeat.set(1, 1); // or whatever you like
    render();
  });

  var hoopTape1material = new THREE.MeshPhongMaterial({
    color: 0xFFFFFF,
    specular: 0xaaaaaa,
    shininess: 50,
    bumpMap: hoopTape1texture,
    map: hoopTape1texture,
    alphaMap: hoopTape1texture,
    alphaTest: 0.1,
    side: THREE.DoubleSide, 
    transparent: true
  });

  hoopTape1Mesh = new THREE.Mesh(hoopTape1, hoopTape1material);
  scene.add(hoopTape1Mesh);

  // inner torus
  hoop = new THREE.TorusGeometry(20, 1, 4, 100);
  var hoopMaterial = new THREE.MeshPhongMaterial({
    ambient: 0xffffff,
    color: 0xffffff,  // 0x028fde
    specular: 0x555555,
    shininess: 0,
    map: hoopTape1texture,
  });
  hoopMesh = new THREE.Mesh(hoop, hoopMaterial);
  hoopMesh.position.z = 0;
  scene.add(hoopMesh);

  // resize listener
  window.addEventListener('resize', onWindowResize, false);
}

function onWindowResize() {
  camera.aspect = window.innerWidth / window.innerHeight;
  camera.updateProjectionMatrix();
  renderer.setSize(window.innerWidth, window.innerHeight);
}

function animate() {
  requestAnimationFrame(animate);
  controls.update();
  render();
}

function render() {
  renderer.render(scene, camera);
}



              
            
!
999px

Console