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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <div id="frame"></div>
<div id="screen">
 <img src="bim.jpg" data-coord="0,20,1020,9,0.5" alt="mandatory upgrade">
 <img src="r4.gif" data-coord="-1200,0,1000" alt="duplicated">
 <img src="r29.gif" data-coord="700,0,1000" alt="mechanomorphism">
 <img src="r15a.gif" data-coord="-1100,0,900" alt="amniocentetic">
 <img src="r59.gif" data-coord="600,0,500" alt="asphericity">
 <img src="r39a.gif" data-coord="-1000,0,200" alt="onomatopoeia">
 <img src="r65.gif" data-coord="-400,0,150" alt="therianthrope">
 <img src="r39c.gif" data-coord="400,0,150" alt="arboretum">
 <img src="r14.gif" data-coord="1200,0,250" alt="heliotrope">
 <img src="r13.gif" data-coord="0,0,900" alt="">
 <img src="r74.gif" data-coord="-400,0,950" alt="santorum">
 <img src="r74.gif" data-coord="400,0,950" alt="taphephobia">
 <img src="r58c.gif" data-coord="700,0,800" alt="">
 <img src="r58c.gif" data-coord="1100,0,800" alt="">
 <img src="r46a.gif" data-coord="900,220,800" alt="philatelical">
 <img src="r58b.gif" data-coord="900,-20,740" alt="salmagundi">
 <img src="r8.gif" data-coord="-600,0,800" alt="diverticulectomy">
 <img src="r67.gif" data-coord="-750,0,900,0.8" alt="cerebrotonic">
 <img src="r69.gif" data-coord="-900,0,750" alt="compersion">
 <img src="r69.gif" data-coord="-300,0,750" alt="epicaricacy">
 <img src="r72.gif" data-coord="-600,0,600" alt="">
 <img src="r72.gif" data-coord="-620,0,580" alt="endomorphy">
 <img src="r22.gif" data-coord="0,0,600" alt="rhamphorhynchus">
 <img src="r24.gif" data-coord="0,0,400" alt="verisimilitudinous">
 <img src="r62.gif" data-coord="0,700,800" alt="">
 <img src="r62.gif" data-coord="0,700,400" alt="">
 <img src="r62.gif" data-coord="0,700,0" alt="">
 <img src="r60.jpg" data-coord="0,900,1000,3,1" alt="">
 <img src="r60.jpg" data-coord="0,900,600,3,1" alt="">
 <img src="r60.jpg" data-coord="0,900,200,3,1" alt="">
 <img src="r70.gif" data-coord="1100,0,600" alt="lollygagger">
 <img src="r5.gif" data-coord="-1200,300,600" alt="homophilian">
 <img src="r6.gif" data-coord="1200,300,600" alt="bysectamy">
 <img src="r54.gif" data-coord="0,0,100" alt="iterator">
 <img src="r64.gif" data-coord="500,300,100" alt="">
 <img src="r38.gif" data-coord="-900,0,350" alt="protease">
 <img src="r51.gif" data-coord="-600,0,400" alt="gallipot">
 <img src="r52.gif" data-coord="-300,0,250" alt="temerarious">
 <img src="r50a.gif" data-coord="-550,0,300" alt="encyclopedia">
 <img src="r41.gif" data-coord="-400,200,1000" alt="paranoid">
 <img src="r43.gif" data-coord="300,400,1000" alt="emboldened">
 <img src="r48.gif" data-coord="900,0,300" alt="somnambulist">
 <img src="r58b.gif" data-coord="900,-20,250" alt="miraculous">
 <img src="r63.gif" data-coord="-1000,0,300" alt="baglady">
 <img src="r63.gif" data-coord="650,0,320" alt="biometric">
 <img src="r63.gif" data-coord="1000,0,980"     alt="        o                               ">
 <img src="Bush2.gif" data-coord="-300,0,-200"  alt="         \_/\o                          ">
 <img src="Bush2.gif" data-coord="300,0,-200"   alt="        ( Oo)                    \|/    ">
 <img src="Bush2.gif" data-coord="-300,0,-400"  alt="        (_=-)  .===O-  ~~Z~A~P~~ -O-    ">
 <img src="Bush2.gif" data-coord="300,0,-400"   alt="        /   \_/U'                /|\    ">
 <img src="Bush2.gif" data-coord="-300,0,-600"  alt="        ||  |_/                         ">
 <img src="Bush2.gif" data-coord="300,0,-600"   alt="        \\  |                           ">
 <img src="Bush2.gif" data-coord="-300,0,-800"  alt="        {K ||                           ">
 <img src="Bush2.gif" data-coord="300,0,-800"   alt="         | PP                           ">
 <img src="Bush2.gif" data-coord="-300,0,-1000" alt="         | ||                           ">
 <img src="Bush2.gif" data-coord="300,0,-1000"  alt="         (__\\                          ">
