(function () {
    'use strict';

    var scene = new THREE.Scene();
    var camera = new THREE.PerspectiveCamera( 45, window.innerWidth/window.innerHeight, 0.1, 1000 );

    var renderer = new THREE.WebGLRenderer({
        alpha : true
    });
    renderer.setSize( window.innerWidth, window.innerHeight );
    renderer.setPixelRatio((window.devicePixelRatio || 1) * 2);


    var splash = document.querySelector('.splash');
    splash.appendChild( renderer.domElement );

    // set up lights
    var light = new THREE.AmbientLight( 0x404040 ); // soft white light
    scene.add( light );
    scene.fog = new THREE.Fog(0x242528, 0, 10);

    // generate plane
    var geometry = generateSimplexPlaneGeometry();
    var material = new THREE.MeshBasicMaterial( {morphTargets: true, color: 0xffffff, wireframe: true, side: THREE.DoubleSide } );
    var plane = new THREE.Mesh( geometry, material );

    var morphGeometry = generateSimplexPlaneGeometry();
    var vertices = [];
    for(var i = 0; i < morphGeometry.vertices.length; i++) {
        vertices.push(morphGeometry.vertices[i].clone());
    }
    geometry.morphTargets.push({ name: "targetFoo", vertices: vertices });
    plane.updateMorphTargets();

    scene.add( plane );

    var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
    directionalLight.position.set( 0, 1, 0 );
    scene.add( directionalLight );

    plane.scale.x = 6.0;
    plane.scale.z = 6.0;
    plane.scale.multiplyScalar(2);

    camera.position.z = 7;
    camera.position.y = 2;

    var step = 0.001;
    render();

    function generateSimplexPlaneGeometry() {
        var width = 128;
        var height = 128;
        var geometry = new THREE.PlaneGeometry( 1, 1, width-1, height-1 );
        geometry.lookAt( new THREE.Vector3(0, 1, 0) );

        var simplex = new SimplexNoise();
        for( var i = 0; i < width; i++) {
            for( var j = 0; j < height; j++) {

                // generate noise
                var n = 0;
                var level = 3;
                n += (simplex.noise(i/level, j/level)/2 + 0.5) * 0.125;
                level *= 3;
                n += (simplex.noise(i/level, j/level)/2 + 0.5) * 0.25;
                level *= 2;
                n += (simplex.noise(i/level, j/level)/2 + 0.5) * 0.5;
                level *= 2;
                n += simplex.noise(i/level, j/level)/2 + 0.5;
                n /= 1+0.5+0.25+0.125;

                var v = geometry.vertices[i * width + j];
                v.y = n;
            }
        }
        return geometry;
    }

    function render() {
        requestAnimationFrame( render );

        var current = plane.morphTargetInfluences[0];

        if (current > 1.0) {
            step = -0.001;
        } else if (current <= 0.0) {
            step = 0.001;
        }

        plane.morphTargetInfluences[0] += step;

        renderer.render(scene, camera);
    }
})();

@@ -160,24 +160,89 @@
 1, 1000 );%0A%0A
+    window.addEventListener( 'resize', onWindowResize, false );%0A%0A
     var rend
@@ -2961,15 +2961,226 @@
 );%0A    %7D
+%0A%0A    function onWindowResize() %7B%0A        camera.aspect = window.innerWidth / window.innerHeight;%0A        camera.updateProjectionMatrix();%0A        renderer.setSize( window.innerWidth, window.innerHeight );%0A    %7D
 %0A%7D)();%0A

add the autoresize to the 3d plane