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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Rotating wheels</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div id="main">
	<!--<img id="image" class="fit" src="https://source.unsplash.com/random">-->
	<div id="frame" class="fit">
		<div id="struc">
			<div id="A1" class="LA">
				<div class="inner">A</div>
			</div>
			<div id="B1" class="LB">
				<div class="inner">B</div>
			</div>
			<div id="C1" class="LC">
				<div class="inner">C</div>
			</div>
			<div id="D1" class="LD">
				<div class="inner">D</div>
			</div>
			<div id="E1" class="LE">
				<div class="inner">E</div>
			</div>
			<div id="F1" class="LF">
				<div class="inner">F</div>
			</div>
			<div id="G1" class="LG">
				<div class="inner">G</div>
			</div>
			<div id="H1" class="LH">
				<div class="inner">H</div>
			</div>
			<div id="I1" class="LI">
				<div class="inner">I</div>
			</div>
			<div id="J1" class="LJ">
				<div class="inner">J</div>
			</div>		

			
			
		</div>
	</div>
	<span id="credit">Photo sourced from <a href="https://unsplash.com/">Unsplash.com</a></span>
</div>
  <script src='jslib/sizzle.js'></script>
<script src='jslib/TweenMax.min.js'></script>
<script src='jslib/CustomEase.min.js'></script>
<script src='jslib/ofi.js'></script>
<script src='js/oqxjox.j1s'></script>
<script  src="js/index.js"></script>



</body>

</html>

              
            
!

CSS

              
                /*ramka */
#frame {
	z-index: 2;
	width: 90%;
	height: 120%;
	border: 6px solid rgba(222, 233, 255, 0.9);
	color: rgb(15, 9, 33);
	background-color: rgba(222, 233, 255, 0.8);
	box-shadow:	inset 0 0 30px rgba(15, 9, 33, 0.3), 0 0 18px rgba(222, 233, 255, 0.6);
	overflow: hidden;
}

#struc {
	position: relative;
	width: 20vw;
	height: 20vw;
}

#frame, .inner, #A1, #B1, #C1, #D1, #E1, #F1, #G1, #H1, #I1, #J1 {
	display: flex;
	justify-content: center;
	align-items: center;
}

#A1, #B1, #C1, #D1, #E1, #F1, #G1, #H1, #I1, #J1 {
	position: absolute;
	top: 0;
	left: 0px;
	width: 100px;
	height: 100px;
	border-radius: 100%;
	box-shadow: inset 0 0 1px rgb(255, 88, 222);
}


.inner {
	width: 100%;
	height: 100%;
	border-radius: 100%;
	font-size: 1.2em;
	font-weight: bold;
}

#A1 > .inner {
	transform: rotate(270deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#B1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#C1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#D1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#E1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#F1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#G1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#H1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#I1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}
#J1 > .inner {
	transform: rotate(0deg);
	background-image: linear-gradient(to right, #c246e2, #6d8ceb);
}

/* Prep */

body { height: 100vh; width: 100vw; margin: 0; }

#main {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	color: rgba(222, 233, 255, 0.8);
	background-color: rgb(15, 9, 33);
	font-family: "Trebuchet MS", "Lucida Sans Unicode", "Tahoma", sans-serif;
}

.fit {
	position: absolute;
	top: 0; right: 0; bottom: 0; left: 0;
	margin: auto;
}

#image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	font-family: 'object-fit: cover;';
	opacity: 0.4;
	filter: blur(4px);
}

#credit {
	position: absolute;
	bottom: -1em;
	right: -1em;
	padding: 0.5em 1.7em 1.5em 0.7em;
	border-radius: 0.5em;
	background-color: rgba(15, 9, 33, 0.8);
	text-align: right;
}

#credit > a {
	color: rgba(222, 233, 255, 0.8) !important;
}
              
            
!

JS

              
                console.clear();
objectFitImages();
var ff = false;
const S = Sizzle,
		struct = S('#struc')[0];

let canRotate = false;

window.addEventListener('keydown', e => {
	if ( canRotate ) {
		switch ( e.key ) {
			case '1':
				//makeTL(true, false);
				makeTLL();
				break;
			case '2':
				makeTL(true, true);
				break;
			case '3':
				makeTL(false, false);
				break;
			case '4':
				makeTL(false, true);
				break;
		}
	}
});



TweenLite.set(S('.LA')[0], {rotation: 0, transformOrigin: '100% 100%'});
TweenLite.set(S('.LB')[0], {rotation: 90, transformOrigin: '100% 100%'});
TweenLite.set(S('.LC')[0], {rotation: 270, transformOrigin: '100% 100%'});
TweenLite.set(S('.LD')[0], {rotation: 180, transformOrigin: '100% 100%'});

TweenLite.set(S('.LE')[0], {y: 100});
TweenLite.set(S('.LE')[0], {rotation: -90, transformOrigin: '-100% 0%'});
TweenLite.set(S('.LF')[0], {rotation: -90, transformOrigin: '-100% 100%'});

TweenLite.set(S('.LG')[0], {y: 100});
TweenLite.set(S('.LG')[0], {rotation: -180, transformOrigin: '-100% 0%'});
TweenLite.set(S('.LH')[0], {rotation: -180, transformOrigin: '-100% 100%'});

TweenLite.set(S('.LI')[0], {y: 100});
TweenLite.set(S('.LI')[0], {rotation: -270, transformOrigin: '-100% 0%'});
TweenLite.set(S('.LJ')[0], {rotation: -270, transformOrigin: '-100% 100%'});

canRotate = true;



// This is what rotates the wheels every time

