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

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

HTML

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

      <a-assets>    
          
        <!-- 3Dモデルデータ -->
        <a-asset-item id="woman-obj" src="https://rawcdn.githack.com/mrdoob/three.js/fda056fa11113c7254bfb732fb9fb7a5d38266da/examples/models/obj/female02/female02.obj"></a-asset-item>
        <!-- マテリアルデータ -->
        <a-asset-item id="woman-mtl" src="https://rawcdn.githack.com/mrdoob/three.js/fda056fa11113c7254bfb732fb9fb7a5d38266da/examples/models/obj/female02/female02.mtl"></a-asset-item>
          
      </a-assets>
         
      <a-camera look-controls-enabled="false">
      </a-camera> 
       
      <!-- 3Dモデル -->
      <a-entity id="womanObj" obj-model="obj: #woman-obj; mtl: #woman-mtl" scale="0.01 0.01 0.01" position="0 0.75 -1.2" rotation="0 0 0"></a-entity>  
      
      <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="#00ffff"></a-sky>
        
    </a-scene>      
  </body>
</html>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  border: 0;
}

body {
  background: #fdf;
  font: 30px sans-serif;
}
              
            
!

JS

              
                // forked from siouxcitizen's "A-Frame Practice 14 Texture on Sphere" http://jsdo.it/siouxcitizen/M5O6
//A-Frameをためしてみました
//
//objファイル形式の3Dモデルを表示してみました
//3DモデルはThree.jsのサンプルに使用されていたものです
//表示だけならThree.jsのものより簡単にできる気がします(最後にThree.js触ったの1年以上前ですが。。。)
//
//
//以下サイトを参考にさせて頂きました 
//
//HTMLタグで本格VRコンテンツが作れる! 
//https://ics.media/entry/13401
//
//Blenderで出力したUVメッシュ付きobjファイルをA-Frameで読み込む方法
//http://vr-lab.voyagegroup.com/entry/2016/10/19/202650
//
//
//以下自分のコードを参考にしました
//
//Three.js r72 でOBJファイル形式3Dモデルを表示その2(WebGL使用)
//http://jsdo.it/siouxcitizen/SHo1
//

var sceneEl;

var obj3DModel;

var isMouseDown = false;

function init() {

    sceneEl = document.querySelector("a-scene");
    obj3DModel = sceneEl.querySelector("#womanObj"); 
    
    // マウス、タッチ処理を呼び出すイベントリスナーをセット
    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() {
  
    requestAnimationFrame(render);
    
}

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

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

// マウスを離したとき
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