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="wrapper">
	<div class="stage">
		<div class="poster">
			<div class="wheel">
				<h1 class="txt">Linear</h1>
			</div>
			<div class="content">
				<h2 class="title"> Progress</h2>
				<p class="desc">The Path Is Not Linear but Circular and Continuous</p>
			</div>
			<div class="poster__base2">
			</div>
			<div class="poster__base1">
			</div>
		</div>
	</div>
</div>


              
            
!

CSS

              
                @import url('https://rsms.me/inter/inter.css');

html { 
	font-family: 'Inter', sans-serif;
}
@supports (font-variation-settings: normal) {
	html { 
		font-family: 'Inter var', sans-serif; 
		font-style: normal;
		font-weight: 100 900;
		-webkit-font-smoothing: antialiased;
    	-moz-osx-font-smoothing: grayscale;
	}
}

:root {
	--fontSize: 120px;
	--borderW: 20px;
}

html {
	box-sizing: border-box;
}
*,
*:before,
*:after {
	box-sizing: inherit;
}

body,
html {
	height: 100%;
	width: 100%;
	margin: 0;
	padding: 0;
}

body {
	background: #C4CACE;
	color: white;
	overflow: hidden;
	::selection {
		background: transparent;
	}
}

.wrapper {
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	perspective: 1400px;
}

.stage {
	padding: 20px;
	transform-style: preserve-3d;
}

.poster {
	position: relative;
	height: calc(var(--fontSize)*8);
	width: calc(var(--fontSize)*6);
	transform-style: preserve-3d;
	visibility: hidden;
	opacity: 0;
	background: white;
	overflow: hidden;
	perspective: 700px;
	cursor: pointer;
	box-shadow: 
		0 20px 40px -15px rgba(0,0,0,0.3),
		0 40px 50px -20px rgba(0,0,0,0.3),
		0 70px 60px -30px rgba(0,0,0,0.1),
		0 40px 70px -5px rgba(0,0,0,0.1);
}

.poster__base1 {
	position: absolute;
	z-index: 2;
	top: var(--borderW);
	left: var(--borderW);
	width: calc(100% - calc(2*var(--borderW)));
	height: calc(100% - calc(2*var(--borderW)));
	background: black;
	display: flex;
	align-items: center;
	justify-content: center;
}

