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

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

              
                <body>

    <div id="container"></div>
    <script id="vertexShader" type="x-shader/x-vertex">
        void main() {
            gl_Position = vec4( position, 1.0 );
        }
    </script>
  
  
<script id="fragmentShader1" type="x-shader/x-fragment">
        uniform vec2 u_resolution;
        uniform float u_time;

#define LETTER_RESOLUTION 25

#define DONT_DRAW_INDEX -123.


vec2 random2( vec2 p ) {
    return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453);
}

void polygons (vec2 st, inout vec3 color){
    st *= 10.;
    vec2 i_st = floor(st);
    vec2 f_st = fract(st);
    
    float m_dist = 10.;
    vec2 m_point;
    for (int x=-1; x<=1; x++ ) {
          for (int y=-1; y<=1; y++ ) {
              vec2 neighbor = vec2(float(x),float(y));
              vec2 point = random2(i_st + neighbor);
              point = 0.5 + 0.5*sin(u_time + 6.2831*point);
              vec2 finalPoint = neighbor + point;
              float dist = distance (finalPoint, f_st);

              if( dist < m_dist ) {
                  m_dist = dist;
                  m_point = point;
              }
          }
      }
    // Assign a color using the closest point position
    color += vec3(0.5) + dot(m_point,vec2(.2,.2));
    
    
}


    float circle (vec2 st, float radius, vec2 center, float outlineWidth){
return  smoothstep(radius-outlineWidth, radius+outlineWidth, distance(st, center));    
    }
    
        float circleoutline (vec2 st, float radius, vec2 center, float outlineWidth){
return smoothstep(radius-outlineWidth, radius, distance(st, center)) -  smoothstep(radius, radius+outlineWidth, distance(st, center));    
    }

        float rectangle ( vec2 st, vec2 bottomLeft, vec2 topRight){
        float d = 0.005;
        return 
        smoothstep(bottomLeft.x - d, bottomLeft.x + d, st.x) *
        smoothstep(bottomLeft.y - d, bottomLeft.y + d, st.y) *
        (1.0 - smoothstep(topRight.x - d, topRight.x + d, st.x)) *
         (1.0 - smoothstep(topRight.y - d, topRight.y + d, st.y));
        }

        void letter (vec2 st, vec2 bottomLeft, float charCode[LETTER_RESOLUTION], float rectSize, inout vec3 color){
          float width = sqrt( float(LETTER_RESOLUTION));
          const int total = LETTER_RESOLUTION; //Remember to change parameter/array number as well

          for (int i = 0; i < total; i++){

             float value = charCode[i];
             if (value != DONT_DRAW_INDEX){
             float row = floor (value/width);
             float col = mod (value, width);

             vec2 rectBottomLeft = bottomLeft + vec2( col * rectSize, row * rectSize );
             vec2 rectTopRight = rectBottomLeft + vec2( rectSize , rectSize ) ;

             float rect = rectangle(st, rectBottomLeft, rectTopRight );

             color = mix ( color, vec3(1.0), rect ); 
           }
          }
        }

