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 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

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

              
                <div class="background"></div>
<canvas></canvas>

<h1>diS pLace</h1>

<p>
	dedicated to Amsterdam,<br>a place that didn't love me back<br><br>Vincent, 30/8/18
</p>

<a class="license" rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/"><img alt="Creative Commons License" src="https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png" /></a>
              
            
!

CSS

              
                html, body {
	width: 100%;
	height: 100%;	
}

.background {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	
	background-image: url(https://res.cloudinary.com/dzckyfkls/image/upload/v1535629192/profile-512.jpg);
	background-size: cover;
	background-position: 50% 50%;
	background-repeat: no-repeat;
	
	filter: blur(5px);
}

canvas {
	display: block;
	width: 612px;
	height: 612px;
	
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	margin: auto;
}

h1, p {
	position: absolute;
	font-size: 1.2rem;
	padding: 0.3rem 1rem;
	font-family: 'VT323';
	color: white;
	text-shadow: 2px 2px 0 black;
}

h1 {
	top: 0;
	left: 0;
}

p {
	bottom: 0;
	right: 0;
	text-align: right;	
}

.license {
	position: absolute;
	left: 1rem;
	bottom: 1rem;
}
              
            
!

JS

              
                /* 
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
 */ 

// TLDR If you steal it without credit you're an asshole, but a welcome one :shrug:
// CC applies to resulting visual product, 'cause thats me face sis

// Coded on Thu 30/8/2018, Vincent
const canvas = document.querySelector('canvas')
const ctx = canvas.getContext('2d')

const uCanvas = document.createElement('canvas')
const uCtx = uCanvas.getContext('2d')

canvas.width = canvas.height = uCanvas.width = uCanvas.height = 612
const offset = 50

const W = 512 //cause i say so

const img = new Image()
img.src = 'https://res.cloudinary.com/dzckyfkls/image/upload/v1535629192/profile-512.jpg'
img.onload = start

const data = {displacement: 0}

function start() {
	TweenMax.to(data, 60, {
		displacement: 500, 
		ease: Sine.easeIn,
		repeat: -1,
		yoyo: true
	})
	
	loop()
}

function draw() {
	ctx.drawImage(uCanvas, 0, 0)
}

function update() {
	const d = data.displacement * Math.random()
	
	displaceH(img, uCtx, offset, d, d)
	displaceV(uCanvas, uCtx, 0, d, d)
}

function loop() {
	draw()
	update()
	requestAnimationFrame(loop)
}

function displaceH(img, ctx, offset, amount, slices) {
	const sliceSize = W / slices
	
	arrayGen(slices)
		.forEach(i => {
			const destX = amount * (i % 2 ? 1 : -1) + offset
			const destY = sliceSize * i + offset

			ctx.drawImage(img, 
				0, sliceSize * i, //src clip coords
				W, sliceSize, //src clip size
				destX, destY, // dest coords
				W, sliceSize) //dest size
		})
}

function displaceV(img, ctx, offset, amount, slices) {
	const sliceSize = W / slices
	
	arrayGen(slices)
		.forEach(i => {
			const destX = sliceSize * i + offset
			const destY = amount * (i % 2 ? -1 : 1) + offset

			ctx.drawImage(img, 
				sliceSize * i, 0, //src clip coords
				sliceSize, W, //src clip size
				destX, destY, // dest coords
				sliceSize, W) //dest size
		})
}

function arrayGen(n) {
	const a = []
	
	//I could shuffle here but now I'm sleepy.
	for (let i = 0; i < n; i++) {
		a.push(i)	 
	}
	
	return knuthShuffle(a)
}
              
            
!
999px

Console