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

              
                svg(viewBox='0 0 2000 2000')
	mask#m
		rect(width='100%' height='100%' fill='#fff')
		ellipse(cx=1000 cy=730 rx=250 ry=310)
	path#s(ini=`M855 1425c-35-49-100-70-170-70-98 0-328 95-328 295l0 0c0 39 19 192 200 192c250 0 340-205 340-305v-1070c125 90 425 230 425 470c0 190-110 290-210 400l23 25c95-75 241-265 241-450c0-425-395-485-485-805h-35z` 
			 fin=`M1265 1085c0 435-150 545-290 545-145 0-190-105-215-180l-320 50c65 265 225 395 565 395c397 0 597-380 597-835v-130c0-390-135-775-620-775-390 0-570 265-570 575l0 0c0 355 200 555 500 555c135 0 295-48 355-198h0z`)
              
            
!

CSS

              
                body {
	display: flex;
	margin: 0;
	height: 100vh;
	background: url(http://www.blirk.net/wallpapers/1920x1080/music-wallpaper-33.jpg) 100% 50%/ cover #999;
	background-blend-mode: screen
}

svg { flex: 1 }

[id='s'] { mask: url(#m) }
              
            
!

JS

              
                const DATA = {
				p: {
					_el: document.querySelector('path'),
					att: {}
				},
				e: {
					_el: document.querySelector('ellipse'),
					att: {}
				}
			}, 
			RE = /\s+|[a-z]/g,
			NF = 40 /* total number of frames for transition */, 
      TFN = { /* timing functions */
        'ease-in-out': function(k) {
          return .5*(Math.sin((k - .5)*Math.PI) + 1)
        },
        'bounce-ini-fin': function(k, s = -.675*Math.PI, e = -s) {
          return (Math.sin(k*(e - s) + s) - Math.sin(s))/(Math.sin(e) - Math.sin(s))
        }
      };

let dir = -1, rID = null, cf = 0, m;

function extractStr(el, attr = 'ini') {
	const SEP_RE = /(\d)\-/g;
	
	return el.getAttribute(attr).slice(1, -1)
					 .replace(SEP_RE, '$1 -');
};

function extractPts(str) {
	return str.split(RE).map(c => +c)
};

function extractSep(str) {
	return str.match(RE)
};

function range(ini, fin) {
	return (typeof ini == 'number') ? 
					fin - ini : 
					ini.map((c, i) => range(ini[i], fin[i]))
};

function int(ini, rng, tfn, k, cnt) {
	return (typeof ini == 'number') ? 
					+(ini + cnt*(m + dir*tfn(m + dir*k))*rng).toFixed(2) : 
					ini.map((c, i) => int(ini[i], rng[i], tfn, k, cnt))
};

function stopAni() {
  cancelAnimationFrame(rID);
  rID = null;  
};

function update() {
	cf += dir;
	
  let k = cf/NF;
	
	for(let e in DATA) {
		for(let p in DATA[e].att) {
			let o = DATA[e].att[p];
			
			DATA[e]._el.setAttribute(...[
				p, 
				o.afn(int(o.ini, o.rng, TFN[o.tfn], k, o.cnt ? dir : 1), o.sep)
			]);
		}
	}
  
  if(!(cf%NF)) {
    stopAni();
    return
  }
  
  rID = requestAnimationFrame(update)
};

(function init() {
	const INI_STR = extractStr(DATA.p._el);
	
	DATA.p.att.d = {
		sep: extractSep(INI_STR),
		ini: extractPts(INI_STR), 
		fin: extractPts(extractStr(DATA.p._el, 'fin')),
		afn: function(pts, sep) {
			return pts.reduce((a, c, i) => a + c + (sep[i] || 'z'), 'M')
		},
		tfn: 'bounce-ini-fin'
	};
	
	['rx', 'ry', 'opacity'].forEach(c => {
		DATA.e.att[c] = {
			ini: 0, 
			fin: DATA.e._el.getAttribute(c) || 1,
			afn: i => i,
			tfn: 'ease-in-out'
		}
	});
	
	for(let e in DATA) {
		for(let p in DATA[e].att) {
			let o = DATA[e].att[p];
			
			o.rng = range(o.ini, o.fin);
			DATA[e]._el.setAttribute(p, o.afn(o.ini, o.sep))
		}
	}
	
	addEventListener('click', e => {
		if(rID) stopAni();
		dir *= -1;
		m = .5*(1 - dir);
		update();
	}, false);
})();
              
            
!
999px

Console