<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codrops &#187; javascript</title>
	<atom:link href="http://tympanus.net/codrops/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Mon, 06 Feb 2012 07:30:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Examples of Fresh Effects in Web Design</title>
		<link>http://tympanus.net/codrops/2012/01/05/examples-of-fresh-effects-in-web-design/</link>
		<comments>http://tympanus.net/codrops/2012/01/05/examples-of-fresh-effects-in-web-design/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 11:01:03 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=7069</guid>
		<description><![CDATA[Having some fresh and maybe even unexpected effects on a website, can juice up the experience for the user. Be it a whole new and experimental way of navigating through the website or just a tiny surprising hover effect - fresh effects can spice up your design and bring some life to it. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/FreshEffects.jpg" alt="FreshEffects" title="" width="580" height="315" class="aligncenter size-full wp-image-7141" /></p>
<p>Having some fresh and maybe even unexpected effects on a website, can juice up the experience for the user. Be it a whole new and experimental way of navigating through the website or just a tiny surprising hover effect &#8211; fresh effects can spice up your design and bring some life to it. </p>
<p>We&#8217;ve collected some wonderful examples of such effects for your inspiration. Dive in!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3><a href="http://editsquarterly.com/" target="_blank">Edits Quarterly × Ian Coyle</a></h3>
<p><a target="_blank" href="http://editsquarterly.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/editsquarterly.jpg" alt="" title="editsquarterly" width="580" height="360" class="aligncenter size-full wp-image-7071" /></a></p>
<p>Edits Quarterly is a great example of a whole new navigation experience. You can scroll down or simply use the arrow keys to view the beauty of it.</p>
<h3><a href="http://www.neotokio.it/" target="_blank">neotokio!</a></h3>
<p><a target="_blank" href="http://www.neotokio.it/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/neotokio.jpg" alt="" title="neotokio" width="580" height="360" class="aligncenter size-full wp-image-7074" /></a></p>
<p>Neotokio! will surprise you with different kind of animations while you scroll down the site.</p>
<h3><a href="http://kyan.com/" target="_blank">Kyan</a></h3>
<p><a target="_blank" href="http://kyan.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/kyan.jpg" alt="" title="kyan" width="580" height="360" class="aligncenter size-full wp-image-7077" /></a></p>
<p>Kyan has an awesome slider that just animates wonderfully has gives a real 3D feel to it.  </p>
<h3><a href="http://www.apbaxter.com/" target="_blank">Adrian Baxter</a></h3>
<p><a target="_blank" href="http://www.apbaxter.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/apbaxter.jpg" alt="" title="apbaxter" width="580" height="360" class="aligncenter size-full wp-image-7078" /></a></p>
<p>Adrian Baxter&#8217;s website has an interesting and original parallax effect. Oh, and don&#8217;t scare when you check out the contact form :)</p>
<h3><a href="http://alpisdesign.com/" target="_blank">Alpis Design</a></h3>
<p><a target="_blank" href="http://alpisdesign.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/alpisdesign.jpg" alt="" title="alpisdesign" width="580" height="360" class="aligncenter size-full wp-image-7091" /></a><br />
Here we have a nice hover effect in the about section.</p>
<h3><a href="http://wadach.com/" target="_blank">Dawid Wadach</a></h3>
<p><a target="_blank" href="http://wadach.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/wadach.jpg" alt="" title="wadach" width="580" height="360" class="aligncenter size-full wp-image-7079" /></a><br />
Dawid Wadach has a very interesting hover effect which reveals his portfolio items. A combination of lines and boxes that move make this effect very original.</p>
<h3><a href="http://www.dangersoffracking.com/" target="_blank">Dangers of Fracking</a></h3>
<p><a target="_blank" href="http://www.dangersoffracking.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/dangersoffracking.jpg" alt="" title="dangersoffracking" width="580" height="360" class="aligncenter size-full wp-image-7075" /></a><br />
&#8220;Dangers of Fracking&#8221; which is designed by brilliant Linda Dong, is just a beautiful on-scroll piece of art that explains the dangers of hydraulic fracturing, a process that is used to release natural gas. See, how the story is being told using this wonderful visualization method.</p>
<h3><a href="http://50.aigadc.org/" target="_blank">AIGA 50 DC</a></h3>
<p><a target="_blank" href="http://50.aigadc.org/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/aigadc.jpg" alt="" title="aigadc" width="580" height="360" class="aligncenter size-full wp-image-7082" /></a><br />
AIGA 50 uses this great &#8220;cut-out&#8221; technique that reveals the images of a slider which always seems to be beneath the other content slides. </p>
<h3><a href="http://createdm.com/" target="_blank">Create Digital Media</a></h3>
<p><a target="_blank" href="http://createdm.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/createdm.jpg" alt="" title="createdm" width="580" height="360" class="aligncenter size-full wp-image-7086" /></a><br />
Create Digital Media has a unique slider that shows content and images in an original way.</p>
<h3><a href="http://www.mezcalbuenviaje.com/" target="_blank">Mezcal Buen Viaje</a></h3>
<p><a target="_blank" href="http://www.mezcalbuenviaje.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/mezcalbuenviaje.jpg" alt="" title="mezcalbuenviaje" width="580" height="360" class="aligncenter size-full wp-image-7087" /></a><br />
Now, THAT I call a scrollbar! :) &#8220;Mescal Buen Viaje&#8221; is like entering another world: everything is very original, from the scrollbar to the navigation to the way images are displayed: it&#8217;s such a fresh experience. And check out those cute kolibris that flap their wings on scroll.</p>
<h3><a href="http://thegeekdesigner.com/" target="_blank">Alex Pierce</a></h3>
<p><a target="_blank" href="http://thegeekdesigner.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/thegeekdesigner.jpg" alt="" title="thegeekdesigner" width="580" height="360" class="aligncenter size-full wp-image-7090" /></a><br />
Alex Pierce has some nice sliding happening right after the page is loaded with CSS3 animations. Hovering over the main navigation will make the whole navigation bar move a bit. Also, other subtle (hover) effects make a visit to his website a really nice experience. And don&#8217;t you just love the typography?</p>
<h3><a href="http://www.styiens.com/" target="_blank">Styiens &#8211; Label Musical</a></h3>
<p><a target="_blank" href="http://www.styiens.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/styiens.jpg" alt="" title="styiens" width="580" height="360" class="aligncenter size-full wp-image-7132" /></a><br />
Styiens has a very interesting slider that moves around that central circular element. </p>
<h3><a href="http://20calendars.lavazza.com/" target="_blank">Lavazza 20Calendars</a></h3>
<p><a target="_blank" href="http://20calendars.lavazza.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/lavazza.jpg" alt="" title="lavazza" width="580" height="360" class="aligncenter size-full wp-image-7076" /></a><br />
20 Calendars of Lavazza uses a beautiful full-page accordion that slides open elegantly when clicking on one of the headlines.</p>
<h3><a href="http://www.sheltonfleming.co.uk/" target="_blank">Shelton Fleming</a></h3>
<p><a target="_blank" href="http://www.sheltonfleming.co.uk/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/sheltonfleming.jpg" alt="" title="sheltonfleming" width="580" height="360" class="aligncenter size-full wp-image-7080" /></a><br />
Shelton Fleming divides its content into &#8220;Experiences&#8221; and &#8220;Ideas&#8221;, presenting each on one side of the page and making their sub-content slide originally when opening a menu item.</p>
<h3><a href="http://www.boldidea.com/toast/" target="_blank">Toast!</a></h3>
<p><a target="_blank" href="http://www.boldidea.com/toast/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/boldidea.jpg" alt="" title="boldidea" width="580" height="360" class="aligncenter size-full wp-image-7081" /></a><br />
Toast! has a really cool and original slider.</p>
<h3><a href="http://fivethirtybrew.com/" target="_blank">Five Thirty Brew by blenderbox</a></h3>
<p><a target="_blank" href="http://fivethirtybrew.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/fivethirtybrew.jpg" alt="" title="fivethirtybrew" width="580" height="360" class="aligncenter size-full wp-image-7084" /></a><br />
Five Thirty Brew by blenderbox is an exciting scrolling roller-coaster that will present you their fine beer and the process of making it. </p>
<h3><a href="http://captaindash.com/" target="_blank">CaptainDash</a></h3>
<p><a target="_blank" href="http://captaindash.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/captaindash.jpg" alt="" title="captaindash" width="580" height="360" class="aligncenter size-full wp-image-7085" /></a><br />
The delicate and original layout and design of CaptainDash makes the sliding content very interesting.</p>
<h3><a href="http://sirjohnaday.com/" target="_blank">Sir John A Day</a></h3>
<p><a target="_blank" href="http://sirjohnaday.com/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/01/sirjohnaday.jpg" alt="" title="sirjohnaday" width="580" height="360" class="aligncenter size-full wp-image-7088" /></a><br />
Sir John A Day has some really cute subtle details that are not visible at first sight. But once you dive in, you will see those tiny animations, that complement this beautiful design and add life to it: there is something animating in <em>every</em> section of the page.</p>
<p><strong>We hope you liked this little collection and got inspired!</strong></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/01/05/examples-of-fresh-effects-in-web-design/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Interactive Typography Effects with HTML5</title>
		<link>http://tympanus.net/codrops/2011/11/09/interactive-html5-typography/</link>
		<comments>http://tympanus.net/codrops/2011/11/09/interactive-html5-typography/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 11:55:14 +0000</pubDate>
		<dc:creator>Tim Holman</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[letters]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6297</guid>
		<description><![CDATA[With HTML5 gaining popularity, this tutorial outlines what is really just the tip of the iceberg that is interactive design. In this tutorial I will go over the development of dynamic, and generative banners to give your website that little extra wow!]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/InteractiveTypographyEffects.jpg" alt="InteractiveTypographyEffects" width="580" height="315" class="aligncenter size-full wp-image-6415" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/InteractiveTypographyEffects.zip">Download source</a> </p>
<p>With HTML5 gaining popularity, this tutorial outlines what is really just the tip of the iceberg that is interactive design. I will go over the development of dynamic, and generative banners to give your website that little extra wow!</p>
<p>If you are interested in reading more about the HTML5 spec, this is a great resource: <a title="Dive Into HTML5" href="http://diveintohtml5.info/" target="_blank">Dive Into HTML5 by Mark Pilgrim</a></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>Markup</h3>
<p>The HTML markup is very simple, since we will be doing all the work with JavaScript, on the canvas element:</p>
<pre class="brush: html;">
	&lt;canvas id="banner"&gt;&lt;/canvas&gt;
</pre>
<h3>JavaScript</h3>
<p>As expected, it will be JavaScript doing all the heavy lifting here. But first and foremost, we will need to check if our users are using a modern browser that supports the canvas element. If it&#8217;s not supported, we want to dish up the next best thing: a static image. We will be using <a href="http://www.modernizr.com/" target="_blank">Modernizr</a> to check on this.</p>
<h4>Variables</h4>
<p>Let&#8217;s start defining some variables:</p>
<pre class="brush: js;">		//The words to be written on the banner
		var keyword 	= "HONEY",
		canvas, context,
		bgCanvas, bgContext,
		density 	= 13,
		particles 	= [],
		colour 		= '#fff0a4',
		mouse 		= { x:0, y:0 },
		isDrawing 	= false,
		canvasW, canvasH;
</pre>
<p>A little explanation: The <em>keyword</em> here is going to be the word which you want to display on the banner.</p>
<p>The <em>canvas</em>, is a variable which will hold the HTML canvas element. This will be assigned later. The <em>context</em> is what allows us to drawn and write to the canvas.</p>
<p>The <em>density</em> variable holds how many pixels we want to have (both horizontally and vertically) between each banner particle.</p>
<p>The <em>particles array</em> will store all the particles and their respective settings.</p>
<p>The <em>colour</em> variable is the colour that each particle will have.</p>
<p>Finally, the <em>isDrawing</em> variable let&#8217;s us know if we are hovering over the banner, and the <em>canvasW</em> and <em>canvasH</em> are the canvas&#8217; width and height respectively.</p>
<h4>Setting up the banner</h4>
<p>The first step is to call the reload function which we will also call on window resize:</p>
<pre class="brush: js;">
this.initialize 	= function( canvas_id ) {

		reload( canvas_id );

		window.onresize = function(event) {
			reload( canvas_id );
		}

};
</pre>
<p>In the reload function we initialize the <em>canvas</em> and <em>context</em> and set the respective sizes. Then we call the <em>prepare</em>, <em>setupParticles</em> and <em>draw</em> functions.</p>
<pre class="brush: js;">
var reload			= function( canvas_id ) {

	canvas 			= document.getElementById( canvas_id );

	if ( !window.HTMLCanvasElement ) return false;

	context 		= canvas.getContext('2d');

	canvasW			= window.innerWidth;
	canvasH			= 300;

	canvas.width 	= canvasW;
	canvas.height 	= canvasH;

	bgCanvas 		= document.createElement('canvas');
	bgContext 		= bgCanvas.getContext('2d');

	bgCanvas.width 	= canvasW;
	bgCanvas.height = canvasH;

	prepare();
	setupParticles();
	draw();

};
</pre>
<p>The first thing to note here, is that the function takes a string variable, which should match the element ID in the HTML. In our case, we would pass &#8220;canvas-banner&#8221;.</p>
<p>As you can see, both, the background canvas and the main canvas are set to the same size. We will get into why we are using two canvas elements in the next section.</p>
<h4>The Background Canvas</h4>
<p><a href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/index2.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/example2.jpg" alt="example2" width="580" height="298" class="alignnone size-full wp-image-6388" /></a></p>
<p>Ok, now I have some explaining to do: The reason why we have two canvases here, is more or less the core of these banners. The background canvas is where you will be printing the text, or images. Afterwards, we will scan over the image data (pixel by pixel) of the canvas. If we run into a black pixel we will know that we have drawn on this location, and hence, will create a particle in its place.</p>
<pre class="brush:js;">
var prepare 		= function() {

	//Chose the font, and size that we want.
	bgContext.font = "300px 'Jockey One'";

	//Fill the keyword text onto the canvas.
	bgContext.fillText(keyword, ( canvasW / 2 ) - ( Math.round( bgContext.measureText(keyword).width/2 ) ) , 260 );

};
</pre>
<p>The <em>fillText</em> command above, takes three parameters: The first being the text to write, the second and third being the x and y co-ordinates respectively.</p>
<p>Next, we will create our particles. These will soon be drawn onto the main canvas, but for now, we will just store them in our particles array:</p>
<pre class="brush: js;">
var setupParticles 	= function() {

	particles = [];		

	//Declare our local variables
	var imageData, image_Data,
		pixel,
		width	= 0,
		i		= 0,
		slide 	= false;

	//Get the image data - from (0,0) to the edges of the canvas
	imageData = bgContext.getImageData( 0, 0, canvasW, canvasH );
	image_Data= imageData.data;

	for( var height = 0; height &lt; canvasH; height += density ) {

		++i;
		slide 	= ((i % 2) == 0);

		width	= 0;

		if (slide == true) {

			width += 6;

		}

		//Iterate horizontally over the image data
		for( width; width &lt; canvasW; width += density ) {

			//Get the pixel located at our current iteration
			pixel = image_Data[ ( ( width + ( height * canvasW )) * 4 ) - 1 ];

			//Pixel has been drawn on.
			if( pixel == 255 ) {

				//Add the coodinates and colour to our particle array.
				particles.push({
					colour	: colour,
					x		: width,
					y		: height
				});

			}
		}
	}
};
</pre>
<p>Yes, that is a large chunk of code, I&#8217;ll go over the tricky parts now.</p>
<p>Really, all we are doing is looping over every n-th pixel, where n is the density set at the start.</p>
<p><em>getImageData</em> takes four values, the x and y of the top left corner, as well as for the bottom right. In our case, we passed it two zeros (the very top left) and the canvas width and height, which are the coordinates of the very bottom right. It returns a very big list, containing the color data of every single pixel on the canvas. Why are we multiplying this by four? Because within this list, each pixel is represented by four values, red, green, blue and an alpha value.</p>
<p>By default, all the canvas imageData contains, is a long list of zeros &#8211; by drawing on this canvas (in our case, using <em>fillText</em>), the pixels now contain proper color data.</p>
<p>Finally, we have pushed the x and y coordinates into a simple dictionary, which we will now use to draw our banner.</p>
<h4>Drawing the banner</h4>
<p><a href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/index3.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/example3.jpg" alt="example3" width="580" height="298" class="alignnone size-full wp-image-6394" /></a><br />
Here, we finally pull everything together. With our list of x and y positions, stored in the particles array, we can draw out the banner.</p>
<pre class="brush: js;">
var draw = function() {

	context.clearRect( 0, 0, canvasW, canvasH );

	var dx, dy, sqrDist,
		scale = 1;

	for ( var i = 0, len = particles.length; i &lt; len ; ++i ) {

		...

		context.beginPath();

		context.moveTo( x, y - height / 2 );
		context.lineTo( x + width / 2, y - height / 4 );
		context.lineTo( x + width / 2, y + height / 4 );
		context.lineTo( x, y + height / 2 );
		context.lineTo( x - width / 2, y + height / 4 );
		context.lineTo( x - width / 2, y - height / 4 );
		context.lineTo( x, y - height / 2 );  

		context.closePath();
		context.fill();

	}

};
</pre>
<p>We loop through each of the particles we stored previously to set the color and to draw a shape on that (x,y) point.</p>
<p>With that, we have a very simple <em>static</em> banner&#8230; now for the fun part, let&#8217;s add some interactivity.</p>
<h4>Adding Interactivity</h4>
<p><a href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/index4.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/example4.jpg" alt="example4" width="580" height="298" class="alignnone size-full wp-image-6395" /></a><br />
The fun thing about this is that we can be as simple, or complex as we want. The first thing we will want to do though, is track the user&#8217;s mouse position while it is over the banner.</p>
<pre class="brush: js;">
var mouse = {x:0, y:0, o: false};
</pre>
<p>The mouse variable will be updated by two functions, one tracking the movement, and one tracking whether the mouse has left the canvas element:</p>
<pre class="brush: js;">
var MouseMove 		= function( e ) {

	mouse.x = e.offsetX || ( e.layerX - canvas.offsetLeft );
	mouse.y = e.offsetY || ( e.layerY - canvas.offsetTop );

	if( !isDrawing ) {

		isDrawing = true;
		drawTimeout = setTimeout( function() {
			draw();
			isDrawing = false;
		}, 60);

	}

};

var MouseOut 		= function(e) {

	isDrawing = false;
	clearTimeout( drawTimeout );
	draw();

};
</pre>
<p>In order to make these work, we also need to attach JavaScript events to our canvas element. These will go right back up into our <em>reload</em> function.</p>
<pre class="brush: js;">
	canvas.addEventListener('mousemove', MouseMove, false);
	canvas.addEventListener('mouseout', MouseOut, false);
</pre>
<p>Now that we can track the mouse, we need to change up our draw function a little, based on how we want to interact with the mouse.</p>
<pre class="brush: js;">
...

var p   	= particles[i];

dx 			= p.x - mouse.x;
dy 			= p.y - mouse.y;

// distance from mouse to particle
sqrDist 	= Math.sqrt( dx * dx + dy * dy );

( isDrawing ) ? scale = Math.max( Math.min( 3 - ( sqrDist / 10 ), 10 ), 1 ) : scale = 1;

var width  	= density / scale - 4,
	height 	= density,
	x 		= p.x,
	y 		= p.y;

context.fillStyle = p.colour;

...
</pre>
<p>Above, we calculate the distance between the current particle and the mouse. Then we update the variable <em>scale</em> to fall between 1 (meaning no scaling) and the distance between the mouse and the particle (but not bigger than 10).</p>
<p>All that&#8217;s left now, is to tell our canvas to draw at regular intervals, rather than just once at the start. At risk of getting too complicated I&#8217;m just going to keep it simple and use <em>setTimeouts</em> when the user hovers over the banner &#8211; but if you are interested in looking more into canvas animations, the function you will be looking for is <em><a href="http://paulirish.com/2011/requestanimationframe-for-smart-animating/" target="_blank">requestAnimationFrame</a></em></p>
<h4>Let&#8217;s get some color</h4>
<p><a href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/index.html" target="_blank"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/11/example1.jpg" alt="" title="example1" width="580" height="298" class="alignnone size-full wp-image-6396" /></a><br />
We have a neat working banner, why not add a little color. Fortunately, we have already done most of the work here, we only need to change 2 lines.</p>
<pre class="brush: js;">
//A variable to store each of the colors we want to use
var colors = ['#fff0a4', '#ffe98f', '#ffcf52', '#fbad1d', '#c48d1c'];

	...

//When creating the particles, we assign a color from this list.
color: colors[Math.floor(Math.random() * colors.length)],
</pre>
<p>And there we have it! A unique, generative and colorful banner, made just for you. Take a look through the demos to see a few other examples, of just what you can do.</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/InteractiveTypographyEffects/InteractiveTypographyEffects.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/11/09/interactive-html5-typography/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>J is for jCookies &#8211; HTTP Cookie Handling for jQuery</title>
		<link>http://tympanus.net/codrops/2011/09/04/j-is-for-jcookies-http-cookie-handling-for-jquery/</link>
		<comments>http://tympanus.net/codrops/2011/09/04/j-is-for-jcookies-http-cookie-handling-for-jquery/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 13:18:34 +0000</pubDate>
		<dc:creator>Brian S. Reed</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[scottreeddesign]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=5604</guid>
		<description><![CDATA[jCookies, a jQuery plugin, makes getting and settings HTTP Cookies a breeze. jCookies allows the storage of any type of data: strings, arrays, objects, etc. A while back while developing my <a href="http://formbuilder.scottreeddesign.com/">FormBuilder</a> I needed a good solution for storing cookies via JavaScript. As a result of the work down for that project I built jCookies.]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-5628 aligncenter" title="jcook" src="http://tympanus.net/codrops/wp-content/uploads/2011/09/jcook.jpg" alt="" width="580" height="315" /></p>
<p>jCookies, a jQuery plugin, makes getting and settings HTTP Cookies a breeze. jCookies allows the storage of any type of data: strings, arrays, objects, etc. A while back while developing my <a href="http://formbuilder.scottreeddesign.com/">FormBuilder</a> I needed a good solution for storing cookies via JavaScript. As a result of the work down for that project I built jCookies.</p>
<p>The following will demonstrate the methods for storing and retrieving data using jCookies and will show how to retrieve data using server side code such as C# and PHP.</p>
<p><strong>Note:</strong> Data is stored in the cookie as JSON data then Base64 encoded to enable the survival through transport layers that are not 8-bit clean. JSON and base64 functions are included in the script and if trimmed out, provided they exist elsewhere, would reduce the size by 70%.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>Creating Cookies</h3>
<p>To create a cookie you call jCookies and must pass two properties, name and value.</p>
<pre class="brush:js">
$.jCookies({
    name : 'Listening To',
    value : { album : 'The Go Round', artist : 'Inf', rating : 9, thumbs_up : true}
});
</pre>
<p>As you can see you can store pretty much anything. By default cookies are set to expire after 27 days. You can edit the expiration by settings one of the following properties: seconds, minutes, hours, days. The value entered for these properties must be a valid number or they will be ignored.</p>
<pre class="brush:js">$.jCookies({ name : 'User', value : { username : 'Bob' , level : 5 }, minutes : 60 });</pre>
<p><strong>Note:</strong> If you plan on retrieving data from the server side via ASP.net keep the cookie data very simple. More on this later.</p>
<h3>Retrieving Cookies</h3>
<p>To retrieve a cookie you call jCookies and pass a single properties, get.</p>
<pre class="brush:js">
var listening_to = $.jCookies({ get : 'Listening To' });
    // response: { album : 'The Go Round', artist : 'Inf', rating : 9, thumbs_up : true}

var rutabaga = $.jCookies({ get : 'Rutabaga' }); // (cookie was set by another proces)
    // response: false
</pre>
<p>Data is returned just as you would expect it to. If there was no cookie stored with that name, the cookie has expired, or there was an error then the response would be false. If you want to see if there was an error with the cookie you can set the optional property error. By default this property is set to false.</p>
<pre class="brush:js">
var rutabaga = $.jCookies({ get : 'Rutabaga', error : true });
    /* response:
        Error : {
            arguments : undefined,
            message : "Invalid base64 data",
            stack : "—",
            type : undefined
        }
    */</pre>
<p>This is an error response from Chrome. Depending on your browser your results may vary.</p>
<h3>Erasing Cookies</h3>
<p>To erase a cookie you call jCookies and pass a single property, erase.</p>
<pre class="brush:js">
var erased_listening_to = $.jCookies({ erase : 'Listening To' });
    // response: true

var rutabaga = $.jCookies({ erase : 'Rutabaga' });
    // response: false
</pre>
<p>If a cookie existed and was erased successfully true is returned. If the cookie never existed false is returned.</p>
<h3>jCookies Server Side</h3>
<p>Dealing with HTTP Cookies created by jCookies on the server side is a cinch you simply need to Base64 decode the data then JSON decode the data.</p>
<h4>Setting cookie in JavaScript</h4>
<pre class="brush:js">$.jCookies({name:'user',value:{name:'brian',level:'awesome'}});
    // response: true</pre>
<h4>Retrieving the cookie in PHP</h4>
<pre class="brush:js">
&lt;?php print_r(json_decode(base64_decode($_COOKIE['user'], true))); ?&gt;
    /* response:
        stdClass Object
            (
            [name] =&gt; brian
            [level] =&gt; awesome
            )
    */</pre>
<p>With PHP it couldn&#8217;t be easier. In the demonstration above I am printing out the entire cookie.</p>
<h4>Retrieving the cookie in C#</h4>
<pre class="brush:js">
Dictionary&lt;string,object&gt; user =
  new JavaScriptSerializer().Deserialize&lt;Dictionary&lt;string,object&gt;&gt;
  (Encoding.UTF8.GetString(
	Convert.FromBase64String(Page.Request.Cookies["user"].Value)
  ));

Page.Response.Write("user : name  = " + (string) user["name"]);
</pre>
<p>With C# its a bit more difficult. You have to set the type of each bit of data that comes back before you can use it. That is why I am storing the data as Dictionary&lt;string,object&gt;. We set the property to string to make it accessible and set the value to object for casting later. If you knew exactly the format of the cookie beforehand you could always create your own class and store that data in that class.</p>
<p>That about does it. If you want to know more <a href="http://scottreeddesign.com" target="_blank">visit my site</a> or the <a href="http://plugins.jquery.com/project/jcookies" target="_blank">jQuery plugin page</a>.</p>
<p><a href="http://tympanus.net/Development/jcookies/jcookies.zip">Download jCookies</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/09/04/j-is-for-jcookies-http-cookie-handling-for-jquery/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Animated Skills Diagram with Raphaël</title>
		<link>http://tympanus.net/codrops/2011/04/22/animated-skills-diagram/</link>
		<comments>http://tympanus.net/codrops/2011/04/22/animated-skills-diagram/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 17:20:43 +0000</pubDate>
		<dc:creator>Marcin Dziewulski</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animated]]></category>
		<category><![CDATA[circular]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[diagram]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[raphael]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=4687</guid>
		<description><![CDATA[View demo Download source In this tutorial we will show you how to create a diagram using Raphaël &#8211; a small JavaScript library that is great for working with vector graphics. The idea is very simple: we will draw some arcs using mathematical functions and we&#8217;ll be displaying a skill percentage in a main circle [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://tympanus.net/Tutorials/AnimatedSkillsDiagram/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/04/animatedSkillsDiagram.jpg" alt="" title="animatedSkillsDiagram" width="580" height="315" class="aligncenter size-full wp-image-4691" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/AnimatedSkillsDiagram/" target="_blank">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/AnimatedSkillsDiagram/AnimatedSkillsDiagram.zip">Download source</a><br />
In this tutorial we will show you how to create a diagram using <a href="http://raphaeljs.com/" target="_blank">Raphaël</a> &#8211; a small JavaScript library that is great for working with vector graphics. The idea is very simple: we will draw some arcs using mathematical functions and we&#8217;ll be displaying a skill percentage in a main circle when we hover over those arcs.<br />
Let&#8217;s start with the markup.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>The HTML structure is going to consist of a main container with the class &#8216;get&#8217;. This container stores all data that we need to draw the arcs. Then we create a new div element with the id &#8216;diagram&#8217; which will be the container for the arcs:</p>
<pre class="brush:xml">&lt;div id="diagram"&gt;&lt;/div&gt;
&lt;div class="get"&gt;
	&lt;div class="arc"&gt;
		&lt;span class="text"&gt;jQuery&lt;/span&gt;
		&lt;input type="hidden" class="percent" value="95" /&gt;
		&lt;input type="hidden" class="color" value="#97BE0D" /&gt;
	&lt;/div&gt;
	&lt;div class="arc"&gt;

		&lt;span class="text"&gt;CSS3&lt;/span&gt;
		&lt;input type="hidden" class="percent" value="90" /&gt;
		&lt;input type="hidden" class="color" value="#D84F5F" /&gt;
	&lt;/div&gt;
	&lt;div class="arc"&gt;
		&lt;span class="text"&gt;HTML5&lt;/span&gt;
		&lt;input type="hidden" class="percent" value="80" /&gt;
		&lt;input type="hidden" class="color" value="#88B8E6" /&gt;

	&lt;/div&gt;
	&lt;div class="arc"&gt;
		&lt;span class="text"&gt;PHP&lt;/span&gt;
		&lt;input type="hidden" class="percent" value="53" /&gt;
		&lt;input type="hidden" class="color" value="#BEDBE9" /&gt;
	&lt;/div&gt;
	&lt;div class="arc"&gt;
		&lt;span class="text"&gt;MySQL&lt;/span&gt;
		&lt;input type="hidden" class="percent" value="45" /&gt;
		&lt;input type="hidden" class="color" value="#EDEBEE" /&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre>
<h3>The CSS</h3>
<p>In the CSS we will only do two things: hide the elements with the class &#8216;get&#8217; and set the width and height of the div with the id &#8216;diagram&#8217;:</p>
<pre class="brush:css">.get {
	display:none;
}

#diagram {
	float:left;
	width:600px;
	height:600px;
}</pre>
<h3>The JavaScript</h3>
<p>The main idea is to first create a new Raphael object (variable &#8216;r&#8217;) and draw our first circle with a radius that we specify in &#8216;rad&#8217;.<br />
Then we create a new circle in the Raphael object. We center the circle (x: 300px and y: 300px) and we add some text to it.</p>
<pre class="brush:js">var o = {
	init: function(){
		this.diagram();
	},
	random: function(l, u){
		return Math.floor((Math.random()*(u-l+1))+l);
	},
	diagram: function(){
		var r = Raphael('diagram', 600, 600),
			rad = 73;

		r.circle(300, 300, 85).attr({ stroke: 'none', fill: '#193340' });

		var title = r.text(300, 300, 'Skills').attr({
			font: '20px Arial',
			fill: '#fff'
		}).toFront();

	}
}</pre>
<p>Now, let&#8217;s go one step further.<br />
We&#8217;ll extend the Raphael object with some custom attributes:</p>
<ul>
<li>alpha &#8211; angle of the arc</li>
<li>random &#8211; random number from the specified range</li>
<li>sx, sy &#8211; start drawing from this point</li>
<li>x, y &#8211; end drawing at this point</li>
<li>path
<ul>
<li>M &#8211; move to the starting point. No line is drawn. All path data must begin with a &#8216;moveto&#8217; command.</li>
<li>A &#8211; radius-x, radius-y x-axis-rotation, large-arc-flag, sweep-flag, x, y (read more: <a href="#">https://developer.mozilla.org/en/SVG/Tutorial/Paths</a>)</li>
</ul>
</li>
</ul>
<pre class="brush:js">var o = {
	init: function(){
		this.diagram();
	},
	random: function(l, u){
		return Math.floor((Math.random()*(u-l+1))+l);
	},
	diagram: function(){
		var r = Raphael('diagram', 600, 600),
			rad = 73;

		r.circle(300, 300, 85).attr({ stroke: 'none', fill: '#193340' });

		var title = r.text(300, 300, 'Skills').attr({
			font: '20px Arial',
			fill: '#fff'
		}).toFront();

		r.customAttributes.arc = function(value, color, rad){
			var v = 3.6*value,
				alpha = v == 360 ? 359.99 : v,
				random = o.random(91, 240),
				a = (random-alpha) * Math.PI/180,
				b = random * Math.PI/180,
				sx = 300 + rad * Math.cos(b),
				sy = 300 - rad * Math.sin(b),
				x = 300 + rad * Math.cos(a),
				y = 300 - rad * Math.sin(a),
				path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha &gt; 180), 1, x, y]];
			return { path: path, stroke: color }
		}

		$('.get').find('.arc').each(function(i){
			var t = $(this),
				color = t.find('.color').val(),
				value = t.find('.percent').val(),
				text = t.find('.text').text();

			rad += 30;
			var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': 26 });

			z.mouseover(function(){
                this.animate({ 'stroke-width': 50, opacity: .75 }, 1000, 'elastic');
                if(Raphael.type != 'VML') //solves IE problem
					this.toFront();
				title.animate({ opacity: 0 }, 500, '&gt;', function(){
					this.attr({ text: text + '\n' + value + '%' }).animate({ opacity: 1 }, 500, '&lt;');
				});
            }).mouseout(function(){
				this.animate({ 'stroke-width': 26, opacity: 1 }, 1000, 'elastic');
            });
		});
	}
}</pre>
<p>Then we&#8217;ll retrieve all the data needed, such as the percentage value, the color of the arc and the text. We increase the radius value for each arc and finally create a new arc path.<br />
In the last step we are adding some animations on hover. When the mouse will be over the arc the title (which is placed in the main circle) is changing. Also, we&#8217;ll make the arc a little bit bigger.</p>
<h3>Conclusion</h3>
<p>In today&#8217;s tutorial you&#8217;ve learned some first steps on how to use Raphaël. It is a powerful library and you can do a lot of great stuff with it. Visit the <a href="http://raphaeljs.com/" target="_blank">Raphaël website</a> for more examples.</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/AnimatedSkillsDiagram/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/AnimatedSkillsDiagram/AnimatedSkillsDiagram.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/04/22/animated-skills-diagram/feed/</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
		<item>
		<title>Collective: Close Pixelate</title>
		<link>http://tympanus.net/codrops/2011/01/12/collective-close-pixelate/</link>
		<comments>http://tympanus.net/codrops/2011/01/12/collective-close-pixelate/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 10:35:58 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=3549</guid>
		<description><![CDATA[&#8220;Inspired by American portrait painter Chuck Close, this script converts an image into a pixelated version using an HTML5 canvas element. It&#8217;s basically a simple demo for canvas &#8220;imageData&#8221; functionality.&#8221; David DeSandro Created by David DeSandro Source http://desandro.com/resources/close-pixelate/ Demo http://desandro.com/resources/close-pixelate/]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://desandro.com/resources/close-pixelate/"><img src="http://tympanus.net/codrops/wp-content/uploads/2011/01/pixelate.jpg" alt="" title="pixelate" width="580" height="398" class="aligncenter size-full wp-image-3550" /></a></p>
<p>&#8220;Inspired by American portrait painter Chuck Close, this script converts an image into a pixelated version using an HTML5 canvas element. It&#8217;s basically a simple demo for canvas <a href="https://developer.mozilla.org/En/HTML/Canvas/Pixel_manipulation_with_canvas">&#8220;imageData&#8221;</a> functionality.&#8221; <em>David DeSandro</em></p>
<p>Created by</p>
<h2>David DeSandro</h2>
<h3>Source</h3>
<p><a href="http://desandro.com/resources/close-pixelate/">http://desandro.com/resources/close-pixelate/</a></p>
<h3>Demo</h3>
<p><a href="http://desandro.com/resources/close-pixelate/" target="_blank">http://desandro.com/resources/close-pixelate/</a><br />
<br/></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/01/12/collective-close-pixelate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collective: Real-time heatmap example with Javascript and HTMLCanvas</title>
		<link>http://tympanus.net/codrops/2010/11/12/collective-real-time-heatmap-example-with-javascript-and-htmlcanvas/</link>
		<comments>http://tympanus.net/codrops/2010/11/12/collective-real-time-heatmap-example-with-javascript-and-htmlcanvas/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 10:40:55 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[heat map]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=3065</guid>
		<description><![CDATA[The following generates a real-time image heatmap with javascript and the HTMLCanvas element depending on the user&#8217;s mouse movement. Source http://www.patrick-wied.at/static/heatmap/ Demo http://www.patrick-wied.at/static/heatmap/]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://www.patrick-wied.at/static/heatmap/"><img src="http://tympanus.net/codrops/wp-content/uploads/2010/11/HeatMap.jpg" alt="" title="HeatMap" width="580" height="366" class="aligncenter size-full wp-image-3066" /></a></p>
<p>The following generates a real-time image heatmap with javascript and the HTMLCanvas element depending on the user&#8217;s mouse movement.</p>
<h3>Source</h3>
<p><a href="http://www.patrick-wied.at/static/heatmap/" target="_blank">http://www.patrick-wied.at/static/heatmap/</a></p>
<h3>Demo</h3>
<p><a href="http://www.patrick-wied.at/static/heatmap/" target="_blank">http://www.patrick-wied.at/static/heatmap/</a></p>
<div style="margin-bottom:100px;"></div>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/11/12/collective-real-time-heatmap-example-with-javascript-and-htmlcanvas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collective: Drag and Drop Files in Browser</title>
		<link>http://tympanus.net/codrops/2010/07/07/collective-drag-and-drop-files-in-browser/</link>
		<comments>http://tympanus.net/codrops/2010/07/07/collective-drag-and-drop-files-in-browser/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 16:07:18 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[drag]]></category>
		<category><![CDATA[drop]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2573</guid>
		<description><![CDATA[This article shows how to implement Drag and Drop files in browser. Along with JavaScript code there are tip how to implement server side backend to handle uploaded files. Source http://www.ajaxline.com/drag-and-drop-files-in-browsers Demo http://www.ajaxline.com/drag-and-drop-files-in-browsers]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://www.ajaxline.com/drag-and-drop-files-in-browsers"><img src="http://tympanus.net/codrops/wp-content/uploads/2010/07/ajaxline_dragDrop.jpg" alt="" title="ajaxline_dragDrop" width="580" height="315" class="aligncenter size-full wp-image-2574" /></a></p>
<p>This article shows how to implement Drag and Drop files in browser. Along with JavaScript code there are tip how to implement server side backend to handle uploaded files.</p>
<h3>Source</h3>
<p><a href="http://www.ajaxline.com/drag-and-drop-files-in-browsers" target="_blank">http://www.ajaxline.com/drag-and-drop-files-in-browsers</a></p>
<h3>Demo</h3>
<p><a href="http://www.ajaxline.com/drag-and-drop-files-in-browsers" target="_blank">http://www.ajaxline.com/drag-and-drop-files-in-browsers</a></p>
<div style="margin-bottom:100px;"></div>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/07/07/collective-drag-and-drop-files-in-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collective: Animated table sort</title>
		<link>http://tympanus.net/codrops/2010/06/21/collective-animated-table-sort/</link>
		<comments>http://tympanus.net/codrops/2010/06/21/collective-animated-table-sort/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 22:34:46 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2405</guid>
		<description><![CDATA[This plugin allows you to animatedly sort a table based on a particular column. The various &#60;td&#62;s fly to their new homes, giving a nice effect. It also supports sorting on REGEXP matches. You can also control whether row relationships are maintained, whether it sorts on ascii or numeric and ascending or descending. Source http://mitya.co.uk/scripts/Table-sort&#8212;now-REGEXP-friendly-111 [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://mitya.co.uk/scripts/Table-sort---now-REGEXP-friendly-111"><img src="http://tympanus.net/codrops/wp-content/uploads/2010/06/animatedtablesort.jpg" alt="" title="animatedtablesort" width="580" height="320" class="aligncenter size-full wp-image-2407" /></a></p>
<p>This plugin allows you to animatedly sort a table based on a particular column. The various &lt;td&gt;s fly to their new homes, giving a nice effect. It also supports sorting on REGEXP matches. You can also control whether row relationships are maintained, whether it sorts on ascii or numeric and ascending or descending.</p>
<h3>Source</h3>
<p><a href="http://mitya.co.uk/scripts/Table-sort---now-REGEXP-friendly-111" target="_blank">http://mitya.co.uk/scripts/Table-sort&#8212;now-REGEXP-friendly-111</a></p>
<h3>Demo</h3>
<p><a href="http://mitya.co.uk/scripts/Table-sort---now-REGEXP-friendly-111#part3" target="_blank">http://mitya.co.uk/scripts/Table-sort&#8212;now-REGEXP-friendly-111#part3</a></p>
<div style="margin-bottom:100px;"></div>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/06/21/collective-animated-table-sort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fancy Sliding Form with jQuery</title>
		<link>http://tympanus.net/codrops/2010/06/07/fancy-sliding-form-with-jquery/</link>
		<comments>http://tympanus.net/codrops/2010/06/07/fancy-sliding-form-with-jquery/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 18:02:50 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[sliding]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2340</guid>
		<description><![CDATA[View demoDownload source Today we are going to create a fancy sliding form that shows some validation feedback to the user after each step. This form saves a lot of space and is easy to access &#8211; it basically works like a slide show, just that we have fieldsets of a form instead of images. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/FancySlidingForm/" target="_blank"><img class="aligncenter size-full wp-image-2351" title="FancySlidingForm" src="http://tympanus.net/codrops/wp-content/uploads/2010/06/FancySlidingForm.jpg" alt="" width="580" height="315" /></a><br />
<a class="demo" href="http://tympanus.net/Tutorials/FancySlidingForm/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/FancySlidingForm/FancySlidingForm.zip">Download source</a></p>
<p>Today we are going to create a fancy sliding form that shows some validation feedback to the user after each step. This form saves a lot of space and is easy to access &#8211; it basically works like a slide show, just that we have fieldsets of a form instead of images.</p>
<p>So let&#8217;s start!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>The HTML will consist of a wrapper container where we will place a form with fieldsets. Each fieldset will be a step in our sliding form:</p>
<pre class="brush:xml">&lt;h1&gt;Fancy Sliding Form with jQuery&lt;/h1&gt;
&lt;div id="wrapper"&gt;
	&lt;div id="steps"&gt;
		&lt;form id="formElem" name="formElem" action="" method="post"&gt;
			&lt;fieldset class="step"&gt;
				&lt;legend&gt;Account&lt;/legend&gt;
				&lt;p&gt;
					&lt;label for="username"&gt;User name&lt;/label&gt;
					&lt;input id="username" name="username" /&gt;
				&lt;/p&gt;
				&lt;p&gt;
					&lt;label for="email"&gt;Email&lt;/label&gt;
					&lt;input id="email" name="email" type="email" /&gt;
				&lt;/p&gt;
				&lt;p&gt;
					&lt;label for="password"&gt;Password&lt;/label&gt;
					&lt;input id="password" name="password" type="password" /&gt;
				&lt;/p&gt;
			&lt;/fieldset&gt;
			&lt;fieldset&gt;
			...
			&lt;/fieldset&gt;
		&lt;/form&gt;
	&lt;/div&gt;
	&lt;div id="navigation" style="display:none;"&gt;
		&lt;ul&gt;
			&lt;li class="selected"&gt;
				&lt;a href="#"&gt;Account&lt;/a&gt;
			&lt;/li&gt;
			&lt;li&gt;
				&lt;a href="#"&gt;Personal Details&lt;/a&gt;
			&lt;/li&gt;
			&lt;li&gt;
				&lt;a href="#"&gt;Payment&lt;/a&gt;
			&lt;/li&gt;
			&lt;li&gt;
				&lt;a href="#"&gt;Settings&lt;/a&gt;
			&lt;/li&gt;
			&lt;li&gt;
				&lt;a href="#"&gt;Confirm&lt;/a&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The navigation with all the links to the steps will be an unordered list that is initially hidden. We will show it in our JavaScript function.<br />
Let&#8217;s look at the style.</p>
<h3>The CSS</h3>
<p>The main wrapper and the steps container will have the following style:</p>
<pre class="brush:css">#wrapper{
    -moz-box-shadow:0px 0px 3px #aaa;
    -webkit-box-shadow:0px 0px 3px #aaa;
    box-shadow:0px 0px 3px #aaa;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
    border:2px solid #fff;
    background-color:#f9f9f9;
    width:600px;
    overflow:hidden;
}
#steps{
    width:600px;
    overflow:hidden;
}
.step{
    float:left;
    width:600px;
}
</pre>
<p>The class <strong>step</strong> will be given to each fieldset. Let&#8217;s style the navigation:</p>
<pre class="brush:css">#navigation{
    height:45px;
    background-color:#e9e9e9;
    border-top:1px solid #fff;
    -moz-border-radius:0px 0px 10px 10px;
    -webkit-border-bottom-left-radius:10px;
    -webkit-border-bottom-right-radius:10px;
    border-bottom-left-radius:10px;
    border-bottom-right-radius:10px;
}
#navigation ul{
    list-style:none;
	float:left;
	margin-left:22px;
}
#navigation ul li{
	float:left;
    border-right:1px solid #ccc;
    border-left:1px solid #ccc;
    position:relative;
	margin:0px 2px;
}
</pre>
<p>The single link elements will have a neat CSS3 gradient as background:</p>
<pre class="brush:css">#navigation ul li a{
    display:block;
    height:45px;
    background-color:#444;
    color:#777;
    outline:none;
    font-weight:bold;
    text-decoration:none;
    line-height:45px;
    padding:0px 20px;
    border-right:1px solid #fff;
    border-left:1px solid #fff;
    background:#f0f0f0;
    background:
        -webkit-gradient(
        linear,
        left bottom,
        left top,
        color-stop(0.09, rgb(240,240,240)),
        color-stop(0.55, rgb(227,227,227)),
        color-stop(0.78, rgb(240,240,240))
        );
    background:
        -moz-linear-gradient(
        center bottom,
        rgb(240,240,240) 9%,
        rgb(227,227,227) 55%,
        rgb(240,240,240) 78%
        )
}
#navigation ul li a:hover,
#navigation ul li.selected a{
    background:#d8d8d8;
    color:#666;
    text-shadow:1px 1px 1px #fff;
}
</pre>
<p>When a step get&#8217;s validated, we will either add a span indicating that everything is fine, or a span that shows that something is wrong in the form step:</p>
<pre class="brush:css">span.checked{
    background:transparent url(../images/checked.png) no-repeat top left;
    position:absolute;
    top:0px;
    left:1px;
    width:20px;
    height:20px;
}
span.error{
    background:transparent url(../images/error.png) no-repeat top left;
    position:absolute;
    top:0px;
    left:1px;
    width:20px;
    height:20px;
}
</pre>
<p>The styles for the form elements look as follows:</p>
<pre class="brush:css">#steps form fieldset{
    border:none;
    padding-bottom:20px;
}
#steps form legend{
    text-align:left;
    background-color:#f0f0f0;
    color:#666;
    font-size:24px;
    text-shadow:1px 1px 1px #fff;
    font-weight:bold;
    float:left;
    width:590px;
    padding:5px 0px 5px 10px;
    margin:10px 0px;
    border-bottom:1px solid #fff;
    border-top:1px solid #d9d9d9;
}
#steps form p{
    float:left;
    clear:both;
    margin:5px 0px;
    background-color:#f4f4f4;
    border:1px solid #fff;
    width:400px;
    padding:10px;
    margin-left:100px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    -moz-box-shadow:0px 0px 3px #aaa;
    -webkit-box-shadow:0px 0px 3px #aaa;
    box-shadow:0px 0px 3px #aaa;
}
#steps form p label{
    width:160px;
    float:left;
    text-align:right;
    margin-right:15px;
    line-height:26px;
    color:#666;
    text-shadow:1px 1px 1px #fff;
    font-weight:bold;
}
#steps form input:not([type=radio]),
#steps form textarea,
#steps form select{
    background: #ffffff;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    outline: none;
    padding: 5px;
    width: 200px;
    float:left;
}
#steps form input:focus{
    -moz-box-shadow:0px 0px 3px #aaa;
    -webkit-box-shadow:0px 0px 3px #aaa;
    box-shadow:0px 0px 3px #aaa;
    background-color:#FFFEEF;
}
#steps form p.submit{
    background:none;
    border:none;
    -moz-box-shadow:none;
    -webkit-box-shadow:none;
    box-shadow:none;
}
#steps form button {
	border:none;
	outline:none;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    color: #ffffff;
    display: block;
    cursor:pointer;
    margin: 0px auto;
    clear:both;
    padding: 7px 25px;
    text-shadow: 0 1px 1px #777;
    font-weight:bold;
    font-family:"Century Gothic", Helvetica, sans-serif;
    font-size:22px;
    -moz-box-shadow:0px 0px 3px #aaa;
    -webkit-box-shadow:0px 0px 3px #aaa;
    box-shadow:0px 0px 3px #aaa;
    background:#4797ED;
}
#steps form button:hover {
    background:#d8d8d8;
    color:#666;
    text-shadow:1px 1px 1px #fff;
}
</pre>
<p>And now, let&#8217;s add some JavaScript magic!</p>
<h3>The JavaScript</h3>
<p>In our function we will first take care of the display of the slider. For that we need to calculate the width of the elements inside. We will also take care of the sliding when we tab through the inputs. When the user hits tab when he is in the last input of a fieldset, we make the next fieldset slide into place and focus on the first field.</p>
<p>The validation of the form is based on all inputs being required fields. If we slide to the next fieldset and did not fill out all the inputs of the previous one, we will mark the missing inputs with a red background and add our little error span to the navigation item. If everything was fine, we will add the span with the check mark so that the user knows, the step was correct. We will not allow the user to submit the form if one of the steps contains errors.</p>
<pre class="brush:js">$(function() {
	/*
	number of fieldsets
	*/
	var fieldsetCount = $('#formElem').children().length;

	/*
	current position of fieldset / navigation link
	*/
	var current 	= 1;

	/*
	sum and save the widths of each one of the fieldsets
	set the final sum as the total width of the steps element
	*/
	var stepsWidth	= 0;
    var widths 		= new Array();
	$('#steps .step').each(function(i){
        var $step 		= $(this);
		widths[i]  		= stepsWidth;
        stepsWidth	 	+= $step.width();
    });
	$('#steps').width(stepsWidth);

	/*
	to avoid problems in IE, focus the first input of the form
	*/
	$('#formElem').children(':first').find(':input:first').focus();	

	/*
	show the navigation bar
	*/
	$('#navigation').show();

	/*
	when clicking on a navigation link
	the form slides to the corresponding fieldset
	*/
    $('#navigation a').bind('click',function(e){
		var $this	= $(this);
		var prev	= current;
		$this.closest('ul').find('li').removeClass('selected');
        $this.parent().addClass('selected');
		/*
		we store the position of the link
		in the current variable
		*/
		current = $this.parent().index() + 1;
		/*
		animate / slide to the next or to the corresponding
		fieldset. The order of the links in the navigation
		is the order of the fieldsets.
		Also, after sliding, we trigger the focus on the first
		input element of the new fieldset
		If we clicked on the last link (confirmation), then we validate
		all the fieldsets, otherwise we validate the previous one
		before the form slided
		*/
        $('#steps').stop().animate({
            marginLeft: '-' + widths[current-1] + 'px'
        },500,function(){
			if(current == fieldsetCount)
				validateSteps();
			else
				validateStep(prev);
			$('#formElem').children(':nth-child('+ parseInt(current) +')').find(':input:first').focus();
		});
        e.preventDefault();
    });

	/*
	clicking on the tab (on the last input of each fieldset), makes the form
	slide to the next step
	*/
	$('#formElem &gt; fieldset').each(function(){
		var $fieldset = $(this);
		$fieldset.children(':last').find(':input').keydown(function(e){
			if (e.which == 9){
				$('#navigation li:nth-child(' + (parseInt(current)+1) + ') a').click();
				/* force the blur for validation */
				$(this).blur();
				e.preventDefault();
			}
		});
	});

	/*
	validates errors on all the fieldsets
	records if the form has errors in $('#formElem').data()
	*/
	function validateSteps(){
		var FormErrors = false;
		for(var i = 1; i &lt; fieldsetCount; ++i){
			var error = validateStep(i);
			if(error == -1)
				FormErrors = true;
		}
		$('#formElem').data('errors',FormErrors);
	}

	/*
	validates one fieldset
	and returns -1 if errors found, or 1 if not
	*/
	function validateStep(step){
		if(step == fieldsetCount) return;

		var error = 1;
		var hasError = false;
		$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input:not(button)').each(function(){
			var $this 		= $(this);
			var valueLength = jQuery.trim($this.val()).length;

			if(valueLength == ''){
				hasError = true;
				$this.css('background-color','#FFEDEF');
			}
			else
				$this.css('background-color','#FFFFFF');
		});
		var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a');
		$link.parent().find('.error,.checked').remove();

		var valclass = 'checked';
		if(hasError){
			error = -1;
			valclass = 'error';
		}
		$('&lt;span class="'+valclass+'"&gt;&lt;/span&gt;').insertAfter($link);

		return error;
	}

	/*
	if there are errors don't allow the user to submit
	*/
	$('#registerButton').bind('click',function(){
		if($('#formElem').data('errors')){
			alert('Please correct the errors in the Form');
			return false;
		}
	});
});
</pre>
<p>And that&#8217;s it! I hope you liked the sliding form idea!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/FancySlidingForm/" target="_blank">View demo</a><a class="download" href="http://tympanus.net/Tutorials/FancySlidingForm/FancySlidingForm.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
<div class="partner_section_post"><span>Message from Testking</span>Get professional <a href="http://www.testkingsite.com/cisco/CCDA.html">testking ccda</a>  training to learn about critical web design  tools and become expert in web design  using <a href="http://www.testkingsite.com/microsoft/MCTS.html">testking mcts</a> tutorials and <a href="http://www.testkingsite.com/microsoft/MCITP.html">testking mcitp</a> live demos.</div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/06/07/fancy-sliding-form-with-jquery/feed/</wfw:commentRss>
		<slash:comments>183</slash:comments>
		</item>
		<item>
		<title>Collective: Analog Clock using Javascript &amp; Raphael</title>
		<link>http://tympanus.net/codrops/2010/05/12/collective-analog-clock-using-javascript-raphael/</link>
		<comments>http://tympanus.net/codrops/2010/05/12/collective-analog-clock-using-javascript-raphael/#comments</comments>
		<pubDate>Wed, 12 May 2010 10:30:53 +0000</pubDate>
		<dc:creator>Community</dc:creator>
				<category><![CDATA[Collective]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rotate]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=2088</guid>
		<description><![CDATA[For the clock, I have used images of different dials (which I have downloaded from google) as background. Upon which the clock is drawn through Raphaël.  Luckily, for me, the center of these dials images exactly coincides with the center for clock. Another option I provided in the demo is to change the color of [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Digg Digg Disabled --></p>
<p><a href="http://rohitsengar.cueblocks.net/analog-clock-using-javascript-raphael/"><img class="aligncenter size-full wp-image-2089" title="clock" src="http://tympanus.net/codrops/wp-content/uploads/2010/05/clock.gif" alt="" width="580" height="328" /></a></p>
<p>For the clock, I have used images of different dials (which I have downloaded from google) as background. Upon which the clock is drawn through Raphaël.  Luckily, for me, the center of these dials images exactly coincides with the center for clock. Another option I provided in the demo is to change the color of second, minute and hour hand of the clock according to the dial selected by the user.</p>
<h3>Source</h3>
<p><a href="http://rohitsengar.cueblocks.net/analog-clock-using-javascript-raphael/" target="_blank">http://rohitsengar.cueblocks.net/analog-clock-using-javascript-raphael/</a></p>
<h3>Demo</h3>
<p><a href="http://rohitsengar.cueblocks.net/analog-clock/" target="_blank">http://rohitsengar.cueblocks.net/analog-clock/</a></p>
<p><!-- wp_ad_camp_1 --></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2010/05/12/collective-analog-clock-using-javascript-raphael/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/tag/javascript/feed/ ) in 0.29494 seconds, on Feb 8th, 2012 at 5:41 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 6:41 pm UTC -->