</div>
            
          
!
            
              html {
		overflow: hidden;
	}
	body {
		margin: 0px;
		padding: 0px;
		background: #000;
		width: 100%;
		height: 100%;
		cursor: default;
	}
  #frame {
		position:absolute;
		border-top: #111 solid 16vh;
		border-bottom: #111 solid 16vh;
		height: 68vh;
		width: 100vw;
		background:#000;
	}
	#screen {
		position:absolute;
		width: 100%;
		height: 100%;
		overflow: hidden;
		user-select: none;
		transform: translate3d(0, 0, 0);
	}
	#screen img {
		position: absolute;
		visibility: hidden;
		pointer-events: none;
		will-change: transform;
	}
            
          
!
            
              {
	class Image3D {
		constructor(img) {
			const coord = img.getAttribute("data-coord").split(",");
			this.img = img;
			this.img.parent = this;
			this.css = this.img.style;
			this.x = coord[0] * 1.0;
			this.y = -coord[1] * 1.0;
			this.z = coord[2] * 1.0;
			this.sx = (coord[3] || 1) * 1.0;
			this.sy = (coord[4] || this.sx) * 1.0;
			this.w = 0;
			this.h = 0;
			this.ab = 100;
			this.loaded = false;
			this.visible = true;
		}
		load() {
			this.w = this.img.naturalWidth * this.sx;
			this.h = this.img.naturalHeight * this.sy;
			this.css.visibility = "visible";
			this.css.left = -this.w * 0.5 + "px";
			this.css.top = -this.h * 0.5 + "px";
			this.css.width = this.w + "px";
			this.css.height = this.h + "px";
			this.css.zIndex = 5000 - this.z;
			this.loaded = true;
		}
		display() {
			if (!this.loaded) {
				if (this.img.complete) {
					this.load();
				} else return;
			}
			const x = this.x - 2 * (pointer.ex - 0.5 * screenWidth);
			const y = this.y - pointer.ez + screenHeight * 0.5;
			const z = this.z + (-400 + 2500 / screenHeight * pointer.ey - screenHeight);
			const scale = this.z * (250 / (250 + this.z * z));
			const cx = screenWidth * 0.5 + x * scale;
			const cy = screenHeight * 0.5 + y * scale - this.h * scale * 0.5;
			if (
				z > 10 &&
				cx + scale * this.w * 0.5 > 0 &&
				cx - scale * this.w * 0.5 < screenWidth &&
				cy + scale * this.h * 0.5 > 0 &&
				cy - scale * this.h * 0.5 < screenHeight
			) {
				this.visible = true;
				this.css.transform = `matrix(${scale}, 0, 0, ${scale}, ${cx}, ${cy})`;
				const a = Math.max(0, Math.min(100, z));
				if (a != this.ab) {
					this.ab = a;
					this.css.opacity = a / 100;
				}
			} else {
				if (this.visible) {
					this.visible = false;
					this.css.transform = "matrix(0,0,0,0,0,0)";
				}
			}
		}
	}
	// screen size
	const resize = () => {
		screenWidth = screen.offsetWidth;
		screenHeight = screen.offsetHeight;
	};
	// setup pointer
	const pointer = {
		init(screen) {
			this.x = this.ex = screenWidth * 0.5;
			this.y = this.ey = screenHeight * 0.25;
			this.z = this.ez = -screenHeight;
			this.ey *= 0.5;
			window.addEventListener(
				"mousemove",
				e => {
					this.x = e.clientX;
					this.y = e.clientY;
				},
				false
			);
			screen.addEventListener(
				"touchmove",
				e => {
					e.preventDefault();
					this.x = e.targetTouches[0].clientX;
					this.y = e.targetTouches[0].clientY;
				},
				false
			);
			window.addEventListener(
				"wheel",
				e => {
					this.z += e.deltaY * 3;
					this.z = Math.min(screenHeight * 0.5, Math.max(-screenHeight * 2, this.z));
				},
				false
			);
			window.addEventListener("selectstart", e => e.preventDefault(), false);
		},
		ease(n) {
			this.ex += (this.x - this.ex) * n;
			this.ey += (this.y - this.ey) * n;
			this.ez += (this.z - this.ez) * n;
		}
	};
	// init pen
	const screen = document.getElementById("screen");
	let screenWidth = 0, screenHeight = 0;
	window.addEventListener("resize", () => resize(), false);
	resize();
	pointer.init(screen);
	const images = Array.prototype.map.call(
		screen.getElementsByTagName("img"),
		img => {
			return new Image3D(img);
		}
	);
	// animation loop
	const run = () => {
		requestAnimationFrame(run);
		pointer.ease(0.03);
		pointer.z *= 0.97;
		for (let img of images) {
			img.display();
		}
	};
	run();
}

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

Console