cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Equations for Organic Motion

A Pen By Captain Anonymous

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <h1>Equations for Organic Motion - Test Sheet</h1>
<div id="more">
  <span class="arrow">&#8593;</span>
  Resize for more
</div>
            
          
!
            
              
html, body {

    font-family: monospace;
    background: #f2f2f2 url( https://cl.ly/image/381U2k0A3L3S/bg.png );
    overflow: hidden;
    height: 100%;
    margin: 0;
}

h1 {
    background: #111 url( https://cl.ly/image/203T1t3s1P3O/h1.png );
    position: absolute;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 300;
    display: inline;
    padding: 6px 15px 8px 12px;
    opacity: 0.95;
    margin: 0;
    color: #fff;
    left: 0px;
    top: 0px;
}

#more {
    -webkit-transition: top 300ms ease-in-out;
    -moz-transition: top 300ms ease-in-out;
    -ms-transition: top 300ms ease-in-out;
    -o-transition: top 300ms ease-in-out;
    transition: top 300ms ease-in-out;
    background: rgba(0,0,0,0.8);
    text-align: center;
    position: absolute;
    padding: 10px 0;
    margin-left: -60px;
    font-size: 10px;
    width: 120px;
    color: #fff;
    left: 50%;
    top: -100px;
}

#more .arrow {
    font-weight: bold;
    font-size: 24px;
    display: block;
}
            
          
!
            
              
var colours = [
    'FE4365', 'FC9D9A', 'F9CDAD',
    'C8C8A9', '83AF9B', 'FC913A',
    'F9D423', '435356', '566965',
    'FF7373', 'A9DA88', 'E3AAD6',
    '73A8AF', 'F6BCAD', 'BE4C54',
    '7CD7CF', 'FFA446', 'B5D8EB',
    'E05561', 'F4CE79', '77B29C'
];

var pulses = [
    'sin(t)',
    'cos(t)',
    'cos(t)*sin(t)',
    'sin(t)*sin(t*1.5)',
    'sin(tan(cos(t)*1.2))',
    'sin(tan(t)*0.05)',
    'cos(sin(t*3))*sin(t*0.2)',
    'sin(pow(8,sin(t)))',
    'sin(exp(cos(t*0.8))*2)',
    'sin(t-PI*tan(t)*0.01)',
    'pow(sin(t*PI),12)',
    'cos(sin(t)*tan(t*PI)*PI/8)',
    'sin(tan(t)*pow(sin(t),10))',
    'cos(sin(t*3)+t*3)',
    'pow(abs(sin(t*2))*0.6,sin(t*2))*0.6'
];

var Config = {
  UseAbsoluteValues: false
};

var more = document.getElementById( 'more' );

Sketch.create({
    
    setup: function() {

        colours = colours.sort( function() {
            return random() < 0.5 ? -1 : 1;
        });
      
      var gui = new DAT.GUI();
      gui.add( Config, 'UseAbsoluteValues' ).name( 'Use Absolute Values' );
  
    // -----------
    },

    draw: function() {

        this.globalAlpha = 0.5;

        var t = this.millis * 0.0015;

        var rows = 3;
        var cols = 5;
        var minR = 10;
        var maxR = 50;
        var xs = max( maxR * 3, this.width / cols );
        var ys = max( maxR * 3, this.height / rows );
        var x, y, s, f, w, i = 0;
      
        if (!this.cache) {
          this.cache = [];
        }
        var nSteps = 60;

        for ( y = ys * 0.5; y < this.height; y += ys ) {

            for ( x = xs * 0.5; x < this.width; x += xs ) {
                if( !( f = eval( s = pulses[i] ) ) ) break;   
                if (Config.UseAbsoluteValues) f = Math.abs(f);
                var key = ("" + y + "_" + x).replace(/\./g, "_");
                var graph = this.cache[key];
                if (!graph) {
                  graph = this.cache[key] = [];   
                }
                if (graph.length > maxR * 2 * 4) graph.shift();
                graph.push(-f);              
                this.beginPath();
                this.strokeStyle = "#000000;"
                this.moveTo(x - maxR, y + 10 * graph[0]);
                for(var p=1; p<graph.length; p++) {                  
                  this.lineTo(x - maxR + p/4, y + 10 * graph[p]);
                }
                this.stroke();
                  
              
                if (Config.UseAbsoluteValues) {
                  f = minR + (f) * ( maxR - minR );
                }
                else {
                  f = minR + (0.5 + 0.5 * f) * ( maxR - minR );
                }

                this.beginPath();
                this.arc( x, y, f, 0, TWO_PI );
                this.fillStyle = this.strokeStyle = colours[ i % colours.length ];
                this.fill();

                this.font = '10px monospace';

                w = this.measureText( s ).width;

                this.textBaseline = 'top';
                this.fillStyle = '#000';
                this.fillText( s, x - w * 0.5, y + maxR + 10 );

                i++;
            }

            if ( !f ) break;
        }
    },
  
  resize: function() {
      more.style.top = this.height > 450 ? '-100px' : '0px';
  }
});
            
          
!
999px
Loading ..................

Console