Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm 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. We'll also process your JavaScript with Babel.

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

Code Indentation


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.

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.

              <!-- Made with -->
<script src="//"></script>
<script src="//"></script>

<script type="text/x-template" vue>
    <!-- Lights and shadows are powered by WebGL, but written with HTML: -->
        style="perspective: 800px"

        <i-ambient-light color="#404040" intensity="1"></i-ambient-light>

        <i-dom-plane id="bg" size-mode="proportional proportional" size="1 1 0" color="#333">

                position="0 0 6"
                size="600 31 0"
                align="0.5 0.5 0"
                mount-point="0.5 0.5 0"
                    v-for="n in [0,1,2,3,4]"
                    size-mode="literal proportional"
                    size="100 1 0"
                    :align="`${n*0.25} 0 0`"
                    :mount-point="`${n*0.25} 0 0`"
                    <button>button {{n+1}}</button>

                position="300 300 120"
                size="0 0 0"
                    has="sphere-geometry basic-material"
                    size="10 10 10"
                    style="pointer-events: none"


<div id="root"></div>

              /* made with */

body, html
    width 100%
    height 100%
    margin 0
    padding 0
    font-family sans-serif
    touch-action none

    text-align center

button-color = #FB752C
bg-color = #62B997

    background bg-color

    width 100%
    height 100%
    white-space nowrap
    border-radius 0px
    border 1px solid darken(button-color, 50%)
    background lighten(button-color, 20%)
    color darken(button-color, 50%)
    outline none // remove those darn ugly browser-specific outlines
    &:focus, &:hover
        background darken(button-color, 10%)
        color darken(button-color, 75%)
        border-color darken(button-color, 60%)
              // made with

// defines the default names for the HTML elements

new Vue({
    el: '#root',
    template: document.querySelector('[vue]').innerHTML,
    mounted: function() {
        var plane = document.querySelector('#bg')
        // plane.size = (x,y,z,t) => [x, Math.abs(Math.sin(t/1000)), z]

        var light = document.querySelector('#light')
        light.threeObject3d.shadow.radius = 0
        light.threeObject3d.distance = 800
        light.threeObject3d.shadow.bias = -0.0001

        // prevent default touch actions so we can move the light with touch
        document.querySelector('html').setAttribute('touch-action', 'none')
        document.querySelector('body').setAttribute('touch-action', 'none')

        document.addEventListener('pointermove', function(e) {
            light.position.x = e.clientX
            light.position.y = e.clientY

        var Motor = infamous.core.Motor
        var downTween, upTween, pressedButton

        // On mouse down animate the button downward
        document.addEventListener('pointerdown', function(e) {
            if ( is(, 'button' ) ) {

                pressedButton =

                if (upTween) {
                    upTween = null

                downTween = new TWEEN.Tween(
                    .to({z: -6}, 75)
                    .onComplete(function () { downTween = null })

                Motor.addRenderTask(function(time) {
                    if (!downTween) return false


        // On mouse up animate the button upward
        document.addEventListener('pointerup', function(e) {
            if ( pressedButton ) {

                if (downTween) {
                    downTween = null

                upTween = new TWEEN.Tween(pressedButton.parentNode.position)
                    .to({z: 0}, 75)
                    .onComplete(function() { upTween = null })

                Motor.addRenderTask(function(time) {
                    if (!upTween) return false


        // The following is a temporary hack because opacity isn't
        // exposed through the HTML API yet. work-in-progress...
        var scene = document.querySelector('#scene')
        setTimeout(function() {
            Array.from( document.querySelectorAll('i-dom-plane') ).forEach(function(n) {
                n.threeObject3d.material.opacity = 0.3

                .threeObject3d.material.opacity = 0.3
                .threeObject3d.material.dithering = true

        }, 0)

        function is( el, selector ) {
            if ( []
                document.querySelectorAll( selector ),
            ) ) return true
            return false
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.