<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>eTechy101.com</title>
	
	<link>http://www.etechy101.com</link>
	<description />
	<lastBuildDate>Wed, 26 Oct 2011 05:03:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Etechy101" /><feedburner:info uri="etechy101" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Etechy101</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/Etechy101" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2FEtechy101" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Creating Flying Menu with CSS3</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/NoZj-3q2chw/creating-flying-menu-with-css3.html</link>
		<comments>http://www.etechy101.com/css/creating-flying-menu-with-css3.html#comments</comments>
		<pubDate>Thu, 13 Oct 2011 20:37:03 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[CSS & CSS3]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css flying menu]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[css3 flying menu]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=973</guid>
		<description><![CDATA[Among the various forms of task bars and menus that can be created with the help of CSS3 only, the flying menu is one interesting yet easy to implement type. This menu would be implemented in this tutorial with the use of CSS3 only. The transition propertyof CSS3 would be used in this implementation which [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fcreating-flying-menu-with-css3.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fcreating-flying-menu-with-css3.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Among the various forms of task bars and menus that can be created with the help of CSS3 only, the flying menu is one interesting yet easy to implement type. This menu would be implemented in this tutorial with the use of CSS3 only. The transition propertyof CSS3 would be used in this implementation which is quite powerful and allows the creation of animations without any need of JavaScript or Flash. To begin with the implementation, you would need to create the menu with unordered list, which can be done with simple HTML5 and has been discussed in some of the previous tutorials, so we would skip this part.<br />
<span id="more-973"></span><br />
To start with, we would need HTML tags to place the CSS IDs and classes within:</p>
<pre>
&lt;ul id="fly-menu"&gt;
&lt;li&gt;
&lt;a href="http://www.etechy101.com"&gt;
&lt;img src="images/heart.png" alt="etechy101.com"&gt; Etechy101 Home
&lt;/a&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;a href="http://feeds.feedburner.com/Etechy101"&gt;
&lt;img src="images/rss.png" alt="rss"&gt; Subscribe RSS Feed
&lt;/a&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;a href="http://feedburner.google.com/fb/a/mailverify?uri=Etechy101"&gt;
&lt;img src="images/email.png" alt="email"&gt; Subscribe Email
&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;
&lt;a href="http://twitter.com/StarcomSystems"&gt;
&lt;img src="images/twitter.png" alt="twitter"&gt; Follow Twitter
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>The list that would be implemented would be, by default, arranged vertically and to adjust it in a horizontal position, the CSS3 property of float would be used with ‘left’ value:</p>
<pre>
.cleaner {
clear: both;
}

#fly-menu, #fly-glow-menu {
margin: 1em auto 0 auto;
}

#fly-menu li, #fly-glow-menu li {
list-style-type: none;
margin-right: .5em;
float: left;
font-size: 15px;
background: #cacaca;
padding: 10px;
cursor: pointer;
-webkit-box-shadow: inset 0px 0px 10px rgba(0,0,0, .3);
-moz-box-shadow: inset 0px 0px 10px rgba(0,0,0, .3);
box-shadow: inset 0px 0px 10px rgba(0,0,0, .3);
-webkit-transition: .3s ease-in-out;
-moz-transition: .3s ease-in-out;
-o-transition: .3s ease-in-out;
}
</pre>
<p>Now we need to give the floating effect to the menu elements with the help of the :hover property. With this property, the menu would float when we hover upon it.</p>
<pre>
#fly-glow-menu li:hover {
margin-top: -1em;
background: #fff;
-webkit-box-shadow: 0px 0px 10px rgba(0,0,0, .3);
-moz-box-shadow: 0px 0px 10px rgba(0,0,0, .3);
box-shadow: 0px 0px 10px rgba(0,0,0, .3);
}
</pre>
<p>And this completes the easy and simple implementation of a flying menu in which we don’t need anything other than CSS3. The menu can be used on personal blogs and websites to increase the beauty or according to preference.</p>
<div class="shr-publisher-973"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/NoZj-3q2chw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/css/creating-flying-menu-with-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/css/creating-flying-menu-with-css3.html</feedburner:origLink></item>
		<item>
		<title>Web Storage Specifications for HTML5</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/hWP8Eol3fuA/web-storage-specifications-for-html5.html</link>
		<comments>http://www.etechy101.com/html5/web-storage-specifications-for-html5.html#comments</comments>
		<pubDate>Wed, 12 Oct 2011 20:30:20 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[local storage html5]]></category>
		<category><![CDATA[web storage html5]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=970</guid>
		<description><![CDATA[Local storage over the internet is supported by most of the modern browsers. This local storage provides functionality similar to that of cookies, but it is different from cookies to some extent. In a sense, the storage provided by this method is much more refined and better compared to simple cookie storage. In this method, [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fweb-storage-specifications-for-html5.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fweb-storage-specifications-for-html5.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Local storage over the internet is supported by most of the modern browsers. This local storage provides functionality similar to that of cookies, but it is different from cookies to some extent. In a sense, the storage provided by this method is much more refined and better compared to simple cookie storage. In this method, data stored in a browser would only be deleted from the local machine when requested to do so by the user. Generally, a browser will always avoid deleting data while a script that could access that data is running. Web browsers expose Web Storage through the localStorage object in JavaScript. One easy way to determine whether a Web Browser can support Web Storage is to execute this JavaScript code:<span id="more-970"></span></p>
<pre>var webStorageSupported = ('localStorage' in window) &amp;&amp; window['localStorage'] !== null;</pre>
<p>There is a certain set of methods that is implemented by local storage to undertake the task of data storage. Important methods and properties are discussed below:</p>
<pre>interface Storage {
readonly long &lt;strong&gt;length&lt;/strong&gt;;
void &lt;strong&gt;setItem(String key, Object data)&lt;/strong&gt;;
Object &lt;strong&gt;getItem(String key)&lt;/strong&gt;;
void &lt;strong&gt;removeItem(String key)&lt;/strong&gt;;
void &lt;strong&gt;clear()&lt;/strong&gt;;
String &lt;strong&gt;key(long index)&lt;/strong&gt;;
};</pre>
<p>[inline_ads]<br />
The length property is very useful. It will return the number of key/value pairs currently saved to Local Storage under the currently accessed domain:</p>
<pre>alert(localStorage.length);</pre>
<p>In case there isn’t any keyword previously stored in the local storage, then the above script will display an alert window with “0″ as the message, otherwise the message will be the number of persisted key/value pairs.</p>
<p>Another important method is setItem(key, value)which saves a new entry on the local machine. For this purpose, following code is executed:</p>
<pre>localStorage.setItem('name', 'arman');</pre>
<p>We also have another noteworthy method named getItem(key) whose purpose is to ensure that key name (in the above script) was truly saved to the local storage with the value arman.</p>
<pre>localStorage.setItem('name', 'arman');
var value = localStorage.getItem('name');
alert(value);</pre>
<p>There are a lot of other important methods used in local storage to provide much more efficient storage compared to cookies. Some of the further methods and properties would be discussed in a future tutorial.</p>
<div class="shr-publisher-970"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/hWP8Eol3fuA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/html5/web-storage-specifications-for-html5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/html5/web-storage-specifications-for-html5.html</feedburner:origLink></item>
		<item>
		<title>Benefiting from Multiple Backgrounds in CSS3</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/u9ICReVP4ag/benefiting-from-multiple-backgrounds-in-css3.html</link>
		<comments>http://www.etechy101.com/css/benefiting-from-multiple-backgrounds-in-css3.html#comments</comments>
		<pubDate>Tue, 11 Oct 2011 19:50:28 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[CSS & CSS3]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=966</guid>
		<description><![CDATA[The property of multiple backgrounds in CSS3 is very powerful and can be used for a variety of purposes in web development and programming. But still many people using CSS3 do not make the right use of this feature. Initially, this feature existed only in Safari but eventually all the updated browsers were equipped with [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fbenefiting-from-multiple-backgrounds-in-css3.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fbenefiting-from-multiple-backgrounds-in-css3.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>The property of multiple backgrounds in CSS3 is very powerful and can be used for a variety of purposes in web development and programming. But still many people using CSS3 do not make the right use of this feature. Initially, this feature existed only in Safari but eventually all the updated browsers were equipped with this support. To add multiple backgrounds in your page, you need to go through the simple process of adding a background and after that, add this piece of code after a comma:</p>
<pre>div {
background-image: url(image1.jpg), url(image2.jpg);
}</pre>
<p>But another important thing is to define the location of the background image without which it might not work properly. Defining the position of the image is done in, more or less, the ordinary way. For multiple backgrounds, all you need to do is to repeat the process.</p>
<pre>div {
background-image:     url(image1.jpg),  url(image2.jpg);
background-position:  top left,         bottom right;
background-repeat:    no-repeat,      repeat-y;
}</pre>
<p>Adding more than two images can also be performed in an easier way:</p>
<pre>div {
background-image:
url(image1.jpg), url(image2.jpg), url(image3.jpg);
}</pre>
<p>The following code would comprehensively add multiple images in the background and would also make boxes with rounded edges that resize perfectly well:</p>
<pre>div {
background: url(images/middle.gif);
color: white;
padding: 12px;
background-image:
url (images/bottomleft.gif), url(images/bottomright.gif),
url (images/topleft.gif), url(images/topright.gif),
url (images/top.gif), url(images/bottom.gif),
url (images/left.gif), url(images/right.gif),
url (images/middle.gif);
background-position:
bottom left, bottom right, top left, top right, top left,
bottom right, top left, top right, bottom left;
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat-x,
repeat-x, repeat-y, repeat-y, repeat;
}</pre>
<p>This completes the attainment of the multiple backgrounds. The process is quite simple and straightforward and for anyone having prior knowledge of CSS3, this can be performed within a few minutes.</p>
<div class="shr-publisher-966"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/u9ICReVP4ag" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/css/benefiting-from-multiple-backgrounds-in-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/css/benefiting-from-multiple-backgrounds-in-css3.html</feedburner:origLink></item>
		<item>
		<title>Creating Simple Puzzle Game with HTML5 Canvas</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/f94j9cNtdFg/creating-simple-puzzle-game-with-html5-canvas.html</link>
		<comments>http://www.etechy101.com/html5/creating-simple-puzzle-game-with-html5-canvas.html#comments</comments>
		<pubDate>Mon, 10 Oct 2011 12:41:51 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=961</guid>
		<description><![CDATA[A lot of interesting developments can be performed with the help of HTML5 &#60;canvas&#62; element. In today’s tutorial, we would create a simple puzzle game with the help of this element. The HTML and CSS that we would need for initial stages is quite easy to comprehend. Specifically, we would need &#60;canvas&#62; element with specified [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fcreating-simple-puzzle-game-with-html5-canvas.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fcreating-simple-puzzle-game-with-html5-canvas.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A lot of interesting developments can be performed with the help of HTML5 &lt;canvas&gt; element. In today’s tutorial, we would create a simple puzzle game with the help of this element. The HTML and CSS that we would need for initial stages is quite easy to comprehend. Specifically, we would need &lt;canvas&gt; element with specified ID and a container styled with some CSS:</p>
<pre>&lt;div id="lightcontainer"&gt;
&lt;canvas id="lightpanel" width="500" height="500"&gt;&lt;/canvas&gt;
&lt;/div&gt;

#lightcontainer { margin:20px auto; width:500px; }
#lightpanel { background-color:#002B33;
-moz-box-shadow:0 0 5px #999; -moz-border-radius:10px;
-webkit-box-shadow:0 0 5px #999; -webkit-border-radius:10px;
box-shadow:0 0 5px #999; border-radius:10px;
}</pre>
<p>[inline_ads]<br />
<span id="more-961"></span>A brief explanation of the steps involved in development is in order. First of all, we need to create a field with 5 by 5 light panels. Since the light switch in the game turns on and off at regular intervals, we need to apply that logic accordingly. The starting position and coordinates of the game can be adjusted with the help of JavaScript.</p>
<pre>$("#lightpanel").click(function(e) {
// e will give us absolute x, y so we need to calculate relative to canvas position
var pos = $("#lightpanel").position();
var ox = e.pageX - pos.left;
var oy = e.pageY - pos.top;
// Check which fields we need to flip
// 100 = width of the tile
var yField = Math.floor(oy / 100);
var xField = Math.floor(ox / 100);
// The field itself
lightField[yField][xField] = lightField[yField][xField] == "x" ? "o" : "x";
repaintPanel();
});</pre>
<p>Code for the remaining directions can be added accordingly. The function repaintPenal () is explained as follows:</p>
<pre>function repaintPanel() {
var canvas = document.getElementById("lightpanel");
if (!canvas.getContext){
alert("This demo requires a browser that supports the &lt;canvas&gt; element.");
return;
} else {
clear();
var ctx = canvas.getContext("2d");
var allLightsAreOff = true;
for(var i = 0; i &lt; lightField.length; i++) { // Rows
for (var j = 0; j &lt; lightField[i].length; j++) { // Columns
ctx.lineWidth = 3;
ctx.strokeStyle = "#83BD08";
ctx.beginPath();
// arc( x, y, radius, startAngle, endAngle, anticlockwise)
ctx.arc(j * 100 + 50, i * 100 + 50, 40, 0, Math.PI*2, true);
// Actual draw of the border
ctx.stroke();
// Check if we need to fill the border
if(lightField[i][j] == "x") {
ctx.fillStyle = "#FFBD38";
ctx.beginPath();
ctx.arc(j * 100 + 50, i * 100 + 50, 38, 0, Math.PI*2, true);
ctx.fill();
// Since we need to fill this field, not all the lights are off
allLightsAreOff = false;
}
}
}

// Check if all the lights are off
if(allLightsAreOff) {
// User can't click anymore
userCanClick = false;
// Show message
alert("All lights are off, you finished the game!");
}
}
}</pre>
<p>Above function was the most important in the implementation of this simple game and with this, you can try out this game on your browser. It might not be as good as the original version of the game but you would certainly enjoy it.</p>
<div class="shr-publisher-961"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/f94j9cNtdFg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/html5/creating-simple-puzzle-game-with-html5-canvas.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/html5/creating-simple-puzzle-game-with-html5-canvas.html</feedburner:origLink></item>
		<item>
		<title>Developing feed widget in CSS3</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/_ml7yRbhxw8/developing-feed-widget-in-css3.html</link>
		<comments>http://www.etechy101.com/css/developing-feed-widget-in-css3.html#comments</comments>
		<pubDate>Sun, 02 Oct 2011 18:23:45 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[CSS & CSS3]]></category>
		<category><![CDATA[css3 code samples]]></category>
		<category><![CDATA[css3 widgets]]></category>
		<category><![CDATA[feed widget css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[html5 examples]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=954</guid>
		<description><![CDATA[CSS3 in conjunction with JQuery can be used to develop an attractive feed widget which would display the feed on blog or website’s sidebar. This can be used to display the latest posts, news or comments present on the website. The choice between different feed formats can be set according to the requirement. First of [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fdeveloping-feed-widget-in-css3.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fdeveloping-feed-widget-in-css3.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>CSS3 in conjunction with JQuery can be used to develop an attractive feed widget which would display the feed on blog or website’s sidebar. This can be used to display the latest posts, news or comments present on the website. The choice between different feed formats can be set according to the requirement. First of all, we need to set the HTML structure of the widget. For this, we would use the following code:</p>
<pre>
&lt;div id="feedWidget"&gt;

&lt;div id="activeTab"&gt;
&lt;!-- The name of the current tab is inserted here --&gt;
&lt;/div&gt;

&lt;div class="line"&gt;&lt;/div&gt;

&lt;div id="tabContent"&gt;
&lt;!-- The feed items are inserted here --&gt;
&lt;/div&gt;

&lt;/div&gt;
</pre>
<p>After this comes the part of CSS3, which would be used to style the widget. Only the styles that are directly used by the widget are included here.<span id="more-954"></span></p>
<pre>
#feedWidget{
background:url(img/bg.png) repeat-x #47525c;
border:2px solid #48535e;
margin:0 auto;
width:200px;
padding:5px;
position:relative;

/* Remains hidden if JS is not enabled: */

display:none;
z-index:20;
}

#activeTab.hover,.dropDownList{
background:url(img/drop_arrow.png) no-repeat 95% 50% #47525c;
border:1px solid #38434d;
margin:-1px;
cursor:pointer;

/* CSS3 round corners: */

-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}

#activeTab,.dropDownList div{
color:white;
cursor:pointer;
font-size:20px;
margin:0 2px 0 0;
padding:5px;
text-shadow:0 1px 1px black;
}
</pre>
<p>In the above code, special hover class has been defined for the #activeTab div. instead of the regular :hover pseudo-class. This has been done because the later is more appropriate only when multiple tabs need to be shown. After CSS3, we make use of JQuery for specifying the declarations of different feeds and handling the output of those feeds.</p>
<pre>
$(document).ready(function(){
/* Counting the tabs: */
var totalTabs=0;
$.each(tabs,function(){totalTabs++;})
$('#feedWidget').show().mouseleave(function(){

/* If the cursor left the widet, hide the drop down list: */
$('.dropDownList').remove();
$('#activeTab').removeClass('hover');
})

.mouseenter(function(){
if(totalTabs&gt;1) $('#activeTab').addClass('hover');
}};

$('#activeTab').click(showDropDown);
$('.dropDownList div').live('click',function(){
showDropDown();
showTab($(this).text());
});

showTab('@tutorialzine');
}};
</pre>
<p>You can create additional functions and include them in the tabs object. This would further enhance the functionality of your feed widget.</p>
<div class="shr-publisher-954"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/_ml7yRbhxw8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/css/developing-feed-widget-in-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/css/developing-feed-widget-in-css3.html</feedburner:origLink></item>
		<item>
		<title>Creating a Portfolio with HTML5</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/o2oNHhyqqrQ/creating-a-portfolio-with-html5.html</link>
		<comments>http://www.etechy101.com/html5/creating-a-portfolio-with-html5.html#comments</comments>
		<pubDate>Sat, 01 Oct 2011 13:27:02 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[css3 examples]]></category>
		<category><![CDATA[html5 canvas]]></category>
		<category><![CDATA[html5 examples]]></category>
		<category><![CDATA[html5 portfolio]]></category>
		<category><![CDATA[html5 tags]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=946</guid>
		<description><![CDATA[You can create a completely customizable portfolio with the help of HTML5 and optionally using JQuery. First of all, we would need to write a markup for the HTML5 document, after which we would proceed on to the JQuery code. The markup HTML5 code is as follows: &#60;html&#62; &#60;head&#62; &#60;meta charset="utf-8" /&#62; &#60;title&#62;Making an HTML5 Portfolio - [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fcreating-a-portfolio-with-html5.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fcreating-a-portfolio-with-html5.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>You can create a completely customizable portfolio with the help of HTML5 and optionally using JQuery. First of all, we would need to write a markup for the HTML5 document, after which we would proceed on to the JQuery code. The markup HTML5 code is as follows:</p>
<pre>&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8" /&gt;
&lt;title&gt;Making an HTML5 Portfolio - eTechy101.com Demo&lt;/title&gt;
&lt;link rel="stylesheet" href="assets/css/styles.css" /&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;header&gt;
&lt;h1&gt;My Portfolio&lt;/h1&gt;
&lt;/header&gt;

&lt;nav id="filter"&gt;
&lt;/nav&gt;

&lt;section id="container"&gt;
&lt;ul id="stage"&gt;
&lt;/ul&gt;
&lt;/section&gt;

&lt;footer&gt;
&lt;/footer&gt;</pre>
<p><span id="more-946"></span>[inline_ads]<br />
You would see certain new HTML5 elements in the above code which were not part of the previous versions. The main heading would be included in the holder element while unsorted detail of all the required lists would be inserted in the section element. Additionally, we would need a content filter which would be styled as a green bar under thenevelement. All the portfolio items would be included in the #stage list which is unordered for the time being.</p>
<p>The items would further be explained in a piece of code given below where each of them would have an HTML5 data attribute defining a series of comma separated tags. Recording of tags and creation of categories would be done latter with the use of JQuery. So the items along with their tags are:</p>
<pre>&lt;li data-tags="Print Design"&gt;
&lt;img src="assets/img/shots/1.jpg" /&gt;
&lt;/li&gt;
&lt;li data-tags="Logo Design,Print Design"&gt;
&lt;img src="assets/img/shots/2.jpg" /&gt;
&lt;/li&gt;
&lt;li data-tags="Web Design,Logo Design"&gt;
&lt;img src="assets/img/shots/3.jpg" /&gt;
&lt;/li&gt;</pre>
<p>Now comes the work of JQuery which is to loop through the portfolio items in the #stage list and at the same time, create an unordered list for every tag that it comes across. A new menu option would also be created with JQuery:</p>
<pre>$(document).ready(function(){
var items = $('#stage li'),
itemsByTags = {};
items.each(function(i){
var elem = $(this),
tags = elem.data('tags').split(',');
elem.attr('data-id',i);
$.each(tags,function(key,value){
value = $.trim(value);
if(!(value in itemsByTags)){
itemsByTags[value] = [];
}
itemsByTags[value].push(elem);
});
});</pre>
<p>Tags are added in the form of an array to the itemsByTags object. So basically itemsByTags would be holding the array of the items having Web Design among their tags. What now remains is styling the page which can further be done with the help of CSS.</p>
<div class="shr-publisher-946"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/o2oNHhyqqrQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/html5/creating-a-portfolio-with-html5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/html5/creating-a-portfolio-with-html5.html</feedburner:origLink></item>
		<item>
		<title>CSS3: Creating Liquid Faux Columns with Background</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/KJMu9tZ6lFM/css3-creating-liquid-faux-columns-with-background.html</link>
		<comments>http://www.etechy101.com/css/css3-creating-liquid-faux-columns-with-background.html#comments</comments>
		<pubDate>Thu, 29 Sep 2011 07:20:28 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[CSS & CSS3]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css backgrounds]]></category>
		<category><![CDATA[css liquid faux columns]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=940</guid>
		<description><![CDATA[Using faux columns is a technique to create a background image which simulates equal-height columns. However, the drawback with the simple technique that was used previously was that it only worked with fixed-width columns. That problem was overcome with the advent of liquid faux columns, which uses some background-position trickery and a bit of math to create a [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fcss3-creating-liquid-faux-columns-with-background.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fcss3-creating-liquid-faux-columns-with-background.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Using faux columns is a technique to create a background image which simulates equal-height columns. However, the drawback with the simple technique that was used previously was that it only worked with fixed-width columns. That problem was overcome with the advent of liquid faux columns, which uses some background-position trickery and a bit of math to create a variable-width effect. With the introduction of background-size in Safari and Opera, however, faux columns are about to become a lot easier; all you need to do is create a background image and assign a percentage value to background-size, allowing the image to expand or contract with its containing box.</p>
<p>The way this is done is with a simple PNG image; here we’ve made it 1000px wide, with two colored columns of 250px each, so that it’s easier to calculate column widths. The background-image has been set on the html element, which has been assigned a width of 90%. Inside this there is a container div with a width of 100%, and three columns with the widths set at the same ratio as the background image:<span id="more-940"></span></p>
<pre>&lt;div id="container"&gt;
&lt;div id="one"&gt; &lt;/div&gt;
&lt;div id="two"&gt; &lt;/div&gt;
&lt;div id="tre"&gt; &lt;/div&gt;
&lt;/div&gt; 

#container {
position: relative;
width: 100%;
} 

#one {
margin: 0 25%;
} 

#two, #tre {
position: absolute;
top: 0;
width: 25%;
} 

#two {
left: 0;
} 

#tre {
right: 0;
}</pre>
<p>[inline_ads]<br />
The html element has the background-size declaration applied to it, with a percentage value to make it liquid, using the browser-specific prefixes followed by the proposed declaration (for safety):</p>
<p>html { background-image: url(&#8216;opera_bg.png&#8217;); -khtml-background-size: 100%; -o-background-size: 100%; -webkit-background-size: 90%; background-size: 100%; background-position: 50% 0; background-repeat: repeat-y; width: 90%;</p>
<p>Webkit value is different from the others; during this test, it seems that Webkit obtains its width from the entire browser window, not from the containing element; therefore, we have to set this value to be equal to the width of the containing element. After that the background-position and background-repeat declarations have been added; background-repeat to tile the image down the page, and background-position because Webkit seems to ignore the margin values and puts the image at top left of the browser window; this is only necessary if you’re centre-aligning your page. This was just a short glimpse at the technique whose applications can further be explored.</p>
<div class="shr-publisher-940"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/KJMu9tZ6lFM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/css/css3-creating-liquid-faux-columns-with-background.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/css/css3-creating-liquid-faux-columns-with-background.html</feedburner:origLink></item>
		<item>
		<title>Structural tags in HTML5</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/in5_w2gdeQQ/structural-tags-in-html5.html</link>
		<comments>http://www.etechy101.com/html5/structural-tags-in-html5.html#comments</comments>
		<pubDate>Sat, 24 Sep 2011 19:18:56 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[html5 code samples]]></category>
		<category><![CDATA[html5 structural tags]]></category>
		<category><![CDATA[html5 tags]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=934</guid>
		<description><![CDATA[Although common tags were present in the previous versions of HTML, HTML5 introduced special structural tags which considerably enhanced the power and ease of web programming. For a majority of everyday programming, these tags would eventually replace many of the typical div entries from the code. The definition of the structure starts with the tag: [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fstructural-tags-in-html5.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fstructural-tags-in-html5.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Although common tags were present in the previous versions of HTML, HTML5 introduced special structural tags which considerably enhanced the power and ease of web programming. For a majority of everyday programming, these tags would eventually replace many of the typical div entries from the code. The definition of the structure starts with the tag:</p>
<p><strong><em>&lt;section&gt;</em></strong></p>
<p>A section is a thematic grouping of content, typically preceded by header, and ends with footer. Sections can be nested inside of each other, if needed, and can hold any amount of typical markup. The &lt;header&gt; of a section is typically a headline of grouping of headlines but it may also contain further helpful information about the section. A &lt;footer&gt; typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like. &lt;nav&gt; is a tag that defines the navigation area, typically a list of links. The nav should be a sibling of the main section, header, and footer. Finally, we have &lt;article&gt; and &lt;aside&gt; tags which are used for an independent entry and tangentially related content respectively. <span id="more-934"></span>Following comprehensive example makes use of all these tags:</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Standard Blog&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;header&gt;
      &lt;h1&gt;&lt;a href="#"&gt;Standard Blog&lt;/a&gt;&lt;/h1&gt;
    &lt;/header&gt;
    &lt;nav&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Archives&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/nav&gt;
    &lt;section&gt;
      &lt;article&gt;
        &lt;header&gt;
          &lt;h1&gt;&lt;a href="#"&gt;Title&lt;/a&gt;&lt;/h1&gt;
        &lt;/header&gt;
        &lt;section&gt;
          &lt;p&gt;Lorem ipsum...&lt;/p&gt;
        &lt;/section&gt;
      &lt;/article&gt;
    &lt;footer&gt;
      &lt;p&gt;Ending line&lt;/p&gt;
    &lt;/footer&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>As you can see, the tags themselves are much more descriptive than simply providing an id attribute to a div. This also gives the added benefit of a descriptive closing tag, as &lt;/article&gt; is much more understandable that wondering which &lt;div id=&#8221;something&#8221;&gt; goes with a given &lt;/div&gt;. At present, some of the browsers are missing full support for the structural tags of HTML5, but it would eventually become an integral feature of every browser.</p>
<div class="shr-publisher-934"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/in5_w2gdeQQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/html5/structural-tags-in-html5.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/html5/structural-tags-in-html5.html</feedburner:origLink></item>
		<item>
		<title>Creating Vector Masks with HTML5 Canvas Element</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/zX1IPQv4lRg/creating-vector-masks-with-html5-canvas-element.html</link>
		<comments>http://www.etechy101.com/html5/creating-vector-masks-with-html5-canvas-element.html#comments</comments>
		<pubDate>Sat, 24 Sep 2011 08:05:39 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[html5 code samples]]></category>
		<category><![CDATA[html5 help]]></category>
		<category><![CDATA[html5 tags]]></category>
		<category><![CDATA[html5 vector masks]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=929</guid>
		<description><![CDATA[With the canvas element present in HTML5, a lot of interesting things such as games, video effects and graphs etc can be created.  It can also be used to produce some slightly less complex effects, like manipulating images on the page. In this tutorial we would use the canvas element to create vector masks and [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fcreating-vector-masks-with-html5-canvas-element.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fhtml5%2Fcreating-vector-masks-with-html5-canvas-element.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>With the canvas element present in HTML5, a lot of interesting things such as games, video effects and graphs etc can be created.  It can also be used to produce some slightly less complex effects, like manipulating images on the page. In this tutorial we would use the canvas element to create vector masks and use them to modify images. For this purpose, first we need a canvas tag in our page:</p>
<pre>
&lt;canvas id="c" width="200" height="158"&gt;&lt;/canvas&gt;
</pre>
<p><span id="more-929"></span><br />
This just sets up a simple canvas with the width and height of our image. We have chosen these dimensions so that it does not take up any more space than is needed. Next in JavaScript we will get the canvas and its drawing context in JavaScript:</p>
<pre>
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d')
</pre>
<p>So now we are ready to begin drawing our image into the canvas.</p>
<p>We have our canvas set up, now we need to draw the image into that canvas. We can do this easily, but we need an HTML img element with our image in order to draw it. We could grab an &lt;img&gt; tag from our page, but we can do it using JavaScript.</p>
<pre>
// Create an image element

var img = document.createElement('IMG');

// When the image is loaded, draw it

img.onload = function () {

ctx.drawImage(img, 0, 0);

}

// Specify the source (src) to load the image

img.src = "http://i.imgur.com/gwlPu.jpg";
</pre>
<p>[inline_ads]<br />
Here we are creating a new element for our image. Since we can’t draw the image until it has been downloaded, we need to wait for onload to draw it. Inside of the onload listener, we call the ctx.drawImage(), and pass it the img element. We also pass 0, 0 meaning we want to draw 0 pixels from the top and left.</p>
<p>In the canvas, we can use a technique called clipping. We can use a path we define to specify that future operations should only affect the area within the path. Since the canvas is transparent, if we create a clipping path, and then draw the image, the image will only show up inside the shape of that path. So let’s draw a circle, clip to that path, and draw the image:</p>
<pre>
// Create an image element

var img = document.createElement('IMG');

// When the image is loaded, draw it

img.onload = function () {

// Save the state, so we can undo the clipping

ctx.save();

// Create a circle

ctx.beginPath();

ctx.arc(106, 77, 74, 0, Math.PI * 2, false);

// Clip to the current path

ctx.clip();

ctx.drawImage(img, 0, 0);

// Undo the clipping

ctx.restore();

}

// Specify the source (src) to load the image

img.src = "http://i.imgur.com/gwlPu.jpg";
</pre>
<p>You may notice the ctx.save() and ctx.restore() calls. This is because anything we try to do to the canvas after we clip it will only work within the clipping region. We call save() before we clip and then call restore() after, and the state of the canvas will be restored to before the clipping was applied. Everything you drew will remain, but the clipping definition will be gone. So the entire thing can also be done without clipping, but clipping can be used to further enhance the beauty of the overall effects.</p>
<div class="shr-publisher-929"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/zX1IPQv4lRg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/html5/creating-vector-masks-with-html5-canvas-element.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/html5/creating-vector-masks-with-html5-canvas-element.html</feedburner:origLink></item>
		<item>
		<title>Creating 3D Animations in CSS3</title>
		<link>http://feedproxy.google.com/~r/Etechy101/~3/UdWlVMxtMjQ/creating-3d-animations-in-css3.html</link>
		<comments>http://www.etechy101.com/css/creating-3d-animations-in-css3.html#comments</comments>
		<pubDate>Thu, 22 Sep 2011 13:30:31 +0000</pubDate>
		<dc:creator>eTechy</dc:creator>
				<category><![CDATA[CSS & CSS3]]></category>
		<category><![CDATA[3d css3]]></category>
		<category><![CDATA[css tips]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[css3 animation]]></category>
		<category><![CDATA[css3 examples]]></category>
		<category><![CDATA[css3 tips and tricks]]></category>

		<guid isPermaLink="false">http://www.etechy101.com/?p=923</guid>
		<description><![CDATA[Although CSS3 transition property is pretty simple, but creating 3D stuff using this and other properties can be quite cumbersome at times. This tutorial is reserved to create 3D animations in CSS3 in a least difficult way. This would be done using a special property of CSS3 which can be found in the library with [...]]]></description>
			<content:encoded><![CDATA[<p></p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fcreating-3d-animations-in-css3.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.etechy101.com%2Fcss%2Fcreating-3d-animations-in-css3.html&amp;style=normal&amp;service_api=R_9ff73b6d5d3848cc77dde21ec101fe8d&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Although CSS3 transition property is pretty simple, but creating 3D stuff using this and other properties can be quite cumbersome at times. This tutorial is reserved to create 3D animations in CSS3 in a least difficult way. This would be done using a special property of CSS3 which can be found in the library with the name of -webkit-perspective. This property is what would be used in this tutorial as well.</p>
<p>The most important role in the execution of this task would, once again, be performed by HTML. It goes like this:<br />
<span id="more-923"></span>
<pre>
&lt;ul id="movieposters"&gt;
&lt;li&gt;
&lt;img src="images/01_iron_man_2.jpg" alt="Iron Man 2" /&gt;
&lt;div class="movieinfo"&gt;
&lt;h3&gt;Iron Man 2&lt;/h3&gt;
&lt;p&gt;With the world now aware of his dual life as the armored superhero Iron Man, billionaire inventor Tony...&lt;/p&gt;
&lt;a href="#" title="Iron Man 2"&gt;More info&lt;/a&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;!-- More movie posters here --&gt;
&lt;/ul&gt;
</pre>
<p>[inline_ads]<br />
After that would come the CSS3 part which would mainly utilize the Safari reference library for CSS3 visual effects. This would work equally well with most other latest browsers.</p>
<pre>
#movieposters
{ list-style:none; margin:100px 0; height:550px; }

#movieposters li
{ display:inline; float:left;
-webkit-perspective: 500; -webkit-transform-style: preserve-3d;
-webkit-transition-property: perspective; -webkit-transition-duration: 0.5s; }

#movieposters li:hover
{ -webkit-perspective: 5000; }

#movieposters li img
{ border:10px solid #fcfafa; -webkit-transform: rotateY(30deg);
-moz-box-shadow:0 3px 10px #888; -webkit-box-shadow:0 3px 10px #888;
-webkit-transition-property: transform; -webkit-transition-duration: 0.5s; }

#movieposters li:hover img
{ -webkit-transform: rotateY(0deg); }
.movieinfo { border:10px solid #fcfafa; padding:20px; width:200px; height:180px; background-color:#deddcd; margin:-195px 0 0 55px; position:absolute;
-moz-box-shadow:0 20px 40px #888; -webkit-box-shadow:0 20px 40px #888;
-webkit-transform: translateZ(30px) rotateY(30deg);
-webkit-transition-property: transform, box-shadow, margin; -webkit-transition-duration: 0.5s; }

#movieposters li:hover .movieinfo
{ -webkit-transform: rotateY(0deg); -webkit-box-shadow:0 5px 10px #888; margin:-175px 0 0 30px; }

.movieinfo h3 { color:#7a3f3a; font-variant: small-caps; font-family:Georgia,serif,Times; text-align:center; padding-bottom:15px; }

.movieinfo p { padding-bottom:15px; }

.movieinfo a { background-color:#7a3f3a; padding:5px 10px; color:#eee; text-decoration:none; display:block; width:80px; text-align:center; margin:0 auto;
-moz-border-radius:5px; -webkit-border-radius:5px; }

.movieinfo a:hover, .movieinfo a:focus { background-color:#6a191f; color:#fff; }
</pre>
<p>The above code would give the beautiful effects of 3D, including rotation, hovering and transitions. However, since this property is relatively new, some browsers might have problems executing it in the way it should be. Other than these minor problems, everything is perfectly fine with this animation code.</p>
<div class="shr-publisher-923"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><img src="http://feeds.feedburner.com/~r/Etechy101/~4/UdWlVMxtMjQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.etechy101.com/css/creating-3d-animations-in-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.etechy101.com/css/creating-3d-animations-in-css3.html</feedburner:origLink></item>
	</channel>
</rss>

