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

              
                
<html>
  <!--

https://www.youtube.com/watch?v=NN0-cg2_k-4

    (c) Copyright 2020 Warwick Molloy, Lokel Digital Pty Ltd
    Available for use under the MIT License
  -->
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

    <script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
    <script src="https://www.lokeldigital.com/shared-code/a-frame/onclick.js"></script>

    <!-- Environment component -->
    <script src="https://unpkg.com/aframe-environment-component@1.1.0/dist/aframe-environment-component.min.js"></script>

    <script>
      function posForEl(el) {
        let pos = el.object3D.position
        return `${pos.x} ${pos.y} ${pos.z}`
      }

      function moveTo(thing) {
        let camRig = document.querySelector('#camera-rig')
        camRig.setAttribute('animation', `property: position; from: ${posForEl(camRig)};to: ${posForEl(this)};dur: 1000`)
      }
    </script>
  </head>

<body>
  <a-scene>

    <a-assets>
      <!-- Shapes -->
      <a-mixin id="ball" geometry="primitive: sphere;radius:1"></a-mixin>
      <a-mixin id="bigball" geometry="primitive: sphere;radius:1.5"></a-mixin>
      <a-mixin id="cube" geometry="primitive: box; width: 2; depth:2; height: 2"></a-mixin>
      <a-mixin id="longbox" geometry="primitive: box; width: 2; depth:4; height: 2"></a-mixin>

      <!-- Positions -->
      <a-mixin id="fleft" position="-5 1 -5"></a-mixin>
      <a-mixin id="mid" position="-1 1 0"></a-mixin>
      <a-mixin id="nright" position="2.5 1.5 2.5"></a-mixin>
      <a-mixin id="nleft" position="-5 3 3"></a-mixin>
      <a-mixin id="box-fright" position="3 1 -4"></a-mixin>
      <a-mixin id="box-nleft" position="-5 1 3"></a-mixin>

      <!-- Behaviour -->
      <a-mixin id="clickable" onclick="moveTo"></a-mixin>
      <a-mixin id="bouncy"
        animation__bounceup="property: position; from: 0 0 0; to: 0 1 0; easing: easeInOutQuad; dur: 500; start-events: click, animationcomplete__bouncedown"
        animation__bouncedown="property: position; from: 0 1 0; to: 0 0 0; easing: easeInOutQuad; dur: 500; start-events: animationcomplete__bounceup"
      ></a-mixin>

      <!-- Colors -->
      <a-mixin id="orange" material="color: orange"></a-mixin>
      <a-mixin id="red" material="color: red"></a-mixin>
    </a-assets>

    <!-- Obstacles -->
    <a-entity id="fright-obs" mixin="red longbox box-fright"></a-entity>
    <a-entity id="nleft-obs" mixin="red box-nleft cube"></a-entity>

    <!-- Spheres -->
    <!--- f = far back ball --->
   <a-entity  id="fleft-ball" mixin="fleft clickable">
      <a-entity mixin="orange ball bouncy"></a-entity>
    </a-entity>

    <a-entity  id="mid-ball" mixin="mid clickable">
      <a-entity  mixin="orange ball bouncy"></a-entity>
    </a-entity>

    <a-entity  id="nleft-ball" mixin="nleft clickable">
      <a-entity  mixin="orange ball bouncy"></a-entity>
    </a-entity>

    <a-entity  id="nright-ball" mixin="nright clickable">
      <a-entity  mixin="orange bigball bouncy">                 

</a-entity>
    </a-entity>

    <!-- Camera Rig -->
    <a-entity id="camera-rig" position="0 1 3">
      <a-entity camera look-controls position="0 0 4" cursor="ray-origin: mouse" raycaster="objects: [geometry]"></a-entity>
    </a-entity>

    <a-entity environment></a-entity>

  </a-scene>
</body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console