<?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>Hans Pinckaers &#187; javascript</title>
	<atom:link href="http://www.hanspinckaers.com/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.hanspinckaers.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 17 Jul 2010 11:08:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Multiple backgrounds with canvas drawing</title>
		<link>http://www.hanspinckaers.com/multiple-backgrounds-with-canvas-drawing</link>
		<comments>http://www.hanspinckaers.com/multiple-backgrounds-with-canvas-drawing#comments</comments>
		<pubDate>Thu, 02 Apr 2009 21:51:42 +0000</pubDate>
		<dc:creator>Hans Pinckaers</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.hanspinckaers.com/?p=10</guid>
		<description><![CDATA[The canvas HTML element was invented by Apple. It was created to dynamically create complex images for Widgets. There where a few complaints about the element, but despite of that it is included in the HTML 5.0 working draft. All modern browsers are compatible with the canvas-tag, beside of Internet Explorer, but Google created a [...]]]></description>
			<content:encoded><![CDATA[<p>The canvas HTML element was invented by Apple. It was created to dynamically create complex images for Widgets. There where a few complaints about the element, but despite of that it is included in the <em><a href="http://www.w3.org/TR/html5/the-canvas-element.html" target="_blank">HTML 5.0 working draft</a></em>. All modern browsers are compatible with the canvas-tag, beside of Internet Explorer, but Google created a superb piece of javascript that ported the canvas to IE. I created a little piece of javascript for drawing multiple backgrounds in a canvas element behind an <em>HTML</em> element. <span id="more-10"></span></p>
<h2>The syntax</h2>
<p>First the syntax to call the function. I use this code to draw the backgrounds behind the header in this site:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$mb<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'info'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'url(http://hanspinckaers.com/img/mainBackgroundTop2.png) no-repeat 8px top'</span><span style="color: #339933;">,</span>
<span style="color: #3366CC;">'url(http://hanspinckaers.com/img/achtergrondHoofdartikel.jpg) no-repeat 8px bottom'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Examples</h2>
<ul>
<li>You can see a simple example with rounded corners <a href="http://hanspinckaers.com/mb/example/">here</a></li>
</ul>
<h2>Points of improvements</h2>
<ul>
<li>It’s buggy (report bugs please!)</li>
<li>Maybe convert it into a class</li>
<li>Speed (always a good one to improve)</li>
<li>Destination element must have an absolute or relative position declared in his css<strong></strong></li>
</ul>
<h2>Download</h2>
<p>Project homepage: <a href="http://github.com/HansPinckaers/mb.js/tree/master">at Github</a>. You can download the files from there.</p>
<h2>Using it</h2>
<p>You have to add these lines before you call the $mb funtion:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if IE]&gt;
&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;changed_excanvas_compressed.js&quot; mce_src=&quot;changed_excanvas_compressed.js&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;
&lt;script src=&quot;mbmin.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;</pre></div></div>

<p>I modified googles <a href="http://code.google.com/p/explorercanvas/">excanvas</a> so it is smaller but can only be used to draw images.</p>
<p>If you have any questions, please ask in the comments! And please always keep progressive enhancement in mind, so set a normal replacement background in the css.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hanspinckaers.com/multiple-backgrounds-with-canvas-drawing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