float random (vec2 st){
    return fract(sin (dot( st.xy, vec2(6424.4347345235, 3434.52347435))) * 3403342.5346453 );
}

        void main() {
            vec2 st = gl_FragCoord.xy  - 0.5 * u_resolution.xy;
            vec2 aspectSpace = 2.0 * st.xy / u_resolution.y;
            vec2 stretchSpace1to1 = 2.0 * st.xy / u_resolution.xy;
            vec2 stretchSpace0to1 = gl_FragCoord.xy/u_resolution.xy;
            
            vec3 bgCol = vec3(0.0);
            
            vec3 color = bgCol;
            
            polygons (stretchSpace0to1, color);
           
           
           color = mix (color, vec3(0.), circle(stretchSpace1to1,  clamp (sin(u_time * 0.1), .75, 1.0   ), vec2(0.), 0.5) * 1.0 );
           
             float A[LETTER_RESOLUTION];
             A[0] = 0.;
             A[1] = 4.;
             A[2] = 5.;
             A[3] = 6.;
             A[4] = 7.;
             A[5] = 8.;
             A[6] = 9.;
             A[7] = 10.;
             A[8] = 14.;
             A[9] = 16.;
             A[10] = 17.;
             A[11] = 18.;
             A[12] = 22.;
             A[13] = DONT_DRAW_INDEX;
             A[14] = DONT_DRAW_INDEX;
             A[15] = DONT_DRAW_INDEX;
             A[16] = DONT_DRAW_INDEX;
             A[17] = DONT_DRAW_INDEX;
             A[18] = DONT_DRAW_INDEX;
             A[19] = DONT_DRAW_INDEX;
             A[20] = DONT_DRAW_INDEX;
             A[21] = DONT_DRAW_INDEX;
             A[22] = DONT_DRAW_INDEX;
             A[23] = DONT_DRAW_INDEX;
             A[24] = DONT_DRAW_INDEX;
             
             float N [LETTER_RESOLUTION];
             N[0] = 0.;
             N[1] = 4.;
             N[2] = 5.;
             N[3] = 8.;
             N[4] = 9.;
             N[5] = 10.;
             N[6] = 12.;
             N[7] = 14.;
             N[8] = 15.;
             N[9] = 16.;
             N[10] = 19.;
             N[11] = 20.;
             N[12] = 24.;
             N[13] = DONT_DRAW_INDEX;
             N[14] = DONT_DRAW_INDEX;
             N[15] = DONT_DRAW_INDEX;
             N[16] = DONT_DRAW_INDEX;
             N[17] = DONT_DRAW_INDEX;
             N[18] = DONT_DRAW_INDEX;
             N[19] = DONT_DRAW_INDEX;
             N[20] = DONT_DRAW_INDEX;
             N[21] = DONT_DRAW_INDEX;
             N[22] = DONT_DRAW_INDEX;
             N[23] = DONT_DRAW_INDEX;
             N[24] = DONT_DRAW_INDEX;

             float T[LETTER_RESOLUTION];
             T[0] = 2.;
             T[1] = 7.;
             T[2] = 12.;
             T[3] = 15.;
             T[4] = 17.;
             T[5] = 19.;
             T[6] = 20.;
             T[7] = 21.;
             T[8] = 22.;
             T[9] = 23.;
             T[10] = 24.;
             T[11] = DONT_DRAW_INDEX;
             T[12] = DONT_DRAW_INDEX;
             T[13] = DONT_DRAW_INDEX;
             T[14] = DONT_DRAW_INDEX;
             T[15] = DONT_DRAW_INDEX;
             T[16] = DONT_DRAW_INDEX;
             T[17] = DONT_DRAW_INDEX;
             T[18] = DONT_DRAW_INDEX;
             T[19] = DONT_DRAW_INDEX;
             T[20] = DONT_DRAW_INDEX;
             T[21] = DONT_DRAW_INDEX;
             T[22] = DONT_DRAW_INDEX;
             T[23] = DONT_DRAW_INDEX;
             T[24] = DONT_DRAW_INDEX;
             
             float H[LETTER_RESOLUTION];
             H[0] = 0.;
             H[1] = 5.;
             H[2] = 10.;
             H[3] = 15.;
             H[4] = 20.;
             H[5] = 4.;
             H[6] = 9.;
             H[7] = 14.;
             H[8] = 19.;
             H[9] = 24.;
             H[10] = 11.;
             H[11] = 12.;
             H[12] = 13.;
             H[13] = 14.;
             H[14] = DONT_DRAW_INDEX;
             H[15] = DONT_DRAW_INDEX;
             H[16] = DONT_DRAW_INDEX;
             H[17] = DONT_DRAW_INDEX;
             H[18] = DONT_DRAW_INDEX;
             H[19] = DONT_DRAW_INDEX;
             H[20] = DONT_DRAW_INDEX;
             H[21] = DONT_DRAW_INDEX;
             H[22] = DONT_DRAW_INDEX;
             H[23] = DONT_DRAW_INDEX;
             H[24] = DONT_DRAW_INDEX;
             
             float O[LETTER_RESOLUTION];
             O[0] = 0.;
             O[1] = 1.;
             O[2] = 2.;
             O[3] = 4.;
             O[4] = 5.;
             O[5] = 10.;
             O[6] = 15.;
             O[7] = 20.;
             O[8] = 21.;
             O[9] = 22.;
             O[10] = 23.;
             O[11] = 24.;
             O[12] = 9.;
             O[13] = 14.;
             O[14] = 19.;
             O[15] = 3.;
             O[16] = DONT_DRAW_INDEX;
             O[17] = DONT_DRAW_INDEX;
             O[18] = DONT_DRAW_INDEX;
             O[19] = DONT_DRAW_INDEX;
             O[20] = DONT_DRAW_INDEX;
             O[21] = DONT_DRAW_INDEX;
             O[22] = DONT_DRAW_INDEX;
             O[23] = DONT_DRAW_INDEX;
             O[24] = DONT_DRAW_INDEX;
             
             float Y[LETTER_RESOLUTION];
             Y[0] = 2.;
             Y[1] = 7.;
             Y[2] = 12.;
             Y[3] = 16.;
             Y[4] = 18.;
             Y[5] = 20.;
             Y[6] = 24.;
             Y[7] = DONT_DRAW_INDEX;
             Y[8] = DONT_DRAW_INDEX;
             Y[9] = DONT_DRAW_INDEX;
             Y[10] = DONT_DRAW_INDEX;
             Y[11] = DONT_DRAW_INDEX;
             Y[12] = DONT_DRAW_INDEX;
             Y[13] = DONT_DRAW_INDEX;
             Y[14] = DONT_DRAW_INDEX;
             Y[15] = DONT_DRAW_INDEX;
             Y[16] = DONT_DRAW_INDEX;
             Y[17] = DONT_DRAW_INDEX;
             Y[18] = DONT_DRAW_INDEX;
             Y[19] = DONT_DRAW_INDEX;
             Y[20] = DONT_DRAW_INDEX;
             Y[21] = DONT_DRAW_INDEX;
             Y[22] = DONT_DRAW_INDEX;
             Y[23] = DONT_DRAW_INDEX;
             Y[24] = DONT_DRAW_INDEX;

             float U[LETTER_RESOLUTION];
             U[0] = 1.;
             U[1] = 2.;
             U[2] = 3.;
             U[3] = 5.;
             U[4] = 10.;
             U[5] = 15.;
             U[6] = 20.;
             U[7] = 9.;
             U[8] = 14.;
             U[9] = 19.;
             U[10] = 24.;
             U[11] = DONT_DRAW_INDEX;
             U[12] = DONT_DRAW_INDEX;
             U[13] = DONT_DRAW_INDEX;
             U[14] = DONT_DRAW_INDEX;
             U[15] = DONT_DRAW_INDEX;
             U[16] = DONT_DRAW_INDEX;
             U[17] = DONT_DRAW_INDEX;
             U[18] = DONT_DRAW_INDEX;
             U[19] = DONT_DRAW_INDEX;
             U[20] = DONT_DRAW_INDEX;
             U[21] = DONT_DRAW_INDEX;
             U[22] = DONT_DRAW_INDEX;
             U[23] = DONT_DRAW_INDEX;
             U[24] = DONT_DRAW_INDEX;
             
    
             
             float rotationMovementX = sin(u_time * 1.)* 0.01;
             float rotationMovementY = cos(u_time * 0.5) * 0.01;
   
          
             float ttStartingX = -0.55;
             float ttSpacingX = 0.55;
             float ttStartingY = -0.15;
             float ttScale = 0.1;

             letter(aspectSpace ,vec2(ttStartingX + rotationMovementX,ttStartingY + rotationMovementY) , A, ttScale, color );
             letter(aspectSpace ,vec2(ttStartingX + ttSpacingX + rotationMovementX,ttStartingY + rotationMovementY), T, ttScale, color );
             
             float btStartingY = -0.45;
             float btStartingX = -0.55;
             float btSpacing = 0.10;
             float btScale = 0.015;
             
             letter(aspectSpace ,vec2(btStartingX + rotationMovementX,btStartingY + rotationMovementY) , A, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 1. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , N, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 2. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , T, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 3. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , H, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 4. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , O, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 5. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , N, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 6. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , Y, btScale, color );
             
             letter(aspectSpace ,vec2(btStartingX + 8. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , T, btScale, color );
             letter(aspectSpace ,vec2(btStartingX + 9. * btSpacing + rotationMovementX, btStartingY + rotationMovementY) , U, btScale, color );
             
            
             gl_FragColor=vec4(color,1.0);
        }
</script>


              
            
!

CSS

              
                body {
  			background-color: #ffffff;
				margin: 0;
				overflow: hidden;

}

.dropdown{
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 1;
}
              
            
!

JS

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

var shaderName = "fragmentShader1";

init();
animate();

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(shaderName).textContent
  });

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

  renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
  renderer.setPixelRatio(window.devicePixelRatio);

  container.appendChild(renderer.domElement);

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

  document.onmousemove = function(e) {
    uniforms.u_mouse.value.x = e.pageX;
    uniforms.u_mouse.value.y = renderer.domElement.height - 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);
  render();
}

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

function dropDownChange(value) {
  mesh.material = new THREE.ShaderMaterial({
    uniforms: uniforms,
    vertexShader: document.getElementById("vertexShader").textContent,
    fragmentShader: document.getElementById(value).textContent
  });
}

              
            
!
999px

Console