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. 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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!DOCTYPE html>
<html>
  <head>
    <title>Hello, WebVR! - A-Frame</title>
    <meta name="description" content="Hello, WebVR! - A-Frame">
    <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
  </head>
  <body>
    <a-scene vr-mode-ui="enabled: false">

      <a-camera look-controls-enabled="false">
      </a-camera>
        
      <a-torus 
          id = "torus00"
          position="0 1 -4" 
          segments-radial="50" 
          segments-tubular="200"              
          radius="2.5"
          radius-tubular="0.025"  
          color="#FF00FF">
      </a-torus> 
        
      <a-torus 
          id = "torus01"
          position="0 1 -4" 
          segments-radial="50" 
          segments-tubular="200"              
          radius="2" 
          radius-tubular="0.05"  
          color="#FF0000">
      </a-torus> 
        
      <a-torus 
          id = "torus02"
          position="0 1 -4" 
          segments-radial="50" 
          segments-tubular="200"              
          radius="1.5" 
          radius-tubular="0.075"  
          color="#00FF00">
      </a-torus> 
 
      <a-torus 
          id = "torus03"
          position="0 1 -4" 
          segments-radial="50" 
          segments-tubular="200"              
          radius="1" 
          radius-tubular="0.1"  
          color="#0000FF">
      </a-torus> 
      
      <a-torus 
          id = "torus04"
          position="0 1 -4" 
          segments-radial="50" 
          segments-tubular="200"              
          radius="0.5" 
          radius-tubular="0.125"  
          color="#FFFF00">
      </a-torus> 
        
      <a-light 
          type="directional"
          color="#FFF"
          intensity="0.5"
          position="-1 1 2">
      </a-light>  
        
      <a-light
          type="ambient"
          color="#888888">
      </a-light>
        
      <a-sky color="#ECECEC"></a-sky>
        
    </a-scene>      
  </body>
</html>
            
          
!
            
              * {
  margin: 0;
  padding: 0;
  border: 0;
}

body {
  background: #fdf;
  font: 30px sans-serif;
}
            
          
!
            
              // forked from siouxcitizen's "A-Frame Practice 09 複数Torusを表示してみました " http://jsdo.it/siouxcitizen/UQkI
//A-Frameをためしてみました
//
//カメラを固定 & VRボタンを非表示にしてみました 
//ますますVRっぽくなくなってますが。。。
//
//参考サイト
//
//A FRAMEの使い方
//https://github.com/katsube/neec2017A/wiki/A-FRAME%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9
//
//

var sceneEl;

var torus00;
var torus01;
var torus02;
var torus03;
var box01;

var t = 0;

var isMouseDown = false;

function init() {

    sceneEl = document.querySelector("a-scene");
    torus00 = sceneEl.querySelector("#torus00"); //外枠のTorusは回転させない
    torus01 = sceneEl.querySelector("#torus01");
    torus02 = sceneEl.querySelector("#torus02");
    torus03 = sceneEl.querySelector("#torus03");
    torus04 = sceneEl.querySelector("#torus04");
    
    // マウス、タッチ処理を呼び出すイベントリスナーをセット
    document.addEventListener("mousedown", onMouseDown);
    document.addEventListener("touchstart", onMouseDown);
    document.addEventListener("mouseup", onMouseUp);
    document.addEventListener("touchend", onMouseUp);
    document.addEventListener("mousemove", onMouseMove);
    document.addEventListener("touchmove", onMouseMove);

}

function render() {

    t += 0.01;
    
    requestAnimationFrame(render);
    //torus.setAttribute("position", "0 "+(Math.sin(t*2)+1)+" -3");
    
}

// マウスを押したとき
function onMouseDown(event) {
    isMouseDown = true;
}

// マウスを動かした時
function onMouseMove(event) {
    if (isMouseDown) {
        // 3DモデルをX軸とY軸方向に回転させます
        if ( torus00 )            
		    torus00.setAttribute("rotation", (getMouseY(event)*-2)+" " + (getMouseY(event)*-2) + " -3");
        
        if ( torus01 )            
		    torus01.setAttribute("rotation", (getMouseX(event)*2)+" "+(getMouseY(event)*2)+" -3");

        if ( torus02 ) 
		    torus02.setAttribute("rotation", (getMouseY(event)*2)+" "+(getMouseX(event)*2)+" -3");
        
        if ( torus03 ) 
		    torus03.setAttribute("rotation", (getMouseX(event)*2)+" -3 "+(getMouseX(event)*2)); 
        
        if ( torus04 ) 
		    torus04.setAttribute("rotation", (getMouseY(event)*2)+" -3 "+(getMouseY(event)*2));   
       
    }
}

// マウスを離したとき
function onMouseUp(event) {
    isMouseDown = false;
}

function getMouseX(event) {
    if (event.type.indexOf("touch") == -1)
        return event.clientX;
    else
        return event.touches[0].clientX;
}

function getMouseY(event) {
    if (event.type.indexOf("touch") == -1)
        return event.clientY;
    else
        return event.touches[0].clientY;
}

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


            
          
!
999px

Console