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

              
                <html lang="en">

<head>
  <link href='https://fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
  <meta charset="UTF-8">
</head>

<body>
  <div class="row">
    <a id="css" href="">CSS Sweep to Right</a>
    <a class="gsfx-bgsweep-right extra" href="">GSAP Sweep to Right</a>
  </div>
</body>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  outline: 0;
}

img {
  width: 100%;
  height: auto;
  border: 0;
}

body {
  font-family: 'Lato';
  font-weight: 300;
  font-size: 16px;
  max-width: 100%;
  overflow-x: hidden;
}

.row { text-align: center; padding: 30px 0; }

.row a {
  position: relative;
  display: inline-block;
  text-decoration: none;
  background-color: rgb(108, 122, 137);
  color: rgb(255, 255, 255);
  padding: 16px;
  margin: 10px 30px;
  /* translateZ(0) forces the browser to create a new layer and send rendering to the GPU */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

#css:before {
  background: rgb(103, 65, 114);
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;  
  transform: scaleX(0);  
  transform-origin: 0 50%;  
  transition-property: transform;  
  transition-duration: 0.3s;  
  transition-timing-function: ease-out;
}

#css:hover:before { transform: scaleX(1); } 
              
            
!

JS

              
                $('.gsfx-bgsweep-right').on( gsFx_BgSweepRight( $('.gsfx-bgsweep-right') ) );	

function gsFx_BgSweepRight(element, config) {
	config = config || {};
	var time = config.time != null ? config.time : 0.3;
	
	var sheet = (function() {	
		var style = document.createElement("style");		
		style.appendChild(document.createTextNode("")); // webKit hack	
		document.head.appendChild(style);
		return style.sheet;
	})();
	sheet.insertRule(".extra:after { background: rgb(103, 65, 114); content: ''; position: absolute; z-index: -1; top: 0; left: 0; right: 0; bottom: 0; transform: scaleX(0); transform-origin: 0% 50%; }", 0);

	var rule = CSSRulePlugin.getRule(".extra:after");
	var ruleObject = '';
	for (property in rule) {
		ruleObject += property + ':' + rule[property] + '; ';
	};
	
	var backgroundColor = rule.backgroundColor;
	var transform = rule.transform;	
  
  //i don't know why but I had to do this first
  TweenMax.set(rule, {cssRule:{scaleX:0}})
  
  var animation = TweenMax.to(rule, time, { 
		cssRule: {scaleX:1},		
		ease: Sine.easeOut,
    paused:true
		 } 
	);
	

	return {	    
		mouseenter: function() {      
			animation.play();
		},

		mouseleave: function() {
			animation.reverse();	      
		}			   
	};	
}
              
            
!
999px

Console