Pen Settings



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


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


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.


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.


        <meta charset=utf-8>
        <title>My first Three.js app</title>
            body { margin: 0; }
            canvas { width: 100%; height: 100% }
        <script src=""></script>
          // 建立舞臺
          const scene = new THREE.Scene()
          // 建立相機
          const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 )
          // 建立渲染器
          const renderer = new THREE.WebGLRenderer()
          camera.position.z = 500
          camera.position.x = 150
          camera.position.y = 100
          // 將渲染器加入畫面
          renderer.setSize( window.innerWidth, window.innerHeight )
          document.body.appendChild( renderer.domElement )

          // mesh 為我們後面要加入的 3D 模型
          // 直接調用 scene 下的 add 方法,就可將 模型加入舞臺 
          const geometry = new THREE.BoxBufferGeometry( 100, 100, 100 );
          const material = new THREE.MeshNormalMaterial();
          const mesh = new THREE.Mesh( geometry, material );
          scene.add( mesh )

          // 將舞臺與相機加入渲染器
          renderer.render( scene, camera )