Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 600 600" >
<defs>
	<circle id="outer" fill="none" stroke="#D17454" stroke-width="12" stroke-miterlimit="10" cx="293" cy="278.7" r="138"/>
<path id="waterfall" fill="#7EE7F9" d="M338.5,116.9c8.5,0,7.3,3.9,15.8,7.3c4.9,1.9,12.2,1.8,16,6.5c3.2,3.9,1.9,10.4,2.6,17
	c1,9.7,7.1,34.4,9.3,63.4c1.6,20.7-0.6,43.7,0.9,64.2c2.7,35.3,13.6,32.4,8.7,64c-2.8,18.2-11.6,11.4-30.5,22.1
	c-9.1,5.2-19.4,13.4-33.5,15.5c-10.7,1.6-22.9-2.2-36.7-4.3c-12.1-1.8-23.6,0.1-33.1-2.1c-12.7-2.9-22.2-9.7-30.6-12.5
	c-21.4-7.2-29.4,5.1-32.6-11c-6.2-31.6,5.7-28.9,7.7-64.6c1.2-20.5-1.6-43.5-0.6-64.5c1.3-27.3,6.3-51.5,6.3-64.2
	c0.6-7.8-1.2-14.9,1.5-19.6c3.8-6.5,11.6-7.6,16.8-9.9c9.6-4.2,8.5-7.3,18.2-7c15.6,0.4,15.5,4,31.1,4c15.6,0,15.5-3.3,31.1-4
	C322.9,116.2,322.9,116.9,338.5,116.9z"/>
  
  <clipPath id="mainMask">
    <use xlink:href="#outer"/>
    </clipPath>
  <clipPath id="waterfallMask">
    <use xlink:href="#waterfall"/>
    </clipPath>  
<circle id="foam" cx="180" cy="333.7" r="17.7"/> 
<linearGradient id="mainShadowGrad" gradientUnits="userSpaceOnUse" x1="589.3363" y1="515.8959" x2="306.3363" y2="273.896">
	<stop  offset="0.3" style="stop-color:#263448;stop-opacity:0"/>
	<stop  offset="1" style="stop-color:#172534"/>
</linearGradient>
<radialGradient id="bgGrad" cx="300" cy="300" r="300" gradientUnits="userSpaceOnUse">
	<stop  offset="0.2" style="stop-color:#2A394E"/>
	<stop  offset="1" style="stop-color:#1D293B"/>
</radialGradient>  
</defs>

<rect id="bgGrad" fill="url(#bgGrad)" width="600" height="600"/>  
<polygon id="shadow" fill="url(#mainShadowGrad)" points="188.8,395 385.6,153.4 599.5,303 591.5,585 421,589 "/>  
	<circle class="outer" fill="#F5E9C1" cx="293" cy="278.7" r="156"/>  

<g class="mainGroup" clip-path="url(#mainMask)">  
<path class="land" fill="#957660" d="M464,372H124c0,0,0-151,0-189.3c28.3-28.3,340,0,340,0V432.8z"/>
<path class="landShadow" fill="#74584A" d="M511,450H65c0,0,0-151,0-189.3c180,53.4,347-23.4,446,0C511,377.8,511,507.8,511,507.8
	z"/>
<use xlink:href="#waterfall"/>

  <g class="rippleMasked" clip-path="url(#waterfallMask)">
<path class="ripple" fill="#6ADFF7" d="M557.5,108c-23.8,0-36.6-6.8-46.9-12.4c-8.3-4.4-14.3-7.6-28.1-7.6s-19.8,3.2-28.1,7.6
	c-10.3,5.5-23.2,12.4-46.9,12.4s-36.6-6.8-46.9-12.4c-8.3-4.4-14.3-7.6-28.1-7.6s-19.8,3.2-28.1,7.6c-10.3,5.5-23.2,12.4-46.9,12.4
	c-23.7,0-36.8-6.8-47.2-12.4C202,91.2,196,88,182,88V48c24,0,36.8,6.8,47.2,12.4c8.3,4.4,14.5,7.6,28.2,7.6
	c13.7,0,19.8-3.2,28.1-7.6c10.3-5.5,23.2-12.4,46.9-12.4c23.8,0,36.6,6.8,46.9,12.4c8.3,4.4,14.3,7.6,28.1,7.6
	c13.8,0,19.8-3.2,28.1-7.6c10.3-5.5,23.2-12.4,46.9-12.4s36.6,6.8,46.9,12.4c8.3,4.4,14.3,7.6,28.1,7.6s19.5-3.2,27.8-7.6
	C595.7,54.8,609,48,632,48v40c-13,0-19.5,3.2-27.8,7.6C593.8,101.2,581.2,108,557.5,108z"/>
  
  <!--circle cx="220" cy="200" r="2" fill="none" stroke="#FFF"/-->
  </g>
    </g>
  
 
  <g class="maskedFoam" clip-path="url(#mainMask)">
  <g class="whiteFoamGroup">

    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
  </g>    
  <g class="lightBlueFoamGroup">

    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
  </g> 
  <g class="darkBlueFoamGroup">

    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
  </g>  
  </g>
