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

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

              
                <!-- Made with http://infamous.io -->
<script src="//unpkg.com/infamous@21.0.6/global.js"></script>
<script src="//unpkg.com/vue@2.5.11/dist/vue.js"></script>

<script type="text/x-template" vue>
    <!-- Lights and shadows are powered by WebGL, but written with HTML: -->
    <i-scene
        experimental-webgl="true"
        id="scene"
        style="perspective: 800px"
        shadowmap-type="pcfsoft"
        >

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

            <i-node
                id="button-container"
                position="0 0 6"
                size="600 31 0"
                align="0.5 0.5 0"
                mount-point="0.5 0.5 0"
                >
                <i-dom-plane
                    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`"
                    color="#333"
                    >
                    <button>button {{n+1}}</button>
                </i-dom-plane>
            </i-node>

            <i-point-light
                id="light"
                color="white"
                position="300 300 120"
                size="0 0 0"
                cast-shadow="true"
                intensity="0.5"
                >
                <i-mesh
                    has="sphere-geometry basic-material"
                    size="10 10 10"
                    color="white"
                    receive-shadow="false"
                    cast-shadow="false"
                    style="pointer-events: none"
                    >
                </i-mesh>
            </i-point-light>

        </i-dom-plane>
    </i-scene>
</script>

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

              
            
!

CSS

              
                /* made with http://infamous.io */

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

i-node
    text-align center

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

#bg
    background bg-color

button
    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%)
              
            
!

JS

              
                // made with http://infamous.io

// defines the default names for the HTML elements
infamous.html.useDefaultNames()

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) {
            console.log('move!')
            e.preventDefault()
            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( e.target, 'button' ) ) {

                pressedButton = e.target

                if (upTween) {
                    upTween.stop()
                    upTween = null
                }

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

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

            }
        })

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

                if (downTween) {
                    downTween.stop()
                    downTween = null
                }

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

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

            }
        })

        // 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
            })

            document.querySelector('#bg')
                .threeObject3d.material.opacity = 0.3
            document.querySelector('#bg')
                .threeObject3d.material.dithering = true

            scene._needsToBeRendered()
        }, 0)

        function is( el, selector ) {
            if ( [].includes.call(
                document.querySelectorAll( selector ),
                el
            ) ) return true
            return false
        }
    },
})
              
            
!
999px

Console