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="demoWrapper">
  <div id="bg"></div>
    <div id="content">
      <h1>Freakishly Robust</h1>
      <h2>With features that makes other engines look like cheap toys</h2>
      <div id="info"><img src="https://www.greensock.com/wp-content/uploads/custom/codepen/feature_robust.png" width="240" height="151" id="feature">
        <p id="description">Animate colors, beziers, css properties, arrays, scrolls and lots more. Round values, smoothly reverse() on the fly, use relative values, employ virtually any easing equation, and manage conflicting tweens like a pro. GSAP does all this and much more with ease.</p>
      </div>
      <div id="nav"> <img src="https://www.greensock.com/wp-content/uploads/custom/codepen/icon_robust.png" width="83" height="59"><img src="https://www.greensock.com/wp-content/uploads/custom/codepen/icon_overwrite.png" width="43" height="59"><img src="https://www.greensock.com/wp-content/uploads/custom/codepen/icon_compatible.png" width="73" height="59"><img src="https://www.greensock.com/wp-content/uploads/custom/codepen/icon_support.png" width="83" height="59"><img src="https://www.greensock.com/wp-content/uploads/custom/codepen/icon_plugin.png" width="76" height="59">
      </div>
  </div>
</div>
<div>
  <button id="play">play</button>
  <button id="pause">pause</button>
  <button id="reverse">reverse</button>
  <button id="resume">resume</button>
  <button id="restart">restart</button>
</div>
<div id="sliderWrapper">
<div id="slider"></div>
</div>

              
            
!

CSS

              
                body, h1, h2, h3, p {
	font-family: Arial, Helvetica, sans-serif;
	margin: 0;
	color: #fff;
}

body {
  background-color:#000;
}
h1 {
	position: relative;
	margin-top: 10px;
	font-size: 36px;
	font-weight: normal;
}
h2 {
	position: relative;
	font-size: 22px;
	font-weight: normal;
	color: #cfcfcf;
}
#demoWrapper {
	width: 600px;
	height: 350px;
	-webkit-font-smoothing: antialiased;
	color: black;
	overflow: hidden;
}
#bg {
	position: absolute;
	background-image: url(https://www.greensock.com/_img/codepen/black_textured_background.png);
	width: 600px;
	height: 350px;
}
#content {
	padding-left: 15px;
	visibility: hidden;
}
#info {
	margin-top: 20px;
}
#feature {
	position: relative;
	float: left;
}
#description {
	position: relative;
	float: left;
	margin-left: 20px;
	width: 290px;
	font-size: 16px;
	line-height: 24px;
}
#nav {
	position: absolute;
	top: 285px;
	left: 140px;
	white-space: nowrap;
}
#nav img {
	position: relative;
	margin-right: 20px;
	float: left;
}
button {
	padding: 10px;
	margin-top: 10px;
}

button:nth-child(1){
  margin-left:10px;
}

#slider{
	width: 580px;
	margin:10px;
  background-color:#ff0;
}
              
            
!

JS

              
                var tl = new TimelineLite({onUpdate:updateSlider});
tl.set("#content", {visibility:"visible"})
  .from("h1", 0.5, {left:100, autoAlpha:0}) // autoAlpha handles both css properties visibility and opacity.
.from("h2", 0.5, {left:-100, autoAlpha:0}, "-=0.25") //add tween 0.25 seconds before previous tween ends
.from("#feature", 0.5, {scale:0.5, autoAlpha:0}, "feature") // add feature label at start position of this tween
.from("#description", 0.5, {left:100, autoAlpha:0}, "feature+=0.25") // add tween 0.25 seconds after the feature label
.staggerFrom("#nav img", 0.5, {scale:0, rotation:-180, autoAlpha:0}, 0.2, "stagger"); 
		  
$("#play").click(function() {
  //play() only plays forward from current position. If timeline has finished, play() has nowhere to go.
  //if the timeline is not done then play() or else restart() (restart always restarts from the beginning).

  if(tl.progress() != 1){
    //carl just changed this again
		tl.play();
  } else {
    tl.restart();
  }
});
		
$("#pause").click(function() {
		tl.pause();
});
		
$("#reverse").click(function() {
		tl.reverse();
});
		
$("#resume").click(function() {
		tl.resume();	
});
		
$("#restart").click(function() {
		tl.restart();
});		
	
$("#slider").slider({
  range: false,
  min: 0,
  max: 100,
  step:.1,
  slide: function ( event, ui ) {
    tl.pause();
    //adjust the timeline's progress() based on slider value
    tl.progress( ui.value/100 );
    }
});	
		
function updateSlider() {
  $("#slider").slider("value", tl.progress() *100);
} 			  
              
            
!
999px

Console