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.

            
              a.container[href='https://twitter.com/rileyjshaw' target='_blank']

            
          
!
            
              body
	font-size: 0
	background: #eee

.container
	position: absolute
	top: 50%
	left: 50%
	transform: translate3d(-50%, -50%, 0)
	background: #fff
	box-shadow: 0 0 24px 8px rgba(0, 0, 0, 0.2)

            
          
!
            
              const {sin} = Math;
const series = Array.from({length: 4}, (_, i) => (i + 1) * 2);

// Play with these!
const fn = n => series.reduce((a, b) => sin(n / b) + a, 0) / series.length;
const SPEED = 1 / 100;
const COLUMNS = 20;
const PX = 600;
const AMPLITUDE = 18;
const CYCLES = 3;
const TEXT = '@rileyjshaw';

// Derived.
const PX_PER_COLUMN = PX / COLUMNS;
const Y_OFFSET = PX / 2;
const X_SCALE = Math.PI * 2 * CYCLES / COLUMNS;

const container = document.querySelector('.container');
const canvas = document.createElement('canvas');
canvas.height = canvas.width = PX;
canvas.style.height = canvas.style.width = `${PX / 2}px`;
container.appendChild(canvas);

const ctx = canvas.getContext('2d');
ctx.globalCompositeOperation = 'xor';
ctx.font = 'bold 72px "Open Sans", sans-serif'; 
ctx.textAlign = 'center';
ctx.textBaseline = 'middle'; 

(function draw (t) {
	ctx.clearRect(0, 0, PX, PX);
	
	ctx.beginPath();
	ctx.moveTo(0, PX);
	for (let x = 0; x <= COLUMNS; ++x) {
		const xPos = x * PX_PER_COLUMN;
		const yPos = PX - (fn(t * SPEED - x * X_SCALE) * AMPLITUDE + Y_OFFSET);
		ctx.lineTo(xPos, yPos);
	}
	ctx.lineTo(PX, PX);
	ctx.closePath();
	ctx.fill();
	ctx.fillText(TEXT, PX/2, PX/2);
	
	requestAnimationFrame(draw);
})();

            
          
!
999px
Loading ..................

Console