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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

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


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.


                <div id="container"></div>
    <script id="vertexShader" type="x-shader/x-vertex">
        void main() {
            gl_Position = vec4( position, 1.0 );
    <script id="fragmentShader" type="x-shader/x-fragment">
        uniform vec2 u_resolution;
        uniform vec2 u_mouse;
        uniform float u_time;
        float Xor(float a, float b) {
          return a*(1.-b) + b*(1.-a);
        void main() {
            vec2 mv = (u_mouse/u_resolution.xy)*2.;
            vec2 mvi = vec2(mv.x, 1.-mv.y);
            vec2 uv = (gl_FragCoord.xy-.5*u_resolution.xy)/u_resolution.y;
            vec3 col = vec3(0); 
            vec3 color = vec3(0);
            float a = 0.78 + mv.x * mv.y;
            float s = sin(a);
            float c = cos(a);
            uv *= mat2(c, -s, s, c);
            uv *= 20.;
            vec2 gv = fract(uv)-.5;
            vec2 id = floor(uv);
            float m = 0.;
            float t = u_time*.2;
            for(float y=-1.; y<=1.; y++) {
              for(float x=-1.; x<=1.; x++) {
                vec2 offs = vec2(x, y);
                float d = length(gv-offs);
                float dist = length(id+offs)*(mv.x-0.5*mv.y-0.5); 
                float r = mix(.3, 1.5, sin(dist-t)*.5+.5);
                m = Xor(m, smoothstep(r, r*.95, d));
                color = vec3(m*d, m*r, (1.-m*d*r)*mvi.x*mvi.y);
            //col.rg = gv;
            col += color;
            gl_FragColor=vec4(col, 1.0);


                body, html {

#container {
  position: fixed;


                        var container;
        var camera, scene, renderer;
        var uniforms;


        function init() {
            container = document.getElementById( 'container' );

            camera = new THREE.Camera();
            camera.position.z = 1;

            scene = new THREE.Scene();

            var geometry = new THREE.PlaneBufferGeometry( 2, 2 );

            uniforms = {
                u_time: { type: "f", value: 1.0 },
                u_resolution: { type: "v2", value: new THREE.Vector2() },
                u_mouse: { type: "v2", value: new THREE.Vector2() }

            var material = new THREE.ShaderMaterial( {
                uniforms: uniforms,
                vertexShader: document.getElementById( 'vertexShader' ).textContent,
                fragmentShader: document.getElementById( 'fragmentShader' ).textContent
            } );

            var mesh = new THREE.Mesh( geometry, material );
            scene.add( mesh );

            renderer = new THREE.WebGLRenderer();
            renderer.setPixelRatio( window.devicePixelRatio );

            container.appendChild( renderer.domElement );

            window.addEventListener( 'resize', onWindowResize, false );

            document.onmousemove = function(e){
              uniforms.u_mouse.value.x = e.pageX
              uniforms.u_mouse.value.y = e.pageY

        function onWindowResize( event ) {
            renderer.setSize( window.innerWidth, window.innerHeight );
            uniforms.u_resolution.value.x = renderer.domElement.width;
            uniforms.u_resolution.value.y = renderer.domElement.height;

        function animate() {
            requestAnimationFrame( animate );

        function render() {
            uniforms.u_time.value += 0.05;
            renderer.render( scene, camera );