.poster__base2 {
	position: absolute;
	z-index: 1;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: white;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wheel {
	position: relative;
	z-index: 3;
	top: calc(-1 * var(--fontSize)/2.5);
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
}

.txt {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	margin: 0;
	font-size: var(--fontSize);
	font-weight: 900;
	font-stretch: 50%;
	text-transform: uppercase;
	transform-style: preserve-3d;
	line-height: 1;
	white-space: nowrap;
	letter-spacing: -5px;
}

.char {
	transform-style: preserve-3d;
	/* standard gradient background */
	background: linear-gradient(white 20%, black 80%);
	/* clip hackery */
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
}

.content {
	position: absolute;
	z-index: 3;
	bottom: 0;
	width: 100%;
	height: 150px;
	padding: var(--borderW);
	transform-style: preserve-3d;
}

.title {
	margin: 0;
	text-transform: uppercase;
	text-align: center;
	font-weight: 900;
	font-size: 24px;
	letter-spacing: 20px;
	padding-left: 10px;
}

.desc {
	text-transform: uppercase;
	text-align: center;
	font-weight: 600;
	font-size: 11px;
	letter-spacing: 1px;
	color: #0090FF;
	margin-top: 24px;
	padding-right: 10px;
	transform-style: preserve-3d;
}
              
            
!

JS

              
                console.clear();

gsap.registerPlugin(SplitText);

select = e => document.querySelector(e);

let fontSize = gsap.getProperty(':root', '--fontSize');
let txt = select('.txt');
let wheel = select('.wheel');
let poster = select('.poster');
let numLines = 20;
let radius = (fontSize/(numLines/2))/Math.sin((180/numLines)*(Math.PI/180)); 
let angle = 360/numLines;
let origin = `0% 50% -${radius*2}px`;
let master = gsap.timeline();


function cloneTxt() {
	for (i=0; i<numLines-1; i++) {
		var clone = txt.cloneNode(true);
		wheel.appendChild(clone);
	}
}

function positionTxt() {
	gsap.set(wheel, {
		rotation: -90,
		rotationX: 0,
		rotationY: 0
	});
	gsap.set('.txt', {
		rotationX: function(index) {
			return angle*index;
		},
		z: radius*2,
		transformOrigin: origin
	});
	gsap.set('.char', {
		rotateX: -90,
		transformOrigin: "50% 50%"
	});
}

function animateIn() {
	let tl = gsap.timeline({delay: 0});
		tl.from('.char', {
			scale: 0.01,
			y: 440,
			duration: 8,
			rotation: 90,
			ease: 'power4.inOut'
		}, 0)
		.from('.txt', {
			rotationX: -180,
			duration: 12,
			ease: 'power4'
		}, 0)
		.from('.txt', {
			x: 100,
			duration: 8,
			ease: 'power4',
			stagger: 0.2
		}, 0)
		.from(wheel, {
			rotationY: 180,
			z: -2000,
			ease: 'expo',
			duration: 12
		}, 0)
		.from('.titleChar', {
			y: 'random(-20 20)',
			opacity: 0,
			duration: 4,
			stagger: {
				each: 0.05,
				from: "center"
			},
			ease: "expo",
		}, 1)
		.from('.desc', {
			y: 30,
			opacity: 0,
			duration: 4,
			ease: "power4"
		}, 1.5)
	
	return tl;
}

function rotate() {
	let tl = gsap.timeline();
	tl.to(wheel, {
		rotationX: 360,
		transformOrigin: "50% 50%",
		repeat: -1,
		ease: 'none',
		duration: 12
	});
	
	return tl;
}

function resize() {
	let vh = window.innerHeight;
	let sh = poster.offsetHeight;
	let scaleFactor = vh/sh;
	if(scaleFactor<1) {
		gsap.set(poster, { scale: scaleFactor });
	}
    else {
        gsap.set(poster, { scale: 1 });
    }
}

function init() {
	let linearText = new SplitText(txt, {type:"chars", charsClass:"char", position: "relative" }); 
	let titleText = new SplitText('.title', {type:"chars", charsClass:"titleChar", position: "relative" }); 
	gsap.set(poster, { autoAlpha: 1 });
	cloneTxt();
	positionTxt();
	master.add(animateIn())
		  .add(rotate(), 0);
	poster.onclick = () => {
		master.restart();
    }
	resize();
}

function calcOffset(xPos, yPos) {
	let winW = window.innerWidth;
	let winH = window.innerHeight;
	let dX = 2*(xPos - winW/2)/winW;
	let dY = -2*(yPos - winH/2)/winH;
	return [dX,dY];
}

function rotateTxt(xPos, yPos) {
	let nPos = calcOffset(xPos, yPos); // get cursor position from center 1-0-1
	let nX = nPos[0];
	let nY = nPos[1];
	let invertedRangeX = 1-Math.sqrt(nX*nX); // 0-1-0
	let invertedRangeY = 1-Math.sqrt(nY*nY); // 0-1-0
	gsap.to('.stage', {
		rotationX: nPos[1]*5,
		rotationY: nX*5,
		// rotation: nX*40,
		duration: 1,
		ease: 'sine'
	});
}

var pointer = { 
	x: window.innerWidth  / 2, 
	y: window.innerHeight / 2 
};

window.addEventListener("mousemove", function(event) {
	pointer.x = event.clientX;
	pointer.y = event.clientY;
	rotateTxt(pointer.x, pointer.y);
});

window.onresize = resize;

window.onload = () => {
	init();
};

              
            
!
999px

Console