<g class="badgeGroup">

	<circle class="inner" fill="none" stroke="#D17454" stroke-width="12" stroke-miterlimit="10" cx="293" cy="278.7" r="138"/>
</g>  
<g class="splashGroup">

    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
    <use xlink:href="#foam"/>
     
  </g>  
</svg>

 
              
            
!

CSS

              
                body{
  background-color:#1D293B;
  overflow:hidden;
  text-align:center;
}
body, html {
    height: 100%;
    width: 100%;
    margin: 0;
   padding: 0;
}


svg{
  width:100%;
  height:100%;
  visibility:hidden;
}

              
            
!

JS

              
                var xmlns="http://www.w3.org/2000/svg", select = function(s) {
      return document.querySelector(s);
    }, selectAll = function(s) {
      return document.querySelectorAll(s);
    },  ripple = select('.ripple'), whiteFoamGroup = selectAll('.whiteFoamGroup use'), lightBlueFoamGroup = selectAll('.lightBlueFoamGroup use'),darkBlueFoamGroup = selectAll('.darkBlueFoamGroup use'),splashGroup = selectAll('.splashGroup use')

var forEach = function (array, callback, scope) {
  for (var i = 0; i < array.length; i++) {
    callback.call(scope, i, array[i]); // passes back stuff we need
  }
};

//center the container cos it's pretty an' that


TweenMax.set(splashGroup, {
  transformOrigin:'50% 50%',
  fill:'#FFF'
})

var foamTl = new TimelineMax({repeat:-1, yoyo:true, repeatDelay:1});

var rippleTl = new TimelineMax({repeat:-1, onRepeat:changeRipple});
rippleTl.to(ripple, 2.7, {
  y:320,
  x:-225,
  ease:Linear.easeNone
})

animateFoam(whiteFoamGroup,'#FFF', [-5, 1], 0.6 )
animateFoam(lightBlueFoamGroup,'#7EE7F9', [28, 40], 2 )
animateFoam(darkBlueFoamGroup,'#52E1F1', [63, 73], 3 )
foamTl.timeScale(1)
var myTimeline = new TimelineMax({repeat:-1, repeatDelay:1});
myTimeline.timeScale(6)
myTimeline.add(foamTl, 0);
myTimeline.add(rippleTl, 0);



function animateFoam(el, col, range, scaleMax){
  forEach(el, function(e, c){
  var initScale = Math.random() + scaleMax;
  TweenMax.set(c, {
    x:e * 23,
    scale:initScale,
    y:randomBetween(range[0], range[1]),
    transformOrigin:'50% 50%',
    fill:col
  })
  var t = new TimelineMax({repeat:-1, yoyo:true});
  t.to(c, Math.random()*3 + 3, {
    scale:2,
    ease:Sine.easeInOut
  })
  .to(c, Math.random() * 3 + 3, {
    scale:initScale,
    ease:Sine.easeInOut
  })
  
  foamTl.add(t, e/100)
})  
  
}

forEach(splashGroup, makeSplash);

function makeSplash(i, p, posX){
  
  //console.log(posX)
  if(!posX){
    var posX =  randomBetween(-10, 240);
  }

  //console.log(e, p)
  var angle = randomBetween(-134, 0);
  var vel = randomBetween(10, 50);
  var tl = new TimelineMax({repeat:0, onComplete:changeSplashPosX, onCompleteParams:[p]});
  
  tl.set(p, {
    scale:randomBetween(0.1, 1.6)/10,
    y:-30,
    x:posX
  })
  .to(p, randomBetween(12, 16), { 
    scale:0,
  physics2D:{
    velocity:vel, 
    angle:angle, 
    acceleration:angle, 
    gravity:12, 
    accelerationAngle:angle
  }
})
  

  tl.timeScale(myTimeline.timeScale())
  p.id = i;
}

function changeSplashPosX(p){

  makeSplash(p.id, p,  randomBetween(-10, 240))

}

function changeRipple(){
  
  if(ripple.getAttribute('fill') == '#98E9FA'){
    ripple.setAttribute('fill', '#6ADFF7')
  } else{
    ripple.setAttribute('fill', '#98E9FA')
    
  }
}

function randomBetween(min,max)
{
    return Math.floor(Math.random()*(max-min+1)+min);
}

TweenMax.set('svg', {
  visibility:'visible'
})

              
            
!
999px

Console