Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

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


Auto Save

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.


  <h1>Understanding Waves</h1>
    void main() {
      float interval = u_resolution.x * 0.04;
      vec2 uv = gl_FragCoord.xy / interval;
      // Wave forms
      // gradient moving downwards
      // dot adds 0. to 1. intervals to each uv.x coord
      float phase1 = dot(uv, vec2(0.00, 1.00)) + u_time * 1.338;

      // gradient moving left and down
      float py2t = 0.112 * sin(u_time * 0.378);
      float phase2 = dot(uv, vec2(0.09, py2t)) + u_time * 0.566;

      // Parallel lines moving according to wave forms
      float pt = phase1 + sin(phase2) * 3.0;
      pt = abs(fract(pt) - 0.5) * interval * 0.5;

      // Gradient shift to contract lines
        Using dot on the uv with a fixed vec2 will return the distance between
        the two vectors. Eg if you drew a line across the middle of the uv grid,
        the each pixel will be given a value of how far it is from that line. This
        gives a gradient across the uv space.
        eg dot(uv, vec2(0., 1.)) will give a 45deg gradient
        Need to work out where the width comes from
      float linewidth = dot(uv, vec2(0.08, 0.11)) + u_time * 0.5;
      float lw = 2.3 + sin(linewidth) * 1.9; // min + expanded sin
      vec3 col = vec3(clamp(lw - pt, 0., 1.));
      gl_FragColor = vec4(col, 1.);
  <p>View HTML for comments. Based on <a href="">waves.glsl</></p>