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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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 src=""></script>

      <script id="vertexShader" type="x-shader/x-vertex">
          void main() {
              gl_Position = vec4( position, 1.0 );
      <script id="fragmentShader" type="x-shader/x-fragment">
#ifdef GL_ES
precision mediump float;

#extension GL_OES_standard_derivatives : enable

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
      float noise(vec2 p) {
        return fract(sin(p.x*45.11+p.y*97.23)*878.73+733.17)*2.0-1.0;


void main( void ){
    vec2 uv = (gl_FragCoord.xy * 2.0 - resolution.xy) / min(resolution.x, resolution.y);
    vec2 fMosaicScal = vec2(2.0,20.0);
    vec2 vScreenSize = vec2(resolution.x,resolution.y);
    vec4 o = gl_FragColor;    
    vec3 u = normalize(vec3(2.0*gl_FragCoord.xy-resolution.xy,resolution.xy.x))*1.2;
    u.x = floor(u.x * vScreenSize.x / fMosaicScal.x) / (vScreenSize.x / fMosaicScal.x);
    u.y = floor(u.y * vScreenSize.y / fMosaicScal.y) / (vScreenSize.y / fMosaicScal.y);
    u.z = floor(u.z * vScreenSize.y / fMosaicScal.y) / (vScreenSize.y / fMosaicScal.y);     
    for(float i=0.;i<4.;i++){

	gl_FragColor = o;



          padding: 0;
          margin: 0;


                      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 = {
                  time: { type: "f", value: 1.0 },
                  resolution: { 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 );


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

          function animate() {
              requestAnimationFrame( animate );

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