function makeTL(isLeft, isCW) {
	// We want to prevent another rotation from starting before this one is finished
	canRotate = false;
//TweenLite.set(S('.LA')[0], {x:90, transformOrigin: '-100% 0%'});
//TweenLite.set(S('.LB')[0], {rotation: 90, transformOrigin: '100% 100%'});
	
	
	// Get the elements we want to rotate and the direction; note how the timeline switches canRotate back to true when it ends
	const r = isCW ? '+=90' : '-=90',
			top = S(isLeft ? '.LA' : '.LA')[0],		
			left = S(isLeft ? '.LB' : '.LB')[0],			
			right = S(isLeft ? '.LC' : '.LC')[0],
			bottom = S(isLeft ? '.LD' : '.LD')[0],
			bottom1 = S(isLeft ? '.LE' : '.LE')[0],
			bottom2 = S(isLeft ? '.LF' : '.LF')[0],		
			bottomG = S(isLeft ? '.LG' : '.LG')[0],		
			bottomH = S(isLeft ? '.LH' : '.LH')[0],		
			bottomI = S(isLeft ? '.LI' : '.LI')[0],		
			bottomJ = S(isLeft ? '.LJ' : '.LJ')[0],					
		   tl = new TimelineLite({onComplete: () => { canRotate = true; }});
	
	// We need to set the transform origin of the center element depending on which wheel we're rotating
	//TweenLite.set(S('.C')[0], {transformOrigin: ( isLeft ? '-100%' : '100%' ) + ' 0%'});
	
	// Then, just rotate all 4 elements in the set direction, and change the class names for next time
	tl.to(top, 0.3, {rotation: r})
		.to(left, 0.3, {rotation: r}, 0)	
		.to(right, 0.3, {rotation: r}, 0)
		.to(bottom, 0.3, {rotation: r}, 0)
		.to(bottom1, 0.3, {rotation: r}, 0)
		.to(bottom2, 0.3, {rotation: r}, 0)		
		.to(bottomG, 0.3, {rotation: r}, 0)		
		.to(bottomH, 0.3, {rotation: r}, 0)		
		.to(bottomI, 0.3, {rotation: r}, 0)		
		.to(bottomJ, 0.3, {rotation: r}, 0)				
		//.set(top, {className: isLeft ? ( isCW ? 'C' : 'LL' ) : ( isCW ? 'RR' : 'C' )})
		//.set(left, {className: isLeft ? ( isCW ? 'LT' : 'LB' ) : ( isCW ? 'RT' : 'RB' )})
		//.set(right, {className: isLeft ? ( isCW ? 'LB' : 'LT' ) : ( isCW ? 'RB' : 'RT' )})
		//.set(bottom, {className: isLeft ? ( isCW ? 'LL' : 'C' ) : ( isCW ? 'C' : 'RR' )});
}



function makeTLL() {
	// We want to prevent another rotation from starting before this one is finished
	canRotate = false;
//TweenLite.set(S('.LA')[0], {x:90, transformOrigin: '-100% 0%'});
//TweenLite.set(S('.LB')[0], {rotation: 90, transformOrigin: '100% 100%'});
	
if (ff==false)
{
let la = S('.LA')[0], lf = S('.LF')[0], lh = S('.LH')[0], lj = S('.LJ')[0], lc=S('.LC');

TweenLite.set([la, lf, lh, lj], {x: 0, y: 0, transformOrigin: '-100% 100%'});
TweenLite.set(lf, {rotation: -90});
TweenLite.set(lh, {rotation: -180});
TweenLite.set(lj, {rotation: -270});
TweenLite.set(lc, {x: 100, y:0});
TweenLite.set([lc], {transformOrigin: '-100% 100%'});
TweenLite.set(lc, {rotation: 0});
		
}	
	// Get the elements we want to rotate and the direction; note how the timeline switches canRotate back to true when it ends
	const r = '-=90',
			top = S('.LA')[0],		
			right = S('.LC')[0],
			bottom1 = S('.LE')[0],
			bottom2 = S('.LF')[0],		
			bottomG = S('.LG')[0],		
			bottomH = S('.LH')[0],		
			bottomI = S('.LI')[0],		
			bottomJ = S('.LJ')[0],					
		   tl = new TimelineLite({onComplete: () => { canRotate = true; }});
	
	// We need to set the transform origin of the center element depending on which wheel we're rotating
	//TweenLite.set(S('.C')[0], {transformOrigin: ( isLeft ? '-100%' : '100%' ) + ' 0%'});
	
	// Then, just rotate all 4 elements in the set direction, and change the class names for next time
	tl.to(top, 0.3, {rotation: r})
		.to(right, 0.3, {rotation: r}, 0)
		.to(bottom1, 0.3, {rotation: r}, 0)
		.to(bottom2, 0.3, {rotation: r}, 0)		
		.to(bottomG, 0.3, {rotation: r}, 0)		
		.to(bottomH, 0.3, {rotation: r}, 0)		
		.to(bottomI, 0.3, {rotation: r}, 0)		
		.to(bottomJ, 0.3, {rotation: r}, 0)				
		//.set(top, {className: isLeft ? ( isCW ? 'C' : 'LL' ) : ( isCW ? 'RR' : 'C' )})
		//.set(left, {className: isLeft ? ( isCW ? 'LT' : 'LB' ) : ( isCW ? 'RT' : 'RB' )})
		//.set(right, {className: isLeft ? ( isCW ? 'LB' : 'LT' ) : ( isCW ? 'RB' : 'RT' )})
		//.set(bottom, {className: isLeft ? ( isCW ? 'LL' : 'C' ) : ( isCW ? 'C' : 'RR' )});
ff = true;		
		
}
              
            
!
999px

Console