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.

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.

HTML

              
                <div id="nav">
  <div id="slider"></div>
  <div class="navBtn" id="playBtn">play</div>
  <div class="navBtn" id="pauseBtn">pause</div>
  <div class="navBtn" id="reverseBtn">reverse</div>
  
  <div id="speedWrapper" style="display:inline-block; width:160px; float:right; margin-top:20px;">
    <div id="sliderSpeed"></div>
  </div>
  
</div>  
<div class="ferris" id="ferris">
  <div class="pivot" id="center"></div>
</div>

              
            
!

CSS

              
                
body {
	background-color:#000000;
	margin:15px;
	color:#CCCCCC;
  overflow:hidden;
	font-family:Arial, Helvetica, sans-serif;
  background: #fff65e; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover,  #fff65e 0%, #febf04 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#fff65e), color-stop(100%,#febf04)); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover,  #fff65e 0%,#febf04 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover,  #fff65e 0%,#febf04 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover,  #fff65e 0%,#febf04 100%); /* IE10+ */
background: radial-gradient(ellipse at center,  #fff65e 0%,#febf04 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff65e', endColorstr='#febf04',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */

}

.ferris {
  position:relative;
  margin:auto;
  width:400px;
  height:400px;
  position:relative;
  border-radius:50%;
  border:4px solid #600;
  visibility:hidden;
  
}

.pivot{
  position:absolute;
  width:20px;
  height:20px;
  background:#600;
  
  
}

.outer {
  top:-200px;
  border-radius:50%;
  background:black;
}

.basket {
  position:absolute;
  width:80px;
  height:70px;
  background:url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/basket.png);
  left:-30px;
  top:10px;
  border-radius:6px;
}

.arm {
  width:200px;
  height:6px;
  background:#600;
  position:absolute;
  left:10px;
  top:7px;
}

#nav {
  width:400px;
  margin:20px auto;
}

.navBtn {
  margin-top:8px;
  padding:10px;
  background-color:rgba(255, 255, 255, 0.3);
  display:inline-block;
  padding:10px;
  border:1px solid #ccc;
  border-radius:10px;
  color:#655;
  cursor:pointer;
}

.ui-widget-content {
  background-color:rgba(255, 255, 255, 0.2);
}

.sliderSpeed{
 
}
              
            
!

JS

              
                var ferris = $("#ferris"),
    center = $("#center"),
    tl;

TweenLite.set(center, {x:190, y:190});

//a little tricky getting the ferris wheel built, but it serves its purpose
function addArms(numArms) {
  var space = 360/numArms; 
  for (var i = 0; i < numArms; i++){
    var newArm = $("<div>", {class:"arm"}).appendTo(center)
    var newPivot = $("<div>", {class:"pivot outer"}).appendTo(center);
    var newBasket = $("<div>", {class:"basket"}).appendTo(newPivot);
    TweenLite.set(newPivot, {rotation:i*space, transformOrigin:"10px 210px"})
    TweenLite.set(newArm, {rotation:(i*space) -90, transformOrigin:"0px 3px"})
    TweenLite.set(newBasket, {rotation:  (-i * space), transformOrigin:"50% top" });
  }   
}

//Get this party started
addArms(8);//values between 2 and 12 work best
TweenLite.from(ferris, 1, {autoAlpha:0});

//Animation (super easy)
tl = new TimelineMax({repeat:-1, onUpdate:updateSlider});
tl.to(center, 20, {rotation:360,  ease:Linear.easeNone})
//spin each basket in the opposite direction of the ferris wheel at same rate (no math)
tl.to($(".basket"), 20, {rotation:"-=360",  ease:Linear.easeNone},0)


//UI Controls
$( "#slider" ).slider({
  range: false,
  min: 0,
  max: 1,
  step:.001,
  slide: function ( event, ui ) {
    tl.progress( ui.value ).pause();
  },
  stop: function( event, ui ) {tl.play()}
});	
			
function updateSlider() {
		$("#slider").slider("value", tl.progress());
}

$( "#sliderSpeed" ).slider({
  range: false,
  min: 0,
  max: 8,
  step:.02,
  value:1,
  slide: function ( event, ui ) {
    tl.timeScale( ui.value ).resume();
  }
});	


$("#playBtn").click(function(){
  tl.play();
});
$("#pauseBtn").click(function(){
	tl.pause();
});

$("#reverseBtn").click(function(){
  tl.reverse();
});
	
              
            
!
999px

Console