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

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.

            
              
<svg version="1.1" id="wave1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                 width="1200px" height="200px" viewBox="0 0 1200 200" enable-background="new 0 0 1200 200" xml:space="preserve">
                <g>
                    <path class="wave" fill="#00779b" d="M0,0" />
                    <path class="wave2" fill="rgba(80,200,235,.6)" d="M0,0" />
                </g>
            </svg>
<svg class="duck" version="1.1" id="Selected_Items" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
	 y="0px" width="550px" height="400px" viewBox="0 0 550 400" enable-background="new 0 0 550 400" xml:space="preserve">
<g>
	<path fill-rule="evenodd" clip-rule="evenodd" fill="#FEFE00" d="M133.45,136.5c2.033-0.967,3.05-2.633,3.05-5
		c-0.033-15-4.05-28-12.05-39c0-0.333,0.017-0.667,0.05-1c1.367-9.4-0.983-15.067-7.05-17c0-0.333,0-0.667,0-1
		c6.533-30.8,26.517-48.3,59.95-52.5c0.033,0,0.05-0.167,0.05-0.5c7,0,14,0,21,0c0.333,0,0.667,0,1,0
		c24.333,3.667,41.883,14.067,52.65,31.2c3.767,6,6.35,12.7,7.75,20.1c5.533,29,1.4,51.567-12.4,67.7c0.667,1,1.4,1.55,2.2,1.65
		c19.467,2.667,37.367,0.05,53.7-7.85c5.334-2.6,9.617-6.167,12.851-10.7c8.133-11.434,18.217-20.8,30.25-28.1
		c1.8-0.467,3.017-0.467,3.649,0c24.7,16.533,39.667,42.833,44.9,78.9c4.033,28,1.75,52.466-6.85,73.4
		c-8.834,21.434-22.084,38.434-39.75,51C331.033,310.2,309,317.566,282.3,319.9c-61.566,5.399-113.383-0.917-155.45-18.95
		c-31.667-13.566-46.467-43.717-44.4-90.45c3.9-30.767,19.417-50.267,46.55-58.5c0.5-0.133,1.083-0.533,1.75-1.2
		c0.667-0.667,1.567-1.1,2.7-1.3c0-4,0-8,0-12C133.45,137.167,133.45,136.833,133.45,136.5z M193.45,90.5
		c-0.333,0-0.65-0.05-0.95-0.15c-11.367-4.067-19.05-1.35-23.05,8.15c0,0.333-0.017,0.667-0.05,1c-0.5,6.867,0.85,11.867,4.05,15
		c0.333,0,0.633,0.067,0.9,0.2c8.3,4.466,15.667,3.733,22.1-2.2c0-0.333,0.05-0.65,0.15-0.95
		C199.8,103.283,198.75,96.267,193.45,90.5z"/>
	<path fill-rule="evenodd" clip-rule="evenodd" fill="#0B0B00" d="M193.45,90.5c5.3,5.767,6.35,12.783,3.15,21.05
		c-0.1,0.3-0.15,0.617-0.15,0.95c-6.434,5.933-13.8,6.667-22.1,2.2c-0.267-0.133-0.567-0.2-0.9-0.2c-3.2-3.133-4.55-8.133-4.05-15
		c0.033-0.333,0.05-0.667,0.05-1c4-9.5,11.683-12.217,23.05-8.15C192.8,90.45,193.117,90.5,193.45,90.5z"/>
	<path fill-rule="evenodd" clip-rule="evenodd" fill="#FF8D10" d="M133.45,136.5c-0.333,0-0.667-0.017-1-0.05
		c-31.667-4.633-52.667-19.95-63-45.95c0-0.333,0-0.667,0-1c0-1,0-2,0-3c7.433-3.167,15.767-4.483,25-3.95
		c11,0.633,18.667-2.05,23-8.05c6.066,1.933,8.417,7.6,7.05,17c-0.033,0.333-0.05,0.667-0.05,1c8,11,12.017,24,12.05,39
		C136.5,133.867,135.483,135.533,133.45,136.5z"/>
</g>
</svg>

            
          
!
            
              body {  
    background:#11252f;
}
svg {
  display:table;
}
.duck {
  position:absolute;
  width:150px;
  top:-50px;
  left:45%;
  z-index:6;
}
            
          
!
            
              var maintl;

(function() {

    maintl = new TimelineMax({repeat:-1});

    var width= 1220;
    var height= 200;
    var increments = 50;
    var incrementSize = width/increments;
    var speed = .2;

    var props = {};
    props.var1 = 0;
    props.var2 = -10;
    props.var3 = 50;
    props.var4 = -15;
    props.var5 = 10;
    props.var6 = 3;

    var path;
    var path2;

    maintl.add("frame0", 0)
        .add(TweenMax.delayedCall(speed, updatePath))
        .seek(0);


    function updatePath() {
        path = "M";
        path2 = "M";
        path += "-10,"+height*.5;
        path2 += "-10,"+height*.5;

        var points = [];
        var points2 = [];
        var i;
        for(i = -1; i<increments+2; i++) {
            points[i] = {};
            points2[i] = {};
            points[i].x = i*incrementSize;
            points2[i].x = i*incrementSize;

            var variant1 = (Math.sin(i *.14+props.var1)*9);
            var variant2 = (Math.cos(i *.2+props.var2)*13)-9;
            var variant3 = (Math.cos(i * .15+props.var3)*10)-5;
            var variant4 = (Math.sin(i *.25+props.var4)*8)-3;
            var variant5 = (Math.cos(i *.21+props.var5)*6)-5;
            var variant6 = (Math.cos(i *.17+props.var6)*11)-7;

            points[i].y = height*.5 + variant4 - variant5 + variant6;
            points2[i].y = height*.5 + variant1 - variant2 + variant3;
          
          if (i == 25) {
            var rotate = 1;
            if (points[i-1].y < points[i].y) {
              rotate = -1;
            }
             TweenMax.to(jQuery('.duck'), speed, {rotation:"+="+rotate,y:points[i].y-150, ease:Power0.easeNone});
          }
        }

        for (i = 0; i<increments+2; i++ ) {
            var anchor1 = {};
            anchor1.x = (points[i-1].x + points[i].x) * .5;
            anchor1.y = (points[i-1].y + points[i].y) * .5;
            path +="Q"+points[i-1].x+","+points[i-1].y+" "+anchor1.x+","+anchor1.y;

            var anchor2 = {};
            anchor2.x = (points2[i-1].x + points2[i].x) * .5;
            anchor2.y = (points2[i-1].y + points2[i].y) * .5;
            path2 +="Q"+points2[i-1].x+","+points2[i-1].y+" "+anchor2.x+","+anchor2.y;
        }

        path += "L"+width+","+height+"L-10,"+height;
        path2 += "L"+width+","+height+"L-10,"+height;



        TweenMax.set(props, {var1:"+="+.8*speed, var2:"+="+1.4*speed, var3:"-="+1.2*speed, var4:"+="+.8*speed, var5:"+="+1.4*speed, var6:"-="+1.3*speed},"frame0");
        TweenMax.to('.wave', speed, {morphSVG:{d:path}, ease:Power0.easeNone}, "frame0");
        TweenMax.to('.wave2', speed, {morphSVG:{d:path2}, ease:Power0.easeNone}, "frame0");

    }
    updatePath();

})();
            
          
!
999px
Loading ..................

Console