Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

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

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

Behavior

Auto Save

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                  	<div id="wc">
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/01.png" class="whole" id="0">
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/02.png" class="whole" id="1">
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/03.png" class="whole" id="2">
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/04.png" class="whole" id="3">
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/05.png" class="whole" id="4" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/06.png" class="whole" id="5" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/07.png" class="whole" id="6" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/08.png" class="whole" id="7" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/09.png" class="whole" id="8" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/10.png" class="whole" id="9" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/11.png" class="whole" id="10" >
		<img src="https://spin-loyaltyspin.rhcloud.com/SILVERLEAF/SIXFLAGS/PILOT1/full/12.png" class="whole" id="11" >

	</div>

<p>space bar to spin, up and down to increment. console log for degrees</p><p>Greensock animation library...trying to highlight the current win slot...<br>looking for optimizations. The smaller the window, the smoother the animation.<br>Its destined for a 60 inch TV...lower powered device with a chrome browser...<br>Email me at pellmellism@gmail.com - thanks in advance</p>
              
            
!

CSS

              
                	html, body { width:100%; height:100%; overflow:hidden; margin: 0; padding: 0;} /* just to be sure these are full screen*/

#wc{
	position:absolute;
	top:0;
	bottom:0;
	left:calc(50vw - 50vh);
	width:100vh;
	height:100vh;
	/*background-color:red;*/
	z-index:98;
	transform: rotate(0deg);
	
}
.whole{
  	position:absolute;
	top:0;
	bottom:0;
	left:0;
	width:100%;
	height:100%;
  z-index:1000;
}

.full{
	margin:auto;
	position:absolute;
	top: 0; bottom: 0; right: 0;
	width:50%;
	z-index:99;
	transform-origin: 0% 50% 0px;
}
.dull{
	opacity: 0;
	margin:auto;
	position:absolute;
	top: 0; bottom: 0; right: 0;
	width:50%;
	z-index:100;
	transform-origin: 0% 50% 0px;
}

              
            
!

JS

              
                	var wh = document.getElementById("wc");
	var a0 = document.getElementById("0");
	var a1 = document.getElementById("1");
	var a2 = document.getElementById("2");
	var a3 = document.getElementById("3");
	var a4 = document.getElementById("4");
	var a5 = document.getElementById("5");
	var a6 = document.getElementById("6");
	var a7 = document.getElementById("7");
	var a8 = document.getElementById("8");
	var a9 = document.getElementById("9");
	var a10 = document.getElementById("10");
	var a11 = document.getElementById("11");

	

	var nowdeg = 0;
	var myticker = TweenMax.ticker.addEventListener("tick", myFunction);
 
function myFunction(event) {
var v = window.getComputedStyle(wh, null).getPropertyValue("transform").split('(')[1].split(')')[0].split(',');
var angle = Math.round(Math.atan2(v[1], v[0]) * (180/Math.PI));
console.log('Rotate: ' + angle + 'deg');

    switch(true) {
		case angle >= -14 &&  angle <= 14: // 1
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a0, 0, {zIndex:2000});
        break;
		case angle >= -44 &&  angle <= -15: // 2
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a1, 0, {zIndex:2000});
        break;
		case angle >= -74 &&  angle <= -45: // 3
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a2, 0, {zIndex:2000});
        break;
		case angle >= -104 &&  angle <= -75: // 4
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a3, 0, {zIndex:2000});
        break;
		case angle >= -134 &&  angle <= -105: // 5
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a4, 0, {zIndex:2000});
        break;
		case angle >= -164 &&  angle <= -135: // 6
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a5, 0, {zIndex:2000});
        break;
		case angle >= -180 &&  angle <= -165: // 7
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a6, 0, {zIndex:2000});
        break;
		case angle >= 166 &&  angle <= 180: // 7
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a6, 0, {zIndex:2000});
        break;
		case angle >= 136 &&  angle <= 165: // 8
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a7, 0, {zIndex:2000});
        break;
		case angle >= 106 &&  angle <= 135: // 9
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a8, 0, {zIndex:2000});
        break;
		case angle >= 76 &&  angle <= 105: // 10
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a9, 0, {zIndex:2000});
        break;
		case angle >= 46 &&  angle <= 75: // 11
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a10, 0, {zIndex:2000});
        break;
		case angle >= 15 &&  angle <= 45: // 12
			TweenMax.to(".whole", 0, {zIndex:1000});
			TweenMax.to(a11, 0, {zIndex:2000});
        break;

		default: return; // exit this handler for other keys
    }
 }
	
function up(){nowdeg++;}
function dn(){nowdeg--;}
	
	
	
	
	
	
	
	
	
function resetWheel(z){
	//wheel.transition({ rotate: '0deg'}, 0);
	//$('.dull').transition({ opacity: 0.4 }, 1000);
	var thedeg = 0;
	if(z != 0){thedeg = z;}
	TweenMax.to(wh, thedeg, {rotation:0});
}



	
$(document).keydown(function(e) {
    switch(e.which) {
		case 13: // enter key


        break;
		case 32: // space bar	
			TweenMax.to(wh, 6, {rotation:720, delay:0.5, onComplete:resetWheel(0)});
		break;
		case 38: // space bar	
			TweenMax.to(wh, 0.1, {rotation:nowdeg, delay:0, onComplete:up});
		break;
		case 40: // space bar	
			TweenMax.to(wh, 0.1, {rotation:nowdeg, delay:0, onComplete:dn});
		break;
		default: return; // exit this handler for other keys
    }
    e.preventDefault(); // prevent the default action (scroll / move caret)
});
	
              
            
!
999px
If you get tired, be like an AJAX request and REST.

Console