Pen Settings



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


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


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.


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.


Toying with layering, blending, and animating images on canvas.  See the original static image here:

<canvas id="c" width="600" height="600">
<canvas id="c2" width="600" height="600">
<canvas id="c3" width="600" height="600">






	(function ($) {			    
			var	c = $('#c');
			var	c2 = $('#c2');
			var	c3 = $('#c3');			
			var	x2 = c2[0].getContext('2d');
			var	x = c[0].getContext('2d');
			var	w = c[0].width = window.innerWidth, 
          h = c[0].height = window.innerHeight;		
			var	img = new Image();	
			// fade / cloudy effect on image
			var	fade = function(p) {				
				var	opacity,
					fy = (Math.random()*285)>>0,
					fx = (Math.random()*285)>>0;
				this.p = p;
				this.move = function(time) {						
					p = this.p + 0.3 * time;				
					opacity = (Math.sin(p*0.05)*0.5);						
					if(opacity <0) {
						p = opacity = 0;
						fy = (Math.random()*285)>>0;
						fx = (Math.random()*285)>>0;
					this.p = p;																			
					x.globalAlpha = opacity;						
					x.drawImage(c3[0], fy+p, fy+p, 285-(p*2),285-(p*2), 0,0, w, h);								
			var	faders = [];			
			var	sortFade = function(p1,p2) { return p1.p-p2.p; };	
			faders.push( new fade(0) );
			faders.push( new fade(20) );
			faders.push( new fade(40) );
			var	currTime, prevTime = 0, time;
			var	loop = function()
				currTime = new Date().getTime();				
				if(prevTime === 0 ) {
				time = (currTime-prevTime) * 0.1;
				if(time>3) {time=3;}
				prevTime = currTime;						
				for(var i=0;i<faders.length;i++)
				x2.drawImage( c[0] ,0,0,570,570);				
		  //large image size on canvas 3
			var	c3 = $('#c3');
			var	x3 = c3[0].getContext('2d');
			$(img).bind('load',null, function() {  x3.drawImage(img, 0,0, 570, 570);	loop(); });
			img.src = '';
  window.addEventListener('resize', function(){
     c[0].width = window.innerWidth;
     c[0].height = window.innerHeight;		
  }, false);