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

              
                <div id="stage">
  <div id="blur"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="brightness"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="contrast"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="dropshadow"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="grayscale"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="hue-rotate"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="invert"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="opacity"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="saturate"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="sepia"><img src="http://www.thomasgreenfields.com/img/proibida.jpg"/></div>
  <div id="effect"></div>
</div>
              
            
!

CSS

              
                #stage {
	position:relative;
	height:350px;
	width:50%;
	margin-left:25%;
	background: #f0f9ff;
	background: -moz-radial-gradient(center, ellipse cover, #f0f9ff 0%, #999999 100%);
	background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #f0f9ff), color-stop(100%, #999999));
	background: -webkit-radial-gradient(center, ellipse cover, #f0f9ff 0%, #999999 100%);
	background: -o-radial-gradient(center, ellipse cover, #f0f9ff 0%, #999999 100%);
	background: -ms-radial-gradient(center, ellipse cover, #f0f9ff 0%, #999999 100%);
	background: radial-gradient(ellipse at center, #f0f9ff 0%, #999999 100%);
 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f0f9ff', endColorstr='#999999', GradientType=1 );
	overflow:hidden;
}

#stage div {
	position: absolute;
	width:100px;
	height:60px;
	top:50%;
	visibility:hidden;
}

#stage #effect {
	position: absolute;
	left:35%;
	top:315px;
	width:300px;
	font-family: Tahoma, Geneva, sans-serif;
	font-size: 24px;
	font-weight: bold;
	visibility:visible;
}
              
            
!

JS

              
                
  
$(window).load(function () {
	var centerY = $("#stage").height() / 2,
    centerX = $("#stage").width() / 2,
	stageL = $("#stage").position().left,
	stageR = stageL + $("#stage").width(),
	stageBottom = $("#stage").position().top + $("#stage").height();


//blur - also works on text divs
function blur_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#blur",{width: 400, visibility:"visible", '-webkit-filter':'brightness(0%'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"blur filter", ease:Linear.easeNone}));																																	    tl.add(TweenMax.fromTo("#blur",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5} ));
	tl.add(TweenMax.to("#blur",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","blur", 0, 100]}),"-=1");
	tl.add(TweenMax.to("#blur",1,{delay:1.5,  scale:0.5}));
	tl.add(TweenMax.to("#blur",1, {onUpdate:  cssFilterTween, onUpdateParams: ["{self}","blur", 100, 0]}),"-=1");
	tl.add(TweenMax.to("#blur",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;
  }
//brightness
function bright_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#brightness",{width: 400, visibility:"visible", '-webkit-filter':'brightness(0%'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"brightness filter", ease:Linear.easeNone}));																																	    tl.add(TweenMax.fromTo("#brightness",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5} ));
	tl.add(TweenMax.to("#brightness",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","brightness", 0, 100]}),"-=1");
	tl.add(TweenMax.to("#brightness",1,{delay:1.5,  scale:0.5}));
	tl.add(TweenMax.to("#brightness",1, {onUpdate:  cssFilterTween, onUpdateParams: ["{self}","brightness", 100, 0]}),"-=1");
	tl.add(TweenMax.to("#brightness",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;
}	
	
//contrast
function contrast_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#contrast",{width: 400, visibility:"visible", '-webkit-filter':'contrast(0%)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"contrast filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#contrast",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5} ));
	tl.add(TweenMax.to("#contrast",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","contrast",  0, 100]}),"-=1");
	tl.add(TweenMax.to("#contrast",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#contrast",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","contrast",  100, 0]}),"-=1");
	tl.add(TweenMax.to("#contrast",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;
}
//shadow hex color 
function shadow_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#dropshadow",{width: 400, visibility:"visible", '-webkit-filter':'dropshadow(0,0)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"dropshadow filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#dropshadow",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5} ));
	tl.add(TweenMax.to("#dropshadow",1, {onUpdate: dropshadowt, onUpdateParams: ["{self}",[10,10,7,'#112211' ],[-20,-20,10,'#666666']]}),"-=1");
	tl.add(TweenMax.to("#dropshadow",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#dropshadow",1, {onUpdate: dropshadowt, onUpdateParams: ["{self}",[-20,-20,10,'#666666'],[10,10,7,'#112211']]}),"-=1");
	tl.add(TweenMax.to("#dropshadow",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}

//grayscale
function grayscale_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#grayscale",{width: 400, visibility:"visible", '-webkit-filter':'grayscale(0%)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"grayscale filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#grayscale",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5}));
	tl.add(TweenMax.to("#grayscale",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","grayscale", 0, 100]}),"-=1");
	tl.add(TweenMax.to("#grayscale",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#grayscale",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","grayscale", 100, 0]}),"-=1");
	tl.add(TweenMax.to("#grayscale",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}
//hue-rotate
function huerotate_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#hue-rotate",{width: 400, visibility:"visible", '-webkit-filter':'hue-rotate(0deg)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"hue-rotate filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#hue-rotate",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5}));
	tl.add(TweenMax.to("#hue-rotate",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","hue-rotate", 0, 360]}),"-=1");
	tl.add(TweenMax.to("#hue-rotate",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#hue-rotate",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","hue-rotate", 360, 0]}),"-=1");
	tl.add(TweenMax.to("#hue-rotate",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}

//invert
function invert_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#invert",{width: 400, visibility:"visible", '-webkit-filter':'invert(0%)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"invert filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#invert",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5}));
	tl.add(TweenMax.to("#invert",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","invert", 0, 100]}),"-=1");
	tl.add(TweenMax.to("#invert",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#invert",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","invert", 100, 0]}),"-=1");
	tl.add(TweenMax.to("#invert",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}

//opacity
function opacity_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#opacity",{width: 400, visibility:"visible", '-webkit-filter':'opacity(0%)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"opacity filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#opacity",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5}));
	tl.add(TweenMax.to("#opacity",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","opacity", 0, 100]}),"-=1");
	tl.add(TweenMax.to("#opacity",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#opacity",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","opacity", 100, 0]}),"-=1");
	tl.add(TweenMax.to("#opacity",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}
//saturate
function saturate_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#saturate",{width: 400, visibility:"visible", '-webkit-filter':'saturate(0%)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"saturate filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#saturate",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5}));
	tl.add(TweenMax.to("#saturate",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","saturate", 0, 200]}),"-=1");
	tl.add(TweenMax.to("#saturate",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#saturate",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","saturate", 200, 0]}),"-=1");
	tl.add(TweenMax.to("#saturate",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}
//sepia
function sepia_el() {
  var tl = new TimelineLite();
	tl.add(TweenMax.set("#sepia",{width: 400, visibility:"visible", '-webkit-filter':'sepia(0%)'}));
	tl.add(TweenMax.to("#stage #effect", 2, {text:"sepia filter", ease:Linear.easeNone}));
	tl.add(TweenMax.fromTo("#sepia",1,{left:-405, top:20, scale:0.3}, {left: centerX -200, top:20, scale:0.5}));
	tl.add(TweenMax.to("#sepia",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","sepia", 0, 100]}),"-=1");
	tl.add(TweenMax.to("#sepia",1,{delay:1.5, scale:0.5}));
	tl.add(TweenMax.to("#sepia",1, {onUpdate: cssFilterTween, onUpdateParams: ["{self}","sepia", 100, 0]}),"-=1");
	tl.add(TweenMax.to("#sepia",1,{delay:1.5, left:stageR, scale:0.3}));
  return tl;

}
//run the show
tlmaster = new TimelineLite({delay:0.5});
tlmaster.add(blur_el())
.add(bright_el())
.add(contrast_el())
.add(shadow_el())
.add(grayscale_el())
.add(huerotate_el())
.add(invert_el())
.add(opacity_el())
.add(saturate_el())
.add(sepia_el())
.add(TweenMax.to("#stage #effect", 2, {text:"DONE", ease:Linear.easeNone}))

//cssFilterTween
function cssFilterTween(tl, filter, start, end){
	var units = ['px','deg','%'],
	tlp = (tl.progress()*100) >> 0;
	switch (filter) {
    case "blur":
        //filter = "blur";
		if (start < end){
			var inc = start + Math.abs(start - end)/100 * tlp; 
		}else {
			var inc = start - Math.abs(start - end)/100 * tlp; 
		}
		TweenMax.set(tl.target,{'-webkit-filter':'blur('+ inc + units[0]+')', 'filter':'blur('+ inc + units[0]+')'});
        break;
    case "hue-rotate":
        //filter = "hue-rotate"
		var tlp = (tl.progress()*100) >> 0;
		if (start < end){
			var inc = start + Math.abs(start - end)/100 * tlp; 
		}else {
			var inc = start - Math.abs(start - end)/100 * tlp; 
		}
		TweenMax.set(tl.target,{'-webkit-filter':'hue-rotate('+ inc + units[1]+')', 'filter':'hue-rotate('+ inc +units[1]+')'});
        break;
     default:
	 //everything else is %
	 	var tlp = (tl.progress()*100) >> 0;
		if (start < end){
			var inc = start + Math.abs(start - end)/100 * tlp; 
		}else {
			var inc = start - Math.abs(start - end)/100 * tlp; 
		}
	TweenMax.set(tl.target,{'-webkit-filter':filter +'('+ inc + units[2]+')', 'filter':filter +'('+ inc +units[2]+')'});
        
}
	
	}
});
		
//drop-shadow
//Does this make sense?
function dropshadowt(tl, start, end){
	startX = start[0];
	startY =  start[1];
	startBlur = start[2]|| 10;
	startColor = start[3] || '#FFFFFF';
	
	endX = end[0];
	endY =  end[1];
	endBlur = end[2]|| 10;
	endColor = end[3]|| '#FFFFFF';
	
	var tlp = (tl.progress()*100) >> 0;
	
	var incX = startX + Math.abs(startX - endX)/100 * tlp; 
	var incY = startY + Math.abs(startY - endY)/100 * tlp;
	var incBlur = startBlur + Math.abs(startBlur - endBlur)/100 * tlp;

	var startRed = parseInt(startColor.substring(1,3),16);
    var startGreen = parseInt(startColor.substring(3,5),16);
    var startBlue = parseInt(startColor.substring(5,7),16);
	
	var endRed = parseInt(endColor.substring(1,3),16);
    var endGreen = parseInt(endColor.substring(3,5),16);
    var endBlue = parseInt(endColor.substring(5,7),16);
	
	var redVal =  parseInt(Math.abs(startRed - endRed)/ 100 * tlp);
	var greenVal =  parseInt(Math.abs(startGreen - endGreen)/ 100 * tlp);
	var blueVal =  parseInt(Math.abs(startBlue - endBlue)/ 100 * tlp);
	
	redVal = (redVal<255) ? redVal:255;
	greenVal = (greenVal<255) ? greenVal:255;
	blueVal = (blueVal<255) ? blueVal:255;
	
	var hexRed = ((redVal.toString(16).length==1) ? "0"+redVal.toString(16):redVal.toString(16));
    var hexGreen = ((greenVal.toString(16).length==1) ? "0"+greenVal.toString(16):greenVal.toString(16));
    var hexBlue = ((blueVal.toString(16).length==1) ? "0"+blueVal.toString(16):blueVal.toString(16));
		
	var newColor = hexRed+hexGreen+hexBlue;
	
	TweenMax.set(tl.target,{"-webkit-filter":"drop-shadow("+ incX + "px " + incY + "px " + incBlur + "px #" + newColor + ")", "filter":"drop-shadow("+ incX + "px " + incY + "px " + incBlur + "px #" + newColor + ")"});
	}
              
            
!
999px